Giter Club home page Giter Club logo

tic-tac-toe-game's Introduction

Contributors Forks Stargazers Issues


Logo

Tic-Tac-Toe Game

This project is part of the Microverse Ruby Section!
Report Bug · Request Feature

Table of Contents

About The Game

Tic-tac-toe (American English), noughts and crosses (British English), or Xs and Os is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row is the winner.

Game Rules:

  1. Two player game
  2. First player plays with the 'O' symbol
  3. Second player plays with the 'X' symbol
  4. Players take turns choosing a cell of the board to mark their symbol.
  5. A player can only choose an empty cell.
  6. The first player to complete a succession of 3 of their assigned symbol (O's or X's) in a row, column or diagonal wins!
  7. If all of the cells are filled with a symbol and no player matched 3 symbols, the game ends in a tie.

About The Project

In here you will find a Tic-Tac-Toe game.

The game has a basic interface that runs in the terminal.

The goals of this project are:

  • Practice with OOP (Object Oriented Programming) using Ruby as the language of choice.
  • Learn how to structure a Ruby project.
  • Correct use of logic and interface files to keep code maintainable.
  • Practice of Git Flow and Github Flow creating branches for the different features.

This is also part of the Odin project curriculum https://www.theodinproject.com/courses/ruby-programming/lessons/oop

Installation

You need to have Ruby installed in your computer to run this file: https://www.theodinproject.com/courses/web-development-101/lessons/installing-ruby

You can download the repo or clone (paste on the terminal) git clone [email protected]:majovainilla/tic-tac-toe-game.git

You will need to execute the main.rb file located inside the bin folder. If you are using Window, follow next step. If you are using Linux or Mac, you can follow the instructions to make the file executable.

Open the terminal and navigate to the folder containing the tic-tac-toe game. Once you are inside, your terminal should look like this: User/<folder>/tic-tac-toe/. You can type bin/main.rb to run the game.

Enjoy!! And follow the next instructions to play.

Instructions

Once you run the game, follow the prompts and instructions inside the terminal.

  1. The game is played inside the terminal.
  2. You play by typing the commands in the terminal.
  3. You will be prompted to type the Player 1 name and Player 2 name (press enter after each name)
  4. The first player will play with the 'O' symbol, and the second player with the 'X' symbol
  5. The game will prompt which player turn's it is.
  6. The board has three rows and three columns. a. Rows are named a,b,c from top to bottom. b. Columns are named 1,2,3 from left to right.
  7. The player in turn should type a valid cell name and enter it to mark the board.
  8. A valid cell name is comprised by a row (letter) and column (name): 'a1', 'b3'.
  9. After each turn, you will see the updated board with the selections of the players. Example of a game board after the first player types in "a1" in their turn:
       a [ ][O][ ] 
       b [ ][ ][ ]
       c [ ][ ][ ]
  10. A player can only mark an empty cell. If they choose an already marked cell they will be prompted again.
  11. The first player to match a succession of 3 of their assigned symbol (O's or X's) in a row, column or diagonal wins!
  12. If all of the cells are filled with a symbol and no player matched 3 symbols, the game ends in a tie.
  13. If you want to quit the game you can type "quit" instead of chosing a cell.
  14. After each game, you can choose to restart a new one. Type 'yes' or 'no' after the restart prompts. We will keep scores so play nice!!

Built With

This project was built using these technologies.

  • Ruby
  • VsCode
  • Rubocop and Stickler for linting

Testing

This project contains tests made with RSpec, testing the critical methods inside the game_logic file. The tests are contained within the spec folder in the game_logic_spec.rb file Before running the tests make sure to install RSpec You can run the tests by typing rspec in the terminal, inside the root directory.

Contact

María José Reyes - @majovainilla - [email protected]

Sarah Uryelah Silva - @uryelah - @uryelah - [email protected]

Project Link: [https://github.com/majovainilla/tic-tac-toe-game)

Acknowledgements

tic-tac-toe-game's People

Contributors

majovanilla avatar uryelah avatar

Stargazers

Kubilay Caglayan avatar

Watchers

James Cloos avatar  avatar

Forkers

phfdonda uryelah

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.