π
<-

Tic Tac Toe for ti 84 (1 player against AI) no bugs

Pour le TI-Basic sur Nspire

Tic Tac Toe for ti 84 (1 player against AI) no bugs

Unread postby parzival1747 » Today, 00:28

This program is a beta version of the original version that I dug up a day ago. It is only for TI-BASIC. The program has a working AI.
Ce programme est une version bêta de la version originale que j'ai dénichée il y a un jour. Il est uniquement destiné à TI-BASIC. Le programme dispose d'une IA fonctionnelle.
0->M
ClrDraw
AxesOff
0->Xmin
0->Ymax
-62->Ymin
94->Xmax
Menu("WHO MOVES FIRST?","ME",ME,"AI",AI
Lbl AI
2->F
Goto D9
Lbl ME
1->F
Goto D9

Lbl D9
ClrHome
ClrAllLists

4->B
6->A
{1,2,3,1,2,3,1,1,1,2,2,2,1,2,3,1,1,1,3,1,1,1,3,3}->Ÿ1
{1,1,1,2,2,2,1,2,3,1,2,3,1,1,1,1,2,3,1,1,1,3,1,3}->Ÿ2
{1,2,3,1,2,3,2,2,2,3,3,3,1,2,3,3,3,3,1,3,2,2,2,2}->Ÿ3
{2,2,2,3,3,3,1,2,3,1,2,3,3,3,3,1,2,3,3,3,2,2,2,2}->Ÿ4
{1,2,3,1,2,3,3,3,3,1,1,1,1,2,3,2,2,2,2,2,3,3,1,1}->Ÿ5
{3,3,3,1,1,1,1,2,3,1,2,3,2,2,2,1,2,3,2,2,3,1,3,1}->Ÿ6
{2,4,6,2,4,6,6,6,6,2,2,2,2,4,6,4,4,4,4,4,6,6,2,2}->ŸB
{6,6,6,2,2,2,2,4,6,2,4,6,4,4,4,2,4,6,4,4,6,2,6,2}->ŸA
ClrDraw
{3,3}->dim([A]0
Fill(0,[A])
Text(-1,16,54,"Moves"
Text(-1,24,54,"left:"
Line(4,-35,36,-35
Line(4,-19,36,-19
Line(14,-6,14,-47
Line(26,-6,26,-47
Text(-1,0,0,"TIC TAC TOE"
If F=2
Goto R8
If F=1
Goto P8

Lbl AW
ClrHome
Disp "AI Wins..."
Pause
ClrHome
Stop
Lbl PW
ClrHome
Disp "Player Wins..."
Pause
ClrHome
Stop
Lbl A9
M+1->M
Text(-1,24,84,10-M

Text(-1,56,0,"AI'S TURN"
0->L
For(J,1,24) /Blocks Player's Win
If ([A](Ÿ1(J),Ÿ2(J))=1 and [A]*Ÿ3(J).Ÿ4(J))=1 and [A]*Ÿ5(J).Ÿ6(J))=0
Then
2->[A]*Ÿ5(J).Ÿ6(J))
Text(-1,*ŸB(J)*8)-8,*ŸA(J)*6)-6,"O"
If M=9
Goto TI
Goto P8
End
End
M-1->M
Goto R8


Lbl R8
Text(-1,56,0,"AI'S TURN
M+1->M
Text(-1,24,84,10-M

{2,4,6}->ŸBD /Generates random spot if there's no win to block
Repeat [A](A,B)=0
randInt(1,3)->A
randInt(1,3)->B
End
Text(-1,(*ŸBD(A)*8)-8,((ŸBD(B)*6)-6),"O"
2->[A](A,B)
If M=9
Goto TI
Goto P8
Lbl TI
ClrHome
Disp "TIE!
Pause
ClrHome
Stop
Lbl P8 /Player Makes a move
M+1->M
Text(-1,24,84,10-M
Text(-1,56,0,"YOUR TURN"
Repeat K>0
getKey->K
If (K=72 and [A](1,1)=0)
Then
Text(-1,8,6,"X
1->[A](1,1
End
If (K=73 and [A](1,2)=0)
Then
Text(-1,8,18,"X
1->[A](1,2
End
If (K=74 and [A](1,3)=0)
Then
Text(-1,8,30,"X
1->[A](1,3
End
If (K=82 and [A](2,1)=0)
Then
Text(-1,24,6
1->[A](2,1
End
If (K=83 and [A](2,2)=0)
Then
Text(-1,24,18,"X
1->[A](2,2
End
If (K=84 and [A](2,3)=0)
Then
Text(-1,24,30,"X
1->[A](2,3
End
If (K=92 and [A](3,1)=0)
Then
Text(-1,40,6,"X
1->[A](3,1
End
If (K=93 and [A](3,2)=0)
Then
Text(-1,40,18,"X
1->[A](3,2
End
If (K=94 and [A](3,3)=0)
Then
Text(-1,40,30,"X
1->[A](3,3
End
End
For(J,1,24
If [A](Ÿ1(J),Ÿ2(J))=1 and [A]*Ÿ3(J).Ÿ4(J))=1 and [A]*Ÿ5(J).Ÿ6(J))=1
Goto PW
End
If M=9
Goto TI
GotoA9
User avatar
parzival1747
Niveau 0: MI (Membre Inactif)
Niveau 0: MI (Membre Inactif)
Level up: 0%
 
Posts: 1
Joined: Today, 00:21
Gender: Not specified
Calculator(s):
MyCalcs profile

Return to Nspire-Basic

Who is online

Users browsing this forum: No registered users and 3 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
4527 utilisateurs:
>4515 invités
>6 membres
>6 robots
Record simultané (sur 6 mois):
29271 utilisateurs (le 11/07/2025)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)