I hereby claim:
- I am bunjin on github.
- I am vincent_eli (https://keybase.io/vincent_eli) on keybase.
- I have a public key ASAmWzyld13wa9c2LsD4J3ORk9y0BQmuydfe7KfbrBTb3Qo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
contract RNG { | |
bytes32 encrypted_seed; | |
bytes32 revealed_seed; | |
bytes32 revealed_secret; | |
uint odds; | |
uint bet_blocknumber; | |
uint bet_input; | |
bool bet_made; | |
uint bet_result; | |
string log; |
0x0c26a6dbf6b285145ca4f64397a521f8b5e49a79 |
Suppose you're writing a contract which involves a huge amount of participants. As an example, think of an online, blockchain-based Trading-Card Game with tournaments. How would you program a playCard
function? You might be thinking of something like this:
function playCard(uint player, uint card){
...
else if (card == PROFESSOR_OAK){
// shuffles the player's hand on his deck
shuffleHand(player)
pragma solidity ^0.4.4; | |
contract X{ | |
string junk; | |
function y() returns(string){ | |
//Uncomment the 'junk' below to make gas-measurements | |
//junk="0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345 |
var Web3 = require("web3"); | |
if(typeof web3 !== 'undefined') | |
web3 = new Web3(web3.currentProvider); | |
else | |
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); | |
var abiArray = [{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"proposals","outputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"},{"name":"description","type":"string"},{"name":"votingDeadline","type":"uint256"},{"name":"open","type":"bool"},{"name":"proposalPassed","type":"bool"},{"name":"proposalHash","type":"bytes32"},{"name":"proposalDeposit","type":"uint256"},{"name":"newCurator","type":"bool"},{"name":"yea","type":"uint256"},{"name":"nay","type":"uint256"},{"name":"creator","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"type":"function"},{"constant":true,"inputs":[],"name":"minTokensToCreate","outputs":[{"name":"","type":"u |
from random import randint | |
win_if_lte = 17 | |
payoff = 2.0 | |
block_reward = 5.0 | |
def bet_n_times(n, bet_size): | |
profit = 0 | |
for i in range(n): |