Giter Site home page Giter Site logo

connect-four's People

Contributors

bpyser avatar edkim avatar jmoss20 avatar kylehill avatar mcwhittemore avatar necaris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

connect-four's Issues

Board Validator Test

We would like to know if a game state is valid. A valid game state means that given a 2D array representing game pieces, those pieces could have actually been created by two players following the rules of the game (alternating turns dropping pieces).

Functional Requirements:

  • Create a new POST route /validate
  • The route should accept a 2D array of game pieces just as they the /save API end point does.
  • If the game board is valid, the server should respond 200 OK with message "Board is valid!"
  • If the game board is NOT valid, the server should respond 200 OK with the message "This board is messed up!"

For this issue, a board should be considered valid if:

  1. Each game piece has other game pieces below it (no floating pieces)
  2. Counting each game piece shows that Player 1 has N or N+1 game pieces on the board, where N is the number of game pieces Player 2 has on the board.

Example of a valid game board:

[[null, null, null, null, null, 1 ],
[null, null, null, null, 1, 2 ],
[null, null, null, null, null, 2 ],
[null, null, null, null, 1, 2 ],
[null, null, null, 2, 1, 1 ],
[null, null, null, null, null, null ],
[null, null, null, null, 1, 2 ]]

connect_four

Examples of invalid game board:

[[null,null,null,null,null,1],
[null,null,null,null,null,2],
[null,null,null,2,1,1],
[null,null,2,2,1,2],
[null,null,null,null,null,2],
[null,null,null,null,null,null],
[null,null,null,null,null,null]]

connect_four

Add feature to show winning move

The feature consists of a button called "Help me win". When this button is clicked, one of two things should happen:

  1. If there is a winning move for the current player, the cell(s) containing the winning move should "glow" faintly.
  2. If there is no winning move, a message should appear that says "There are no winning moves!"

Make a basic computer opponent

Requirements

User Interface:

  • Upon starting a new Game, user should be prompted for Single Player or Two Player Game
  • If Single Player Game, ask user if they want 1st Move or 2nd Move

Computer AI:

  • Computer opponent will always make a valid move
  • Computer opponent's move can be totally random so long as it's valid, but will always make a winning move if there is one available
  • Bonus Points if your computer AI can beat 2 out of 3 five year olds

Add persistence and turn history

We need to add a database to store each game and its current state so that it can be loaded again.

In addition, we want to be able to keep track of every turn that has happened. There needs to be a "Turn History" (list) in the user interface that describes what happened during that turn. Clicking on a previous Turn in the History List will ask the user if they want revert back to that turn's board state.

The actual database provider can be anything you like (SQL-based, NoSQL).

This exercise is intentionally open-ended to allow the code contributor freedom to implement a sensible solution. That being said, if you have any clarifying questions, you can contact [email protected]

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.