9.1 Example of Betting Game

We’ll introduce to the development process with an example of a dice program with specific source code: cocos-dice-sample。This includes contract development, deployment, debugging, and front-end contract call.

We hope the community have a complete understanding of DApp development based on Cocos-BCX.

Game Rules

The game rules of Dice are very simple, with the following specific steps:

  1. Set the bet amount
  2. Adjust the slider to bet on the upper limit of the dice number and change the chance of winning
  3. Click “Roll” to place a bet. If the result is less than your bet number, you will be awarded immediately. The program will make the settlement based on the winning rate.

Development Environment

MacPro10.14.2 (18C54)
VSCode1.32.3 (1.32.3)
JS SDK1.3.2.2

Updated 5 months ago

9.1 Example of Betting Game

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.