Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remix link example #120

Open
wants to merge 1 commit into
base: gitbook
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ contract DieContract {
}
```

[Try this code online with Remix](https://remix.ethereum.org/?#activate=solidity,debugger&gist=5daa8730faff65ef55b91f1ecfca616b&call=fileManager//open//browser/gist-5daa8730faff65ef55b91f1ecfca616b/witnet-rng-die-example.sol)


As this example allows multiple users to play the dice game at the same time, a `mapping (address => Guess)` is used to separately track everyone's choice of numbers and the block in which they placed their guess. In this way, you can make sure that every roll of the die is only affecting guesses that were placed at least 1 block in advance, and that further rolls of the die will not affect the outcome of past guesses.

{% hint style="info" %}
Expand Down