From 42aa0bbdf87e31309858d254d237a8568ef05810 Mon Sep 17 00:00:00 2001 From: datgous <98029776+datgous@users.noreply.github.com> Date: Mon, 14 Mar 2022 12:22:29 +0000 Subject: [PATCH] Remix link example Reduce friction, make editing/testing the sample code simpler. --- .../generating-randomness-in-your-smart-contracts.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/smart-contracts/witnet-randomness-oracle/generating-randomness-in-your-smart-contracts.md b/smart-contracts/witnet-randomness-oracle/generating-randomness-in-your-smart-contracts.md index 686c109..a4fd3e6 100644 --- a/smart-contracts/witnet-randomness-oracle/generating-randomness-in-your-smart-contracts.md +++ b/smart-contracts/witnet-randomness-oracle/generating-randomness-in-your-smart-contracts.md @@ -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" %}