Code Monkey home page Code Monkey logo

tic_tac_toe's Introduction

Tic Tac Toe

The rules of tic-tac-toe are as follows:

  • There are two players in the game (X and O)
  • Players take turns until the game is over
  • A player can claim a field if it is not already taken
  • A turn ends when a player claims a field
  • A player wins if they claim all the fields in a row, column or diagonal
  • A game is over if a player wins
  • A game is over when all fields are taken

The brief:

Build the business logic for a game of tic tac toe. It should be easy to implement a working game of tic tac toe by combining your code with any user interface, whether web or command line.

To run the program/tests:

  1. Install gems using 'bundle install'
  2. Use 'rspec' to run tests with SimpleCov checking the coverage - coverage should be higher than 95%
  3. If all tests pass, run 'rubocop' to check the readability of code

How code is structured

  • Code is structured in three classes
  • Game class controls the players turns and where they place their pieces on the board
  • Calculation class checks the array to see if the latest move resulted in a win
  • Results class send the result of a winning turn back to Game to announce the winner

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.