summaryrefslogtreecommitdiff
path: root/misc/tictactoe.py
diff options
context:
space:
mode:
authormlot <petri-rush-curvy@duck.com>2025-06-06 13:40:57 -0400
committermlot <petri-rush-curvy@duck.com>2025-06-06 13:40:57 -0400
commit75a42ec54dbf721caa659ddf02c1f46fc2cb4bef (patch)
tree84be794a2481e356a7784557a6f9fb6fbf29cfdd /misc/tictactoe.py
initial commit for archivingHEADmain
Diffstat (limited to 'misc/tictactoe.py')
-rw-r--r--misc/tictactoe.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/misc/tictactoe.py b/misc/tictactoe.py
new file mode 100644
index 0000000..fa7995b
--- /dev/null
+++ b/misc/tictactoe.py
@@ -0,0 +1,27 @@
+#!Python
+
+#Tic tac toe Game
+
+theBoard = {'top-L':' ','top-M':' ','top-R':' ',
+ 'mid-L':' ','mid-M':' ','mid-R':' ',
+ 'low-L':' ','low-M':' ','low-R':' '}
+
+def printBoard(board):
+ print(board['top-L'] + '|' + board['top-M'] + '|' + board['top-R'])
+ print('-+-+-')
+ print(board['mid-L'] + '|' + board['mid-M'] + '|' + board['mid-R'])
+ print('-+-+-')
+ print(board['low-L'] + '|' + board['low-M'] + '|' + board['low-R'])
+
+turn = 'X'
+for i in range(9):
+ printBoard(theBoard)
+ print('Turn for ' + turn + '. Move on which space? Example:top-L or mid-M or low-R')
+ move = input()
+ theBoard[move] = turn
+ if turn == 'X':
+ turn = 'O'
+ else:
+ turn = 'X'
+
+printBoard(theBoard)