Clipsey ‮✅ is a user on mastodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.

man idk, Rust is putting up way more of a fight than Golang did for me... I guess that's kind of by design though. octodon.social/media/yjYuGa_nH

Alright I got tic-tac-toe working in both Go and (omg the struggle) Rust!

Here's my long blog post about it: sts10.github.io/2017/11/18/try (tl;dr Rust seems like a really cool idea, but Go seems more practical for most)

Golang repo: github.com/sts10/tic-tac-go

Rust repo: github.com/sts10/rusty-tac

@schlink Here's some nifty golang thing. structs can have attached functions.

So if i make a struct, called vector with 2 inputs of X and Y (int)

type Vector struct {
X int
Y int
}

i can attach a function, like "Add"

func (v *Vector) Add(other Vector) {
return Vector{v.X + other.X, v.Y + other.Y}
}

@Clipsey ah, I feel like that'll be the next thing for me to investigate (that or interfaces).

So this function is named "Add", the input is "other" of type Vector, and... there's no output?

@schlink You need structs before interfaces can be useful, unless you use interface{}, which is golang's form of OOP object class.

Clipsey ‮✅ @Clipsey

@schlink github.com/Member1221/mgj2017 Here's a small game i made in golang for a game jam, tried to make golang be quite OOP with interfaces, feel free to poke around with the code :D

· Web · 0 · 1