I get why the binary is there, but there really should be a simple way to force compilation instead of downloading a precompiled binary.
Serde is incredible though, so it can get away with basically anything it wants.
I get why the binary is there, but there really should be a simple way to force compilation instead of downloading a precompiled binary.
Serde is incredible though, so it can get away with basically anything it wants.
Ideally, all of these values should be represented in memory exactly the same way:
That would make the game hard to play, since you’d have to think about where your move would end up since it won’t stay on the cell you click.
I think you’re wanting to store them that way so that you can easily check for win conditions, maybe? But that’s the wrong approach. Store the cells as they appear to the player, in a 2d Array (or 1d Array with indexing math. That’s how I’d do it).
Then you can take advantage of symmetries in your win condition code, if you like. But it really couldn’t be much simpler than counting the matching cells in each row, column, and diagonal. That’s just 8 groups of 3.
How are you running the executable? From command line?
Good luck with it. What’s it called?
Gotcha. I unfortunately decided to give up on trying to do this in Rust. I’m trying out JUCE since it’s industry standard. I’m already bashing my head against the wall with this C++ garbage. Hopefully the gui scene looks better for rust soon
For real. Unless he’s converting between results and ints millions of times a second, I think he’s going to be just fine using the idiomatic solution. That transmute shit I’d wack lol
So what! Who cares if it’s free? Write first, profile and optimize later. Not everyone cares about whether the conversion is free. Simply matching and converting to the right integer is fast enough.
You’ve pretty much got it figured out. Create your result type and write an Impl for covering to/from integers. You can use From/Into to keep it idiomatic.
I’d say something like LUA or python so people could easily write their own plug-ins. If speed really is a concern then I’d go with wasm.
Yeah, you can’t pass one type when the function expects another type. You have either use generics and trait bounds or provide the exact type that a function expects…
What errors are you getting when converting from BaseArmy to Army? If you’re storing references to other structs in your struct, things can get complicated. Using Clone/Copy types will make things easier.
I’d also recommend the builder pattern for this. It let’s you build up a type incrementally, with a final build step that produces the final type.
Lol not a great name choice. Wish I would have thought of it though.