BLACKJACK GAME IN REACH
Published: 2022-09-09 20:22:27

---
title: BLACKJACK GAME IN REACH
published: true
description: Decentralized Umoja Bounty Hack
tags: 
# cover_image: Nil
# Use a ratio of 100:42 for best results.
---

### Meet the Team


The [Bounty Hack Decentralized Umoja #3](https://www.reach.sh/decentralized-umoja-3-bountyhack) was introduced to [Me](https://www.github.com/CFCIfe) by a colleague after the previous [bounty hack](http://events.reach.sh/decentralized-umoja), and I decided to take on the challenge with two of my friends, [Saheed](https://github.com/Cryptoseed) and [Samson](https://github.com/Ayodeji63). For our project, we decided to build a decentralized app that ran on [Algorand](https://www.algorand.com) and was written using [Reach Programming Language](docs.reach.sh).

---

### Overview of the Project


The project we selected was to build a **blackjack game with asynchronous payout**. 

You can watch the demo of our [project here](https://www.youtube.com/watch?v=bOKqXzNobSI). Also, we have the code hosted on this [Github Repository](https://github.com/CFCIfe/BlackJack-Dapp).

{% embed https://github.com/CFCIfe/BlackJack-Dapp %}.
{% embed https://www.youtube.com/watch?v=bOKqXzNobSI %}

---

#### **Did you complete your project on time?**

We completed our project a few days before the deadline of [**28th August**](https://events.reach.sh/decentralized-umoja-3#:~:text=by%20midnight%2C%20on%20Sunday%2C%20August%2C%2028th). The organizers were quite strict with the deadline day as they laid out a well thought out timetable for everyone. We completed the demo video as well when we confirmed from our [Mentor](https://github.com/paulogwulumba) that the project meets [the requirements](https://events.reach.sh/decentralized-umoja-3#:~:text=Hack%20Completion%20Requirements-,Completion%20Requirements,-The%20submission%20of)
   
   

#### **Describe the primary features/functions of your app.**

Blackjack game is played between 2 people. The Players are dealt two cards at the beginning of the game, and the winner is the player whose card total is closest to 21.

Our program has three main features and is straightforward, lacking any complex feature:

1. Players will start the game with 2 randomly produced cards.

2. To avoid any kind of compromise, the cards chosen by the **DEPLOYER** will first be committed to the contract and kept secret from the attacher.

3. The contract will manage the calculation and payment of cash to the winner and in the event of a tie, the funds are split evenly.
   
   


#### **What was going through your head at the start of the hack?**

One night, Saheed, Samson, and I were talking about how we were worried we wouldn't finish the [Rock, Paper, Scissors instructional](https://docs.reach.sh/tut/rps/#tut) on time. We weren't sure whether we would have adequate support and if we would be able to incorporate all the essential features needed. We all had no prior knowledge of web3 programming, how contracts operate, or what a blockchain was, but we nonetheless accepted the task of developing a decentralized application.
   
   


#### **What did you do to dive into your project (e.g. review documentation, create diagrams, etc.).**

The front-end coding was where we started (our strongpoint). Our app's features, functionalities, and behavior were first written down, and then we diagrammatically planned out how we would make them happen.

To make sure our app complies with the requirements, we looked through the documentation (which was quite useful), examined the tutorials (mainly the Rock Paper Scissors), and went over the vital aspects of how **DAPPs** work.

After creating the front end, the following questions were posed:

1. What does the backend expect?
2. What functions are supposed to be modeled?

Creating the UI initially provided us a strong start.
   
   


#### **The first time you asked the community for help, what were you struggling with?**

Salutations to the REACH community first. Without the assistance from the Discord #help channel, Team 8 would not have been.

When we were having trouble with while loops, Peter asked for help for the first time, and we received prompt response along with links to more resources. We made sure to use the #Help channel and got a speedy response. :car: . The mentors, especially [Nick](https://github.com/nstanford5), were fantastic at responding quickly.
   
   


#### **What were the most challenging obstacles to overcome (and how did you overcome them)?**

Making the frontend and backend interact was the most difficult challenge we faced. After a player agrees to the contract's terms, we wanted the board to be visible but could not get it to work.

It seemed hard to implement, but with the help of Nick, our mentor, and the knowledge that the frontend reflects the backend, we were able to do so. Everything changed after Nick's explanation, and we began to view the frontend as a mirror image of the backend.
   
   


#### **What surprised you about building in Reach? Was anything faster/easier than you were expecting?**

Before the hack began, we did a little blockchain research. When we looked at creating with JavaScript and Solidity, it appeared really complicated.

We believed that 6 weeks might be too short to study and finish a project because of this. Compared to what we anticipated, writing in **REACH** was a lot faster, simpler, and less complicated. REACH already handles the steps involved in creating a smart contract in solidity and a frontend and backend in javascript.

This allows us to write less lines of code, which speeds up the process of building a program in REACH by generating a smart contract for us. Additionally, using the REACH technique of compiling has had to be the nicest thing you've ever done; you have to give it a try to realize how good it feels when your theorems pass after running `reach compile`.
   
   


#### **If given the chance to enhance/expand upon the features/functions of your app, what would you add?**

The features we would most like to include if we upgraded our blackjack app are:

1. Increasing the number of rounds to increase play and enjoyment.
2. The game would allow for the participation of more than two players.
3. Implement a flexible user interface, so both the Attacher and the Deployer might play at the same time.
   
   


#### Any closing thoughts on your project, the Bounty Hack, or building in Reach?

Although we would like to include more features and functionality, the project functions as planned.

No matter their experience or ability level, the bounty hack offers any developer an excellent opportunity and a relatively simple method to join the web 3 community. The lovely Discord community and the always-available REACH team are there to support you.

As we discovered, integrating REACH into DAPP development is the way of the future. We have a wonderful team, all the tools we require, and thorough documentation.

To do a lot with little lines of code is crucial in development. Debugging is facilitated, and developers' lives are made easier. REACH provides that to all developers.