Coder Social home page Coder Social logo

catching-21's Introduction

Catching 21

Catching 21 is a simplified card game, inspired by Blackjack, where the goal is to have a hand with a value as close to 21 as possible without exceeding it. The game is implemented as a Reach application and operates as a match, with the first player to win 3 hands claiming victory. Upon the match's conclusion, the contract balance is distributed accordingly.

Rules

The player takes their turn first, deciding whether to "hit" and receive another card, or "stay" and lock in their current total. Once the player stays, the dealer takes over, playing automatically. The dealer continues to draw cards until their total surpasses the player's or exceeds 21. To account for their "house" advantage, the dealer contributes an extra 5 ALGO fee.

How to Play

A player chooses their wager amount and submits it to the Dealer. The Dealer accepts the wager and contributes an extra 5 ALGO fee. Both the Player and Dealer are dealt two cards each, one of the Dealer's card is face down (hidden). The Player can choose to "hit" (draw a new card) or "stay" (lock in their total). If the player has an Ace, they can choose the value of Ace to be 1 or 11. Once the Player decides to "stay", the Dealer takes their turn. The Dealer's hidden card is revealed and they continue to draw cards until their total surpasses the Player's or exceeds 21. The winner of the hand is determined and the tally is updated. The game continues until one of the participants wins 3 hands. The winner receives the contract balance, including the wagers and the extra dealer fee.

Files

index.rsh - The backend containing the main Reach program implementing the game logic.

index.js - The front end containing React components.

Requirements

Reach - Install the Reach compiler to run the application.

Docker - Install Docker to containerize the application

Running the Game

Install Reach by following the instructions on reach.sh.

Run the following commands:

$ reach init

$ ./reach react

The game will then start, and you can interact with it through the terminal.

Authors

Jose Jaramillo

Marco Rojas

Please feel free to reach out with any questions or suggestions.

Reach-Catching-21

catching-21's People

Contributors

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