Skip to content

Instantly share code, notes, and snippets.

@hiromu
Created October 21, 2013 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiromu/7085032 to your computer and use it in GitHub Desktop.
Save hiromu/7085032 to your computer and use it in GitHub Desktop.
SECCON 2013 香川大会 14. ↑↑↓↓←→←→ (Programming 200)
#!/usr/bin/env python
s = 0
count = 0
step = [(0, -0.8), (0, -0.8), (0, 0.8), (0, 0.8), (-0.8, 0), (0.8, 0), (-0.8, 0), (0.8, 0)]
def accelX():
return step[count % 8][0]
def accelY():
return step[count % 8][1]
while True:
if s == 0:
print 'I'
s += 1
elif (s == 1 or s == 3) and accelX() > 0.7:
print 'M'
s += 1
elif (s == 1 or s == 3) and accelX() < -0.7:
print '?'
s += 1
elif s == 1 and accelY() < -0.7:
print ' '
s += 1
elif s == 3 and accelY() < -0.7:
print 'L'
s += 1
elif (s == 1 or s == 3) and accelY() > 0.7:
print '!'
s += 1
elif (s == 2 or s == 4) and accelY() > -0.7:
s += 1
elif (s == 5 or s == 7) and accelX() > 0.7:
print 'X'
s += 1
elif (s == 5 or s == 7) and accelX() < -0.7:
print 'Y'
s += 1
elif (s == 5 or s == 7) and accelY() < -0.7:
print 'Z'
s += 1
elif s == 5 and accelY() > 0.7:
print 'O'
s += 1
elif s == 7 and accelY() > 0.7:
print 'V'
s += 1
elif (s == 6 or s == 8) and accelY() < 0.7:
s += 1
elif (s == 9 or s == 13) and accelX() > 0.7:
print '!'
s += 1
elif s == 9 and accelX() < -0.7:
print 'E'
s += 1
elif s == 13 and accelX() < -0.7:
print 'C'
s += 1
elif (s == 9 or s == 13) and accelY() > 0.7:
print '\''
s += 1
elif (s == 9 or s == 13) and accelY() < -0.7:
print '?'
s += 1
elif (s == 10 or s == 14) and accelX() > -0.7:
s += 1
elif s == 11 and accelX() > 0.7:
print ' '
s += 1
elif s == 15 and accelX() > 0.7:
print 'T'
s += 1
elif (s == 11 or s == 15) and accelX() < -0.7:
print 'V'
s += 1
elif (s == 11 or s == 15) and accelY() > 0.7:
print 'W'
s += 1
elif (s == 11 or s == 15) and accelY() > 0.7:
print 'X'
s += 1
elif (s == 11 or s == 15) and accelY() < -0.7:
print '!'
s += 1
elif (s == 12 or s == 16) and accelX() < 0.7:
s += 1
elif s == 17:
print 'F'
s += 1
else:
count += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment