Game Guides > Game FAQ >  

How do you program the game Battleship on your TI-84

How do you program the game Battleship on your TI-84
Use matrices.
There are only matrices from [A] through [J], so I like to use [J], because that is the one people use the least.
Access one element in a matrix like this: for the element in the second row, third column:
[J](2,3)
use the store \->\ command to store to an element (an element is a number in the matrix)
3\->\[J](2,3)
you could have a matrix with 10 rows and 10 columns. To change that in a program, do:
{10,10}\->\dim([J])
Now, you can store numbers to each element in [J] that specifies the ocean or a ship. Next, just write some code to let you select a space to hit and display the game board, and you have battleship.