messy but working tictactoe