The Basics of Coin Toss

There is little code snippet that's so simple yet holds so much potential.

<!-- JavaScript -->

let result; 

let randomNumber = Math.floor(Math.random() * 2);

if (randomNumber == 0) {
  result = "Heads"
}else{
  result = "Tails"
} 

The MVP

The app that I made was not what I set out to make. I set out to make a global leaderboard of the luckiest people in the current week. That would be decided by the current score of coinflips. At some point I realized that if I settle for nothing less, then it would take a heck of a lot more time. So I scaled back. The minimum viable product in this case was a bare bones coin tossing app that keeps track of the owners record and has an animated toss.

The MVP used only one of the screens: Figma boards

Tools I used

The Progression

  1. Write flipping and win/lose logic in plain Javascript
  2. UI design
  3. Set up an Expo project
  4. Write the logic in React Native
  5. Make the flip animation
  6. Implement animation with Lottie
  7. Implement adds with AdMob
  8. Publish @ Expo
  9. Publish @ Play Store

The Take Away

I'm incredibly happy for having something I made up and live. This was my first project with a multitude of frameworks. Incredible feeling. But that's not it for this little project. Next up, let's find out who's the luckiest person in the world:)

Until then - download for Android devices

If you're walking down the right path and you're willing to keep walking, eventually you'll make progress. Barack Obama

Coin toss