Last active
November 16, 2015 04:05
-
-
Save andrewfhart/926a5d85e303f9b2c610 to your computer and use it in GitHub Desktop.
Tic-tac-toe Tutorial (Step 0)
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
#include <iostream> | |
using namespace std; | |
void drawBoard(int board[][3]) { | |
cout << " " << " A B C " << endl; | |
cout << " " << "+---+---+---+" << endl; | |
for (int row = 0; row < 3; row++) { | |
cout << row << " " << "| | | |" << endl; | |
cout << " " << " " << "+---+---+---+" << endl; | |
} | |
} | |
int main (int argc, char* argv[]) | |
{ | |
// State variables | |
// | |
// Board: | |
// 0 1 2 | |
// +---+---+---+ | |
// 0 | | | x | x = board[0][2] | |
// +---+---+---+ | |
// 1 | | | | | |
// +---+---+---+ | |
// 2 | | | | | |
// +---+---+---+ | |
int board[3][3]; | |
drawBoard(board); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment