Giter Site home page Giter Site logo

tic-tac-toe's Introduction

Tic-Tac-Toe

Problem Statement

Let's look at the game of Tic Tac Toe. Tic Tac Toe is a two-player strategy game played on a 3*3 grid. There are 9 empty cells and 9 pieces - 5 pieces of 'X' and 4 pieces of 'O'

The game starts with an empty grid.

Rules of the game The game is played between two players. One player owns the X pieces and can put it on any of the empty cells in the grid. The other player owns the O pieces and can in any of the empty cells. The player with X makes the first turn. Each player plays alternately after that. The first player to form a horizontal/vertical/diagonal sequence wins. Requirements Create a command-line application for tic tac toe with the following requirements:

Ask the user for the names of the two players Print the grid after initializing Allow the user to make moves on behalf of both the players. The user will make a move by entering the cell position. You need to determine the piece (X/O) and make the move if it is valid. Valid move: The piece is controlled by the player having the current turn The cell is empty If the move is invalid print 'Invalid Move' the same player plays again If the move is valid: put the piece on the cell print the board after the move Determine if a player has won or if there are no valid moves left. Ignore all moves mentioned after that. A position in the cell is represented by two values: row number (1-3) and column number (1-3).

Detail problem statement can be read at: https://workat.tech/machine-coding/practice/design-tic-tac-toe-smyfi9x064ry

Solution

Javascript is used with all OOPs concent in design of the solution

Game Board

tic-tac-toe's People

Contributors

codeshaurya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.