예제 #1
0
#/usr/bin/env python

from second_code import Bars
from third_code import decode_morse

def take_away_tea(s):
    return s.replace('T','')

str1 = "ITT TI I T TIii"
str2 = "T i  I Iii  TTT"
s = str2
for i in range(1000):
    bs = Bars(s)
    if bs.next() == str1:
        print("answer: " + ''.join([take_away_tea(decode_morse(take_away_tea(x))) for x in [s, str1, str2]]))
        break
    s = str(bs)
예제 #2
0
from second_code import Bars
from third_code  import decode_morse

bs = first = Bars("ITT TI I T TIii")

for i in range(50000):
    print str(bs)+"         answer: " + decode_morse(str(bs))
    bs.next()
    if str(bs) == "ITT TI I T TIii":
        break
예제 #3
0
파일: moon.py 프로젝트: funaken/cp1
#/usr/bin/env python

from second_code import Bars
from third_code import decode_morse

bs = Bars("I    IT ii  i I   I i   i   I  T")
for i in range(26):
    print(bs)
    bs.next()

print(bs)

print("answer: " + decode_morse(str(bs)))

from second_code import Bars
from third_code import decode_morse

val="ITT TI I T TIii"
bs = Bars(val)
i=0;
while(True):
    before=val
    val=str(bs.next())
    if (val == "ITT TI I T TIii"): break
print decode_morse(before)
#print("answer: " + decode_morse(str(bs)))
예제 #5
0
#!/usr/bin/env python

from second_code import Bars
from third_code import decode_morse

bs = Bars("ITT TI I T TIii")
while True:
    prev = bs[:]
    bs.next()
    if ''.join(bs) == "ITT TI I T TIii":
        break

print ''.join(prev)
print decode_morse(''.join(prev))
예제 #6
0
#!/usr/bin/env python
# -*- mode: python; coding: utf-8-unix -*- 

# http://cp1.nintendo.co.jp/inverse
from second_code import Bars
from third_code import decode_morse

src = "ITT TI I T TIii"
bs = Bars(src)
prev = None
for i in range(1000):
    prev = str(bs)
    bs.next()
    if str(bs) == src:
        break
    else:
        prev = None

if prev == None:
    print("Not found")
else:
    print(decode_morse(str(prev)))


예제 #7
0
#!/usr/bin/env python
# -*- mode: python; coding: utf-8-unix -*- 

# http://cp1.nintendo.co.jp/moon
from second_code import Bars
from third_code import decode_morse

bs = Bars("I    IT ii  i I   I i   i   I  T")
for i in range(26):
    print(bs)
    bs.next()

print(bs)

print("answer: " + decode_morse(str(bs)))

예제 #8
0
파일: inverse.py 프로젝트: funaken/cp1
#/usr/bin/env python

from second_code import Bars
from third_code import decode_morse

str1 = "ITT TI I T TIii"
str2 = "T i  I Iii  TTT"
s = str2
for i in range(1000):
    bs = Bars(s)
    if bs.next() == str1:
        print("answer: " + decode_morse(s))
        break
    s = str(bs)
예제 #9
0
# -*- coding: utf-8 -*-
#
# nintendo3.py
# created by giginet on 2012/09/15
#
from second_code import Bars
from third_code import decode_morse

PROBLEM = ['ITT TI I T TIii', 'T i  I Iii  TTT']

if __name__ == '__main__':
    print decode_morse('iiI Ii I i Ii')
예제 #10
0
#!/usr/bin/python -w

import itertools
from second_code import Bars
from third_code import decode_morse

r="""
***************
ITT TI I T TIii
T i  I Iii  TTT
"""

table = {' ':[' ','T'],'i':['T',' '],'T':['i','I'],'I':['I','i']}
s = 'ITT TI I T TIii'

def inverse():
    pat = []
    for c in list(s):
        pat.append(table[c])

    for p in itertools.product(*pat):
        line = ''.join(p)
        bs = Bars(line)
        n = str(bs.next())
        if s == n:
            return line

print("answer: " + decode_morse(inverse()))