Created
April 16, 2016 18:20
-
-
Save ejmurray/8cd1c03ec4d035b8ec79ee5eb50a4537 to your computer and use it in GitHub Desktop.
TicTacToe.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# author: Ernest | |
# created: 25/01/2016 | |
# https://gist.github.com/ejmurray/52c56468730a50414615 | |
""" | |
Description | |
""" | |
print('Here is the first board!') | |
print(''' | |
_|_|_ | |
_|_|_ | |
| | | |
''') | |
def board_lines(): | |
line_1 = ('_|_|_') | |
line_2 = ('_|_|_') | |
line_3 = (' | | ') | |
print(line_1) | |
print(line_2[0:5]) | |
print(line_3) | |
# board_lines() | |
board = [0, 2, 4, 6, 8, 10, 12, 14, 16] # keep track of the players markers | |
def input_marker(): | |
""" | |
Returns: The values that are entered by the player | |
TODO: Append the marker and position to a list | |
""" | |
marker = raw_input('Enter a marker and position separated by a comma: ') | |
marker = list(marker.split(',')) | |
print('the marker is: ' + marker[0]) | |
print('the position is: ' + marker[1]) | |
return marker[0] | |
return marker[1] | |
def board_lines2(marker): | |
line_4 = '_|_|_\n_|_|_\n | | ' | |
line4 = list(line_4) | |
# change the first box to an X | |
line4[0] = marker[0] | |
line_new = "".join(line4) | |
print() | |
print(line_new) | |
# input_marker() | |
board_lines2(input_marker()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment