Tic-Tac-Toe for the HP-67/97!

Back to main page | Email me at: Gene!


The program presented below will play the game Tic-Tac-Toe on the HP- 67/97. It appeared in the V5N1P10 issue of PPC Journal (January 1978).

The calculator keyboard is the playing grid. Just enter the digit corresponding to the space you want to move to and enter it. You play X and go first.

Instructions:
1) To start, enter a 0 and press A. Note: whenever 0 is displayed, it means that a restart has occurred. If this catches you by surprise, you probably made an illegal move.
2) Enter X's move and press A. The display will show, as a negative number, O's move.
3) Continue step 2 until you win (don't think you'll be able to do this), you lose (the display will be flashing), or all squares are taken (the game is a CAT - the display will show 0 for restart when this happens).


Program Listing: Note: the PRTX is the -x- function on the HP-67. SPC is the advance printer paper function. It is present on both the HP- 97 and HP-67. On the HP-67, it does nothing, so key it in anyway for this program. Email if you have any questions.
Line      Instruction
01         GTO 5
02         SPC
03         8
04         RTN
05         1
06         RTN
07         6
08         RTN
09         3
10         RTN
11         5
12         RTN
13         7
14         RTN
15         4
16         RTN
17         9
18         RTN
19         2
20         RTN
21         LBL A
22         ABS
23         INT
24         9
25         X <> Y
26         X > Y
27         GTO 5
28         2
29         *
30         3
31         3
32         -
33         ST I
34         GSB (i)
35         STO A
36         RCL E
37         1
38         +
39         STO E
40         X <> Y
41         ST I
42         RCL (i)
43         X NE 0
44         GTO 5
45         RDN
46         STO (i)
47         RDN
48         ST I
49         GTO (i)
50         LBL 1
51         RCL A
52         5
53         X = Y 
54         4
55         GTO 0
56         LBL 2
57         RCL A
58         GSB B
59         X > 0
60         GTO 0
61         1
62         0
63         STO B
64         LBL c
65         RCL B
66         1
67         -
68         STO B
69         ST I
70         X = 0
71         GTO d
72         RCL (i)
73         X NE 0
74         GTO c
75         RC I
76         CHS
77         GSB B
78         X = 0
79         GTO c
80         RCL 1
81         RCL 3
82         *
83         X NE 0
84         X < 0
85         GTO 6
86         RDN
87         RCL 8
88         X NE 0
89         GTO 6
90         8
91         GTO 0
92         LBL 6
93         RDN
94         GTO 0
95         LBL d
96         ISZ
97         RCL (i)
98         X NE 0
99         GTO d
100        RC I
101        LBL 0
102        ST I
103        CHS
104        STO C
105        STO (i)
106        2
107        *
108        9
109        1
110        -
111        ST I
112        GSB (i)
113        CHS
114        RTN
115        LBL 4
116        LBL 3
117        RCL C
118        GSB B
119        X = 0
120        GTO 2
121        GSB 0
122        1
123        CHS
124        ST I
125        RDN
126        PRTX (-x-)
127        GTO (i)
128        LBL 5
129        CL REG
130        CLX
131        R/S
132        LBL B
133        STO 0
134        1
135        0
136        ST I
137        LBL b
138        RC I
139        1
140        -
141        X = 0
142        RTN
143        ST I
144        RCL 0
145        RCL (i)
146        X = 0
147        GTO b
148        X = Y
149        GTO b
150        *
151        X < 0
152        GTO b
153        RCL 0
154        RCL (i)
155        +
156        ABS
157        6
158        X > Y
159        GTO b
160        9
161        +
162        X < = Y
163        GTO b
164        -
165        CHS
166        X <> I
167        RCL (i)
168        X <> Y
169        X <> I
170        X <> Y
171        X NE 0
172        GTO b
173        RDN
174        RTN

That's it. Enjoy!
Visitors since 8/6/97