ALL


  The tic-tac-toe game with Python

In this tutorial, we will show how to build a tic-tac-toe game with Python. We will use functions,arrays,if statements,while statements, for loops and error handling etc.First, we need to create two functions, the first function will display the borad of the game:def print_board(): for i in range(0,3): for j in range(0,3): print map[2-i][j], if j != 2: print "|", print ""Here we used two for loops to loop through the map, this map is a two dimensional array which contains the location information.The board looks like: | | | | |...

25,725 1       PYTHON TIC-TAC-TOE