Tic-Tac-Toe
I just realized that my karma went up! Cool! I made my own version of Tic-Tac-Toe and would like any suggestions that anyone has to make it better. I used a technique to figure out the position that is sort of cool. I really didn't think that I would be able to make this game, but I finally did! I would like to make an AI, but I don't want to really just use randint( to do so. I think that it could make an ok AI though.
Here is the code…
:ClrHome
:Delvar [A]{3,3->dim([A] // I included a Martix for when in the future that I put in an AI and also for checking for open spots
:For(I,3,13
:Output(3,I,"-
:Output(5,I,"-
:End
:For(I,2,6
:Output(I,6,"I
:Output(I,10,"I
:End
:Output(8,5,"Player:
:"XO"->Str1:1->B
:Repeat K=45
:getKey->K
:Output(8,12,sub(Str1,B,1
:If sum(K={72,73,74,82,83,84,92,93,94
:Then
:K-61->G:G/10->G //This is my technique to find the position on the board
:If [A](iPart(G),10fPart(G))=0
:Then
:Output(2iPart(G),40fPart(G),sub(Str1,B,1
:B->[A](iPart(G),10fPart(G)
:B+1->B
:If B=3
:1->B
:End
:End
:End