• 0 Posts
  • 6 Comments
Joined 1 year ago
cake
Cake day: July 4th, 2023

help-circle




  • Nothing wrong with that. My idea was to do a vector (or fixed-size array if you prefer) in one dimension. An example would be something like [0, 1, 2, 0, 1, 0, 2, 0, 2] (where O is 1, X is 2 and 0 represents an empty cell). The math to get the index is similar to this:

    https://bfnightly.bracketproductions.com/chapter_3.html#building-a-simple-map

    Might be overkill for a simple tic-tac-toe game, but if you want to rotate the board or whatever, you can just change the math you do to get the index. I'm not at all a math expert, but it seems like a reasonable approach.