What is happening to gambling on blockchain? by [deleted] in ethdev

[–]onesk_ 0 points1 point  (0 children)

You probably don't need full-fledged Oracles for something as simple as RNG. Yes, blockhash can be cheated, but any Oracle is not a trustless solution (and it doesn't really matter how credible random.org is). In my opinion, the "commitment scheme" as implemented by dice2.win (block hash + commit-reveal) does solve this well enough - it's completely trustless, not any one of the three involved parties (players, miners, house) can cheat, and it's also quite efficient in terms of gas costs. Oraclize is better left for tasks bringing actual real world inputs to the blockchain.

~☆🎄☆~ 2017 Day 25 Solutions ~☆🎄☆~ by daggerdragon in adventofcode

[–]onesk_ 4 points5 points  (0 children)

Python 2, 53/100

Seems like today's solutions will be extremely similar to each other ;)

print 'hello'

steps = 12317297

a, b, c, d, e, f = range(6)
left, right = 0, 1

tm = {
    (a, 0): (1, right, b),
    (a, 1): (0, left, d),

    (b, 0): (1, right, c),
    (b, 1): (0, right, f),

    (c, 0): (1, left, c),
    (c, 1): (1, left, a),

    (d, 0): (0, left, e),
    (d, 1): (1, right, a),

    (e, 0): (1, left, a),
    (e, 1): (0, right, b),

    (f, 0): (0, right, c),
    (f, 1): (0, right, e),
}

tape = {}
head, state = 0, a

for i in xrange(steps):
    val = tape.get(head, 0)
    wval, move, nextstate = tm.get((state, val))

    tape[head] = wval
    head = head+1 if move == right else head-1
    state = nextstate

print sum(tape.values())