Tic-tac-toe: Difference between revisions
Content deleted Content added
mNo edit summary |
m Simplified code to turn off flashing cursor |
||
Line 2,294:
</pre>
[[File:TTTXPL0.GIF|right]]
<lang XPL0>\The computer marks its moves with an "O" and the player uses an "X". The
Line 2,315 ⟶ 2,314:
int X, O; \bit arrays for player and computer
\ bit 0 corresponds to playing square 1, etc.
int CpuReg;▼
SoftInt(Int);▼
Line 2,407 ⟶ 2,391:
proc PlayGame; \Play one game
[ChOut(0, $0C\FF\); \clear screen with a form feed
HLine(X0-1, Y0+1); \draw grid (#)
Line 2,445 ⟶ 2,428:
▲int CpuReg;
[SetVid(1); \set 40x25 text mode
CpuReg(0):= $0100; \ with BIOS interrupt 10h, function 01h
CpuReg(2):= $2000; \set cursor type to disappear
loop [PlayGame;
Key:= ChIn(1); \keep playing games until Esc key is hit
|