DEV Community

S B Rakesh Rath
S B Rakesh Rath

Posted on

Number Guessing Game (A fun Game)

Link to the game

I have created a Number guessing game. It is not some typical number guessing game where computer will generate a random number and you have to guess it.

In this game user has to guess the number which is average of all the guessed numbers.

Logic of the game

  • Initially there is a number x in the database.
  • User has to guess the number x, which should be in the range of 1-1000.
  • If the guessed number is correct then user wins the game.
  • If the guessed number is wrong then a new number y is generated which is Round((x + guessed number)/2).
  • If that number ever falls between 0-10 or 990-1000 then a new unique number is generated.
  • User can guess the number once in 5 seconds.
  • Only first 5 users to guess the number will be considered as winners.

Tech Stack

  • Frontend: ReactJS, Typescript, Vite and SASS (No Fancy frameworks)
  • Backend: NodeJS, ExpressJS, Fire Store (You may ask why fireStore, because it is free and I am a student 😅) (Literally I have used firestone for everything even for rate limiting the user requests 😂. And the score is a singe field in the database so I even used transaction in fireStore.)
  • Authentication: Firebase (I am too lazy to write another authentication service from scratch and waste my 2-3 days and still it will have bugs 😅)

Why authentication ?? If not then how will I know which is winner

  • Hosting: Firebase Hosting, GCP cloud run (For the backend which is just a magic of Google) and API gateway (I will explain it another post why I used it)

Links

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more