Disclaimer: I only have a TI-85, whose commands are slightly different from the TI-83 and TI-84.
- At first, I was puzzled by the numbering of the squares. Then I realized that squares 1 to 9 corresponded nicely to the way the calculator number pad is laid out. Nice!
- You could probably do without the lines at ±9, as a tic-tac-toe board is conventionally drawn as
#, with no borders.
- There's not much point in asking who goes first, in my opinion.
- As you noted, you fail to check whether a square is already occupied. A nine-element list could easily be used to perform that check.
O are defined but never used.
- I don't know why you chose to name your variables
M. I would have picked
P for "player" and
S for "square".
- The two-argument form of the
Input command can also display the prompt.
fPart(M/3)3-2→H didn't work for me. Due to the way precedence of operations works on the TI-85, it is evaluated at
fPart((M/3)3)-2→H. Rewriting it as
3fPart(M/3)-2→H fixes it.
The code to map
V is excessively complicated. Each assignment should be done in one line:
The TI-84 has
remainder() instead of
The TI-83 has neither
mod(), and must use
I believe the latter is works for all three models.
- Your use of
Goto is unjustified.
I should be initialized, tested, and incremented using a
- To toggle
F between 0 and 1, just do
1-F→F. You don't need an
- I'm not sure that
ClrDraw adequately resets the drawing context. On the TI-85, I need
ZStd (to set the bounds to the standard zoom), and
AxesOff (to hide the axes).
Rewrite for the TI-85 dialect
I've noted what I believe the equivalent TI-83 / TI-84 commands are, based on reading the Guidebooks.
:ClLCD Equivalent to ClrHome?
:ClDrw Equivalent to ClrDraw?
:ZStd Equivalent to ZStandard?
:DrawF -3 Equivalent to Horizontal?
:Vert -3 Equivalent to Vertical?
:Input "Square (1-9)? ",S
:6(mod(S-1,3)-1)→H See portability note above.
:Circl(H,V,2) Equivalent to Circle?