# logic behind a single player game [closed]

i would like to code a single player game where at each turn a player has to write a letter on a grid. In response the computer would write a letter and so on. As soon as a word is created as a result of writing a letter, the player gets as many points as the no of letters in the word. how would i code it.

• You should start coding by your self and then ask for a particular problem if it occurs. But basically you need to generate a random letter, get human input, check the string toward a dictionary and then start over. Dec 25 '12 at 22:03
• meta.gamedev.stackexchange.com/questions/171/… Dec 26 '12 at 4:03

That’s a pretty easy almost-infinite loop. The main loop is something very common in game programming.

In Pseudo code:

playerTurn = 1 // playerTurn = 1 means its players turn, = 0 means computers turn

somebodyWon = False

while somebodyWon = False:
if playerTurn:

• Some input for the player to input a letter (e.g. scanf() in C or StreamReader in Java)