Skip to content

Instantly share code, notes, and snippets.

@HunterVL
HunterVL / Tic-Tac-Toe.cpp
Created December 21, 2016 05:26
A C++ bot that plays Tic-Tac-Toe against a human.
#include <iostream>
#include <cstring>
#include <algorithm>
#include <ctime>
using namespace std;
#define compareBoxes(box1, box2, box3) ((board[box1] == board[box2]) && (board[box2] == board[box3]) && (board[box1] != 0)) //Checkes if three items are the same, and makes sure they're not 0's.
#define numberToLetter(x) ((x > 0) ? (x == 1) ? 'X' : 'O' : ' ') //Takes the number and turns it into the letter or space.