Chess Program that I made.....


[Prev][Next][Index][Thread]

Chess Program that I made.....



This is a program that makes pairings for a chess tournament. Enjoy!










()
Prgm


Local temp,n,i,turnname,players,games,turnmat,val1,val2,t


ClrIO


InputStr "Name of Tourney=",turnname
Input "Number of Players=",n
newList->(n)players
For i,1,n,1
InputStr "Player="&string(i),temp
temp->players[i]
EndFor


ClrIO
Disp "Shuffling players..."


0games
For i,1,n
For j,i+1,n
games+1->games
EndFor
EndFor


newMat(games,2)->turnmat
0->t
For i,1,n
For j,i+1,n
t+1->t
i->turnmat[t,1]
j->turnmat[t,2]
EndFor
EndFor




newList(2)->temp
For i,1,games*3
Output 0,0,"Shuffling players: "&string(int(i/(games*3)*100))&"%"
int(rand()*games)+1->val1
int(rand()*games)+1->val2
turnmat[val1,1]->temp[1]
turnmat[val1,2]->temp[2]
turnmat[val2,1]->turnmat[val1,1]
turnmat[val2,2]->turnmat[val1,2]
temp[1]->turnmat[val2,1]
temp[2]->turnmat[val2,2]
If rand()>.5 Then
turnmat[val1,1]->t
turnmat[val1,2]->turnmat[val1,1]
t->turnmat[val1,2]
EndIf
EndFor


ClrIO
Disp "Tourney "&turnname&":"
For i,1,games
Pause "Game ["&string(i)&"/"&string(games)&"]: "&players[turnmat[i,1]]&"
vs "&players[turnmat[i,2]]
EndFor


EndPrgm