Giter Site home page Giter Site logo

valentinsoare / agameofchancewithstatistics Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 75 KB

A Game of Craps with statistics, played by one player at a time while the stats are being registered

Home Page: https://moviesondemand.io

Java 100.00%
craps java optimization recursion array arraylists collections-framework hashmap set

agameofchancewithstatistics's Introduction

๐Ÿ€ A Game of Chance - Craps

โ–ถ๏ธ Interactive Game of Craps made in Java 17 that can be run in CLI with main and secondary menu and can take input from user and act on it after it was validated. In case something is wrong an appropriate error will be printed.

โ–ถ๏ธ We can register, remove, select a player, print help, print statistics, print players
and play only one game of craps or play multiple games set by the player.

โ–ถ๏ธ Games that are played are register in history and stats are calculated from the counters saved into storage arrays.

final-Small.png

Concepts/technologies used:

  1. Object-Oriented Programming Principles;
  2. Collections Framework - ArraysList, LinkedList, HashMap and Set
  3. Recursion;
  4. Comparator and Iterator;
  5. Lambda functions, Streams and Method references;
  6. Third party libraries - Apache Commons Lang and Lombok;

Note

Project is ๐Ÿ’ฏ delivered!


Output from the game...

โœ… Here is the loading effect (progress bar) when starting the application.

             Loading The Game Of Craps 

     [################################### 89%     ]

โœ… Main menu after the loading bar completed and there is no registered player;

  -------------------------------
   # Playing The Game Of Craps # 
  -------------------------------

  [ 1 ] Games To Be Played 
  [ 2 ] Play One Game 
  [ 3 ] Print Statistics 
  [ 4 ] Register Player 
  [ 5 ] Change Player 
  [ 6 ] Reset Games Statistics 
  [ 7 ] Print Players 
  [ 8 ] Help 
  [ 9 ] Quit 

  player: None
  -------------------------------
  provide an option: 

โœ… Register a player;

  -------------------------------
   # Playing The Game Of Craps # 
  -------------------------------
           Add Player

  In order to add a player please provide complete name, age, occupation separated by a comma.

  player: None
  -------------------------------
  provide the necessary information to register a player or (quit/back): 

โœ… Set/Change a player after it is registered. You can have multiple registered players;

  -------------------------------
   # Playing The Game Of Craps # 
  -------------------------------
          Change Player

  [ 1 ] Valentin, Age: 35, Occupation: engineer
  [ 2 ] Back
  [ 3 ] Quit

  player: None
  -------------------------------
  please choose a player from above or back/quit option: 

โœ… Set the numbers of games to be played and the loading effect with dots when setting the parameter;

  -------------------------------
   * Playing The Game Of Craps * 
  -------------------------------
        Games To Be Played

  Please you need to tell us how many games you want to be played. Statistics will be calculated. 

  player: Valentin
  -------------------------------
  provide requested information or back/quit: 50

  50 games were selected to be played.......DONE

โœ… Printing statistics for those 50 games played;

-------------------------------
   * Playing The Game Of Craps * 
  -------------------------------
    Playing 50 Games Of Craps

  The Games Are Running..........DONE

  Number of Wins per roll and chances for them: 

  Rolls     Wins      Chances   
  |   1  |       8  |   16.0% 
  |   2  |       7  |   14.0% 
  |   3  |       2  |    4.0% 
  |   4  |       0  |    0.0% 
  |   5  |       1  |    2.0% 
  |   6  |       0  |    0.0% 
  |   7  |       1  |    2.0% 
  |   8  |       1  |    2.0% 
  |   9  |       1  |    2.0% 
  |  10  |       1  |    2.0% 
  |  11  |       1  |    2.0% 
  |  12  |       0  |    0.0% 
  |  13  |       0  |    0.0% 
  |  14  |       0  |    0.0% 
  |  15  |       1  |    2.0% 

  -------------------------------

  Number of Losses per roll and chances for them: 

  Rolls     Losses    Chances   
  |   1  |       5  |   10.0% 
  |   2  |       5  |   10.0% 
  |   3  |       4  |    8.0% 
  |   4  |       3  |    6.0% 
  |   5  |       1  |    2.0% 
  |   6  |       2  |    4.0% 
  |   7  |       2  |    4.0% 
  |   8  |       1  |    2.0% 
  |   9  |       1  |    2.0% 
  |  10  |       1  |    2.0% 
  |  11  |       1  |    2.0% 

  -------------------------------

      Games Played /      Wins /    Losses / Chances For Winning / For Loosing
  1.            50        24.0        26.0                  48.0          52.0

  -------------------------------

      Games Played / Average length
    1.          50              3.0

  -------------------------------

โœ… Choose what to do after stats are printed;

  -------------------------------
   * Playing The Game Of Craps * 
  -------------------------------
           What To Do ?

  [ 1 ] Play Again 
  [ 2 ] Return To How Many Games To Play 
  [ 3 ] Back To Main Menu 
  [ 4 ] Quit 

  player: Valentin
  -------------------------------
  please choose an option from above: 

๐Ÿ‘‰ You can check the rest of the functionalities if you clone this repo and try it.


โ–ถ๏ธ Class dependencies

class_dependencies


Statistics

HitCount

Social buttons

valentinsoare - AGameOfChanceWithStatistics stars - AGameOfChanceWithStatistics forks - AGameOfChanceWithStatistics

Repo metadata

GitHub tag License issues - AGameOfChanceWithStatistics

License

Released under MIT by @valentinsoare ๐Ÿ“ซ Contact me

agameofchancewithstatistics's People

Contributors

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