Git Product home page Git Product logo

bet-api's Introduction

Intro

Bet-api is a temporary project according to a task

Write a backend for the game:

  • The player sends the bet and an integer from 1 to 100 to the server.
  • The server generates a random integer from 1 to 100 and if the player's number is greater, calculates the winnings and sends a response to the client.
  • The winning depends on the chance - = bet * (99 / (100 - number)), for example, if a person chose the number 50 and the bet is 40.5, then the winning will be 80.19

Additional task:

Write a test that will play 1m rounds in parallel in 24 threads and calculate how much money is returned to the player (RTP) For example: on 1m of games the player spent 1m and won 990,000, RTP will be 99%.

Getting Started

Running app

Please consider the following steps:

  {
    "input": 50,
    "bet": 40.5
  }

Tests

The following steps will help you to run "returned to player" test:

  • Make sure that main app is running
  • Run tests command - you will see resulting values in a console like:
    Rounds: 10000
    Total input: 244982
    Total winning: 155384.43
    RTP: 63.43

or

    Rounds: 10000
    Total input: 496509
    Total winning: 2155671.02
    RTP: 434.17
  • Feel free to change core.api.rounds value in application.yml file.

bet-api's People

Contributors

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