Git Product home page Git Product logo

f1e94243-5c38-40b3-867b-e72448c01945's Introduction

Dice Game

This is a 2 Player dice game.

Tags

react, useState, conditional rendering.

Description

Getting Started

  1. Fork this repository.
  2. Clone the forked app from your github account.
  3. navigate inside the clone repository folder and run following command.
    • npm install - To install the dependencies
    • npm start - To Start running the application.

Create a Dice Game, with following functionalities.

Rules of Game

  1. This a 2 player game.
  2. There will be two dices, each with one player.
  3. Players will roll the dice at their respective turns.
  4. A random number will be genrated between 1 and 6 when a player rolls a dice (use Math.random()).
  5. Whatever random number that has been genrated by the dice will get added to that player's score.
  6. Each player can roll a dice maximum of 5 times.
  7. At the end the player with the highest score will win. โ€Œ

Tasks / Functionalities to Implement

Initially the app will look like the following screenshot:

Screenshot 2022-07-01 at 12 46 43 AM

  1. The App will have a Turn Banner, displaying whose turn is it, Player 1 or Player 2?

    • The initial text there will be Player 1, It is your turn!!.
    • This shows that player 1 will roll the dice first.
    • Player 2: Roll Dice, button will be disabled here.
  2. Player 1 score should increse by whatever value dice is throwing.

  3. Once the Player 1 has rolled the dice the banner should display Player 2, It is your turn!!

    • At this point the Player 1: Roll Dice, button will be diabled.
  4. The Player 2 score should increse by whatever value dice is throwing.

  5. This can only be done five times, so you can take a counter 1 and counter 2 which will track how many turns the respective players have already played.

  6. Once the counter 1 and counter 2 reaches 5, it should display the winner and both the buttons namely Player 1: Roll Dice & Player 2: Roll Dice will be desabled as per the screenshot.

  7. Once, the winner has been declared the turn banner will show Game Over!! as the text in it.

Screenshot 2022-07-01 at 12 47 04 AM

Note

  • Make sure you use only the given components and dont create new Components, files, folders of your own. Changing component name, file/folder structures might result in giving you zero marks
  • Do Not Remove data-testid="xxxx" from anywhere, these are used by testing tools to test your code, removal of this will lead to low score.
  • Also make sure to cross check all the spellings and Case of Texts, as per the following screenshot as the test cases are written accordingly and it could lead in less marks.
  • You can focus on your own style, but first priority is implementing all the functionalities.

Learning Objectives

  1. Why and what is react?

  2. Able to use CRA and run the application.

  3. Basic understanding of JSX.

  4. Difference between State and props.

  5. Conditional rendering.

  6. Props Passing.

  7. Handling basic onClick events.

f1e94243-5c38-40b3-867b-e72448c01945's People

Contributors

bishal-samanta avatar masai-ops 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.