Giter Club home page Giter Club logo

rps-api's Introduction

Rock, paper & scissors

This is the API (definition) of a 'rock, paper & scissors' game.

About

This API was defined using Postman and the OpenAPI 3.0 specification.

However, in order to follow an API-first approach, any method chosen to design the API is valid, as long as the result is specification-compatible.

How it works

First, the user will select one of the three available moves (ROCK, PAPER or SCISSORS) and lock its move for the current play.

At this point there cannot be another active play, and any attempts to restart the game will be revoked.

Once the move is selected, the play can be revealed simultaneously for both players and the winner is decided.

Endpoints

Play a move

This action will lock the player's move to start a new play. If there is already an ongoing play or the selected move is not a valid one, the action will be revoked.

POST /play/<move>

No body

Headers:

X-USER-ID: UUID v4 of the user playing

Resolve active play

This action will resolve the current play (if there is one), and will determine if either the player or the machine won (or if it's a tie), based on the move previously selected by the player and a random move assigned to the machine.

GET /play/reveal

Headers:

X-USER-ID: UUID v4 of the user playing

rps-api's People

Contributors

jobosk avatar

Watchers

 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.