Skip to content

Commit

Permalink
cleaned up ticTacToe formatting, added a todo list
Browse files Browse the repository at this point in the history
  • Loading branch information
PatHurley committed Jun 28, 2020
1 parent e6cd2e3 commit 7027260
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions bin/ticTacToe
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/bash
# -----------------------------------------------------------------------------
# Written by: P.Hurley
# A multi-player game of tic-tac-toe
# A multiplayer game of tic-tac-toe
#
# TODOs:
# -user multiplayer (same system)
# -network multiplayer (LAN/WAN)
# -AI opponent (Easy/Medium/Hard)
# -----------------------------------------------------------------------------

VERSION=1.0.0
Expand Down Expand Up @@ -49,7 +54,7 @@ while [[ "$1" =~ ^-.* ]]; do
USAGE
exit 1
;;
esac; shift
esac;
done

# --- Variable Initialization -------------------------------------------------
Expand All @@ -59,21 +64,21 @@ a1=' ';a2=' ';a3=' '
b1=' ';b2=' ';b3=' '
c1=' ';c2=' ';c3=' '

# horizontal wins
# horizontal win patterns
xh1="XXX......";xh2="...XXX...";xh3="......XXX"
oh1="OOO......";oh2="...OOO...";oh3="......OOO"

# vertical wins
# vertical win patterns
xv1="X..X..X..";xv2=".X..X..X.";xv3="..X..X..X"
ov1="O..O..O..";ov2=".O..O..O.";ov3="..O..O..O"

# diagonal wins
# diagonal win patterns
xd1="X...X...X";xd2="..X.X.X.."
od1="O...O...O";od2="..O.O.O.."

winner=''
turn='X'
i=1
winner='' # Explicitly defined as empty.
turn='X' # Player who goes first.
i=1 # Used to count turns.

# --- Functions ---------------------------------------------------------------

Expand Down

0 comments on commit 7027260

Please sign in to comment.