Tic-Tac-Toe
We're at a point where we need a way to read through the grid and determine who won the game first.
Now, a quick bit of info:
- Pre-requisites:
You must know C,C++,C#, Java, or any C based language(At the very least)
You must know how to work with two dimensional Arrays.
You must know how to properly make a function.
You must have a compiler available to use.
_~*:!: [End of list] *~_
That being said, now we'll get into the technical side of things:
- We are using an Ennead system to go about this as there are only 9 possible moves in tic-tac-toe.
The idea behind the Ennead system is to create a sort of Pseudo-Ennead(An Ennead instead of a decimal. We convert a decimal to an Ennead, obviously.
Each digit of the Ennead represents a different move at a different position. A sample Ennead would be 123456789 which would look like this on the Move_Grid[][] array:
123
456
789
And, on the Player_Array[][]:
010
101
010
On the Player_Array, Player 1 is stored as 0, and player 2 is stored as 1.
The idea behind the Ennead's is that each integer represents the order of it's move.
So, the '1' you see at Move_Grid[0][0] is move number 1, and the '5' you see at Move_Grid[1][1] is move number 5.
Now, the spot we're at requires for the move grid to be read, and for it's ordering to be noted, so we can see who the true winner is.
A good example of how it currently fails to do this is on Run #5993(Oh yeah, I forgot to tell you guys. In Tic-Tac-Toe there are 9!(362880) possible games. We're bruteforcing them):
123465987 Run #5993 Result: Loss [As seen in the LOG.txt generated by the program.]
123465987 is a win actually.
123 010
465 110
987 010
The three 0's occurred first, however, due to the fact that loss detection happens after Win detection this is the result.
With all that out of the way...
Here's the code
http://roxfox64.pastebin.com/fWPauNjb