Giter Site home page Giter Site logo

tictactoeboard's Introduction

Getting Started

Build the Unit Testing CPP ("gtest") container if you have not already:

docker build -t gtest .

Then run the container, with bound access to your repository:

docker run --mount type=bind,source="$(pwd)",target=/usr/src -it gtest

This should automatically re-build the project and run the tests

TicTacToeBoard

Associated Enumerated Types

Piece has four possible values: X,O,Invalid, and Blank

Member Variables

Piece board[BOARDSIZE][BOARDSIZE]

board represents the 2D playing board, where BOARDSIZE is 3,


Piece turn

turn represents whose turn it is to place a piece (defaults to X)

Public Functions

TicTacToeBoard()

Constructor sets an empty board and specifies it is X's turn first


Piece toggleTurn()

Switches turn member variable to represent whether it's X's or O's turn and returns whose turn it is


Piece placePiece(int row, int column)

Places the piece of the current turn on the board, returns what piece is placed, and toggles which Piece's turn it is. placePiece does NOT allow to place a piece in a location where there is already a piece. In that case, placePiece just returns what is already at that location. Out of bounds coordinates return the Piece Invalid value. When the game is over, no more pieces can be placed so attempting to place a piece should neither change the board nor change whose turn it is.


Piece getPiece(int row, int column)

Returns what piece is at the provided coordinates, or Blank if there are no pieces there, or Invalid if the coordinates are out of bounds


Piece getWinner()

Returns which Piece has won, if there is a winner, Invalid if the game is not over, or Blank if the board is filled and no one has won.

tictactoeboard's People

Contributors

kbuffardi avatar mscheer75 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.