Skip to content

Instantly share code, notes, and snippets.

@HalCanary
Created June 8, 2019 23:47
Show Gist options
  • Save HalCanary/a55f6b11e4a12dd69fa83c0aad867d0b to your computer and use it in GitHub Desktop.
Save HalCanary/a55f6b11e4a12dd69fa83c0aad867d0b to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
# Chutes & Ladders Player
import random, sys
N = 3
w = {
1:38, 4:14, 9:31, 16:7, 21:42,
28:84, 36:44, 47:26, 49:11, 51:67,
56:53, 62:18, 64:60, 71:91, 80:100,
87:24, 92:73, 85:75, 98:78
}
p = [0 for _ in range(N)]
o = sys.stdout
while all(s < 100 for s in p):
for i in range(len(p)):
x = p[i] + random.randint(1, 6)
p[i] = w.get(x, x)
o.write('%3d ' % p[i])
o.write('\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment