Skip to content

thiagosf-dev/even-or-odd-solidity-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

EVEN or ODD Blockchain Game

A decentralized game on a smart contract.

Especifications

  • Ethereum Blockchain SinglePlayer Game developed in Solidity

  • ENVIRONMENT: Remix VM

  • IDE: Remix - Ethereum IDE

  • LICENSE: MIT

  • GAME MODE: Player vs CPU

Functional Requirements

  • The player must be able to choose between EVEN or ODD

  • The player must be able to choose numbers from 0 to 2

  • After successfully making a move, the player should be able to view information such as: "Winner", "Choice Made", "Number played by the player", "Number played by the CPU"

Non-Functional Requirements

  • Must use the minimum Solidity compilation version ^0.8.12

  • Should use Solidity's native concat function to manipulate strings

  • Should use the library @openzeppelin/contracts/utils/Strings.sol for string conversion

  • Should use the global 'block' variable to access block information

  • Should use abi.encodePacked for encoding

  • Should use Solidity's keccak256 hashing system

Business Rules

  • The game must start with no choice made

  • The player can only play a number if they have chosen EVEN or ODD beforehand

  • The player can only choose between EVEN or ODD, and the message "Choose EVEN or ODD" should be displayed if neither option is chosen

  • The player can only play numbers 0, 1, or 2, and the message "Play 0, 1, or 2" should be displayed if none of these options is chosen

  • The CPU's move should be generated with a random value, using the block.timestamp and the player's choice

How to test?

  1. Open the Remix IDE at the link: https://remix.ethereum.org/

  2. Create a new file inside the 'contracts/' folder with the name 'EvenOrOdd.sol'

  3. Copy the contents of the 'EvenOrOdd.sol' file from this project and paste it into the 'EvenOrOdd.sol' file you just created in Remix

  4. Compile using the 'Solidity Compiler' option

  5. Deploy using the 'Deploy & run transactions' option

  6. Expand the deploy options, make your move, and good luck!!!

Project for applying concepts covered in Luiz Tools' Web23 course."

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published