Jump to content

Tic-tac-toe: Difference between revisions

Line 4,748:
textsize 14
#
funcproc init . .
linewidth 2
clear
Line 4,768:
.
.
funcproc draw ind . .
c = (ind - 1) mod 3
r = (ind - 1) div 3
Line 4,787:
.
.
funcproc sum3 a d . st .
for i = 1 to 3
s += f[a]
Line 4,798:
.
.
funcproc rate . res done .
res = 0
for i = 1 step 3 to 7
Line 4,820:
.
.
funcproc minmax player alpha beta . rval rmov .
call rate rval done
if done = 1
Line 4,846:
.
.
funcproc show_result val . .
color 555
move 16 4
Line 4,859:
state += 2
.
funcproc computer . .
call minmax 4 -11 11 val mov
f[mov] = 4
Line 4,869:
.
.
funcproc human . .
mov = floor ((mouse_x - 6) / 28) + 3 * floor ((mouse_y - 16) / 28) + 1
if f[mov] = 0
2,083

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.