diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..9c69411
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..dc9ea49
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..a36a7e2
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/prg-prl-ii-pk-kn.iml b/.idea/prg-prl-ii-pk-kn.iml
new file mode 100644
index 0000000..d0876a7
--- /dev/null
+++ b/.idea/prg-prl-ii-pk-kn.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tictactoe.py b/tictactoe.py
index d3e9ae8..a1462fa 100644
--- a/tictactoe.py
+++ b/tictactoe.py
@@ -9,6 +9,10 @@ field = [[" ", "|", " ", "|", " "],
["—", "+", "—", "+", "—"],
[" ", "|", " ", "|", " "]]
+player1 = True # bool that states which player is currently playing
+player1_char = "X"
+player2_char = "O"
+
def printer(): # function that prints the field
@@ -20,16 +24,50 @@ def printer(): # function that prints the field
print("\n", end="")
-def turn(): # function that checks whoose turn it is and where they can place their symbol
- print("penis")
+def turn(): # function that checks whose turn it is and where they can place their symbol
+
+ while True:
+ next_move_x = int(input(
+ f"Player {1 if player1 else 2}, please choose the x (horizontal) coordinates of your next move: "))
+ if next_move_x in list(range(3)): # TODO Implement check to see if move is legal
+ break
+ else:
+ print("Please be sure to input a valid number (0-2). \nPlease try Again.")
+
+ while True:
+ next_move_y = int(input(
+ f"Player {1 if player1 else 2}, please choose the x (vertical) coordinates of your next move: "))
+ if next_move_y in list(range(3)): # TODO Implement check to see if move is legal
+ break
+ else:
+ print("Please be sure to input a valid number (0-2). \nPlease try Again.")
+
+ # it might be possible to compress the two above loops into one
+
+ return check_move(next_move_x, next_move_y)
-player1_char = "X"
-player2_char = "O"
+def do_move(x, y):
+ global player1 # Tells do_move to look for the global var player1
+ field[x][y] = (player1_char if player1 else player2_char)
+ printer()
+ # TODO implement win checker here
+ player1 = not player1
+ turn()
+
+
+def check_move(x, y):
+ # translate x and y coordinates to field coordinates
+ x = int(x * 2)
+ y = int(y * 2)
+ if not field[x][y] == " ":
+ print("Your given coordinates are already occupied. \nPlease Try again.\n")
+ turn()
+ else:
+ do_move(x, y)
+
print("Willkommen zu Kat&Paul's TicTacToe:")
-
printer()
-
-
-# ssh push test
\ No newline at end of file
+print("Player 1 (X) will start playing.")
+turn()