Skip to content

Instantly share code, notes, and snippets.

@andrewfhart
Last active November 16, 2015 04:05
Show Gist options
  • Save andrewfhart/926a5d85e303f9b2c610 to your computer and use it in GitHub Desktop.
Save andrewfhart/926a5d85e303f9b2c610 to your computer and use it in GitHub Desktop.
Tic-tac-toe Tutorial (Step 0)
#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