Posts

Showing posts with the label Tic Tac Toe Game

Tic Tac Toe

Image
#First we need a matrix on which the symbols X  #and O will be placed matrix=[[ '*' , '*' , '*' ],[ '*' , '*' , '*' ],[ '*' , '*' , '*' ]] #Then create 2 players namely p1 and p2 and assign respective symbols p1= 'x' p2= 'o' #Now we will display the empty matrix #Create a function print_board def   print_board ( matrix ):      for  row  in  matrix:         row= "   |   " .join(row)         row=row.strip()         row=row+ "\n"          print (row) #Another function to enter player's choice of position to place the  #symbol def   write_...