Giter Site home page Giter Site logo

rockpaperscissors's Introduction

Rock Paper Scissors game

This is an implementation of the Rock Paper Scissors game: Description I used the algorithm, based on parity: "Rankings in rock paper scissors Spock lizard may be modeled by a comparison of the parity of the two choices. If it is the same (two odd-numbered moves or two even-numbered ones) then the lower number wins, while if they are different (one odd and one even) the higher wins."

Due to the library restrictions some boilerplate had to be implemented(/rockpaperscissors.lib). That IO could be replace by any modern effect system like Cats IO, Monix Task or ZIO. A Monad instance could be used for replacing Program and State monad for replacing TestIO.

To run the program

sbt run

To run the tests

sbt test

To extend the game

  1. Declare a move N+1 (where N is the original total of moves) that beats all existing odd-numbered moves and loses to the others (for example, the rock (#1), scissors (#3), and lizard (#5) could fall into the German well (#6), while the paper (#2) covers it and Spock (#4) manipulates it).
  2. Declare another move N+2 with the reverse property (such as a plant (#7) that grows through the paper (#2), poisons Spock (#4), and grows through the well (#6), while being damaged by the rock (#1), scissors (#3), and lizard (#5)).

The new weapons must be added in rockpaperscissors.model.Weapon and the numberOfWeapons value should be increased by the number of the added weapons.

To display the new available weapons to the human player, the rockpaperscissors.service.HumanPlayer::selectWeapon method should be extended.

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.