コード例 #1
0
ファイル: inverse_another.py プロジェクト: funaken/cp1
#/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)))

コード例 #4
0
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
ファイル: solver.py プロジェクト: iwagaki/nintendo_codepuzzle
#!/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
ファイル: codepuzzle04.py プロジェクト: ser1zw/CodePuzzle
#!/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
ファイル: codepuzzle03.py プロジェクト: ser1zw/CodePuzzle
#!/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
ファイル: nintendo3.py プロジェクト: giginet/CodePuzzle.py
# -*- 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
ファイル: forth.py プロジェクト: horiuchi/code_puzzle
#!/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()))