18-97-9-175.crawl.commoncrawl.org | ToothyWiki | MoonShadow | RecentChanges | Login
[Click to play]
Bugs:
logic
{
local array lines
{ 0, 1, 2,
3, 4, 5,
6, 7, 8,
0, 3, 6,
1, 4, 7,
2, 5, 8,
0, 4, 8,
2, 4, 6 }
array board
{ 0, 0, 0,
0, 0, 0,
0, 0, 0 }
int turn { 1 }
int win { 0 }
for i ( 1 .. 2 )
{
for j ( 0 .. 8 )
{
when
{
(turn == i)
and (board[j] == 0)
}
allow
{
board[j] = i;
turn = 3 - i;
}
label { "player " i " move to (" (j/3) " , " (j%3) ")" }
}
}
for j ( 0 .. 7 )
{
when
{
(board[lines[j*3]] != 0)
and ( (board[lines[j*3]] == board[lines[(j*3)+1]])
and (board[lines[(j*3)+1]] == board[lines[(j*3)+2]]))
}
allow
{
win = board[lines[j*3]];
}
label { "player " board[lines[j*3]] " win" }
}
}
display
{
stringtable counters
{
" ",
"O",
"X"
}
stringtable playernames
{
"error",
"noughts",
"crosses"
}
box
{
content { "Noughts and crosses" }
}
newline
for j ( 0 .. 8 )
{
box
{
width { 2em }
height { 2em }
border { 1px solid black }
content { counters[ board[j] ] }
bind_action { "player 1 move to (" (j/3) " , " (j%3) ")" }
bind_action { "player 2 move to (" (j/3) " , " (j%3) ")" }
}
if( (j % 3) == 2 )
{
newline
}
}
newline
box
{
bind_action { "player 1 win" }
bind_action { "player 2 win" }
content { counters[turn] " to move"}
while_active { content { } }
}
for j ( 1 .. 2 )
{
box
{
content { }
bind_action { "player " j " win" }
while_active { content { "- " counters[ j ] " has won!" } }
}
}
}
[Recompile this page]
[Compiler error log]
ToothyGDL