Git Product home page Git Product logo

flakster / tic-tac-toe Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 50 KB

This is the development in Ruby language of the classical game (aka noughts and crosses) in which two players take turns to place their marks ( 0 or X ) in the available positions of a 3 x 3 board. The first player who achieves to place three of their marks in a horizontal, vertical, or diagonal row is the winner.

License: Creative Commons Zero v1.0 Universal

Ruby 100.00%

tic-tac-toe's Introduction

Tic-Tac-Toe

This is the development in Ruby language of the classical game (aka noughts and crosses) in which two players take turns to place their marks ( 0 or X ) in the available positions of a 3 x 3 board. The first player who achieves to place three of their marks in a horizontal, vertical, or diagonal line is the winner.

Tictactoesample

Live demo

Play it online here

Built with

  • Ruby
  • RSpec
  • VSCode

Getting started

To get a local copy of this repository up and running, follow these steps:

  • Click the "Clone or download" button
  • Copy the URL of the repository.
  • Go to the terminal on your local machine and type: git clone
  • Paste the URL you copied before.
  • Change your local directory by typing cd Tic-Tac-Toe
  • Type ruby bin/main.rb and press [Enter]

Prerequisites

You must have Ruby installed on your computer

Game Instructions

This is a two-player game in which every participant has a mark, either X or 0. The final goal is to place three his/her marks on a 3 x 3 board in a vertical, horizontal, or diagonal line.

After typing the player's names, the first turn will be for the player with the X's and then, the game will prompt alternating between the two players asking for the position in the board in which the player wants to place his/her mark.

Each player can choose only one position on the board per movement, so he/she must pick the more convenient position in order to achieve the goal to position three of his/her marks in line.

Sometimes, the player must use his/her turn for placing a mark that blocks the opponent's path to win. In such a case, the board is likely to be full without any of the participants winning. If that situation arises, the game will end in a draw.

Running the tests

For running the automated tests type rspec spec/tictactoe_spec.rb in the root directory of the project

Author

πŸ‘€ Carlos SantamarΓ­a

🀝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a 🌟 if you like this project!

πŸ“ License

This work is released under the CC0 license

tic-tac-toe's People

Contributors

flakster avatar

Stargazers

Seth Zea avatar Marios Kanellopoulos avatar

Watchers

James Cloos avatar  avatar

Forkers

d-e-f-e-a-t

tic-tac-toe's Issues

March 3, 2020 | Code-Review : The Poodles

Great start of the project, Carlos. The game is looking good, clean and sleek.

I have a quick suggestion: why don't you try to keep players' scores at the end of the game? That way the players don't have to keep typing their names when the game.

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.