Skip to content

Instantly share code, notes, and snippets.

@galli-leo
Created December 30, 2019 15:15
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 galli-leo/51acf1d0e35e056c502e2cef84d9e61a to your computer and use it in GitHub Desktop.
Save galli-leo/51acf1d0e35e056c502e2cef84d9e61a to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import socket
import curses
import time
import sys
import random
import os
sys.path.append(os.getcwd())
import implementation
import json
import testing
import traceback
if len(sys.argv) != 3:
print("Usage: python3 client.py <HOST> <PORT>")
exit()
HOST = sys.argv[1]
PORT = int(sys.argv[2])
def receive_until_prompt(sock, prompt=b"\n"):
received = b""
buf_size = len(prompt)
while True:
new = sock.recv(buf_size)
received += new
for i in range(1, len(prompt) + 1):
if received.endswith(prompt[-i:]):
if i == len(prompt):
return received
else:
buf_size = len(prompt) - i + 1
if not new:
raise Exception(f"Connection closed before {prompt} was found.")
def recv(sock):
data = receive_until_prompt(sock)
data = data.strip()
data = data.split(b"\x00")
return data
def send(sock, data):
sock.sendall(f"{data}\n".encode())
NOTHING = "0"
PIT = "1"
FLAG_CHAR = "2"
BREEZE = "3"
SMELL = "4"
actual_flag = "A"*42
map_data = {(0, 0) : NOTHING}
with open("explored_map.json") as f:
mod_map = json.load(f)
for key, val in mod_map.items():
no_b = key[1:-1]
x, y = no_b.split(", ")
x = int(x)
y = int(y)
map_data[(x, y)] = val
testing.write_map(map_data)
flag_chars = []
bounds = (49, 49)
current_pos = (0, 0)
def add_pos(pos, move):
return (pos[0] + move[0], pos[1] + move[1])
def next_pos(move):
global current_pos
return add_pos(current_pos, move)
def add_to_pos(pos, value):
global map_data
map_data[pos] = value#.add(value)
def parse_data(data, n_pos):
global flag_chars, actual_flag
if data[0] == b"iw":
# invalid move
print(f"found potential bounds: {n_pos}")
return False, False
elif data[0] == b"d":
# dead
print(f"found pit: {n_pos}")
if map_pos(n_pos) == NOTHING:
print(f"*"*20)
print(f"Found pit at {n_pos}, but we previously recorded nothing there! Something bad happened for sure!")
print("*"*20)
add_to_pos(n_pos, PIT)
correct_square_grid()
return False, False
elif data[0] == b"f":
# flag char
remote_char = data[1].decode("utf8")
print(f"found flag char: {remote_char}")
local_char = testing.flag_char_for_pos(n_pos)
if local_char is None:
print("*"*80)
print(f"Local char is none for pos: {n_pos}, maybe we made a mistake?")
print("*"*80)
return False, False
else:
idx = testing.flag_char_to_index(local_char)
print(f"According to local game, position of {remote_char} is {idx}")
update_flag(remote_char, idx)
print(f"Currently recovered flag: {actual_flag}")
flag_chars.append(remote_char)
#add_to_pos(n_pos, FLAG_CHAR)
#add_to_pos(n_pos, data[1].decode("utf-8"))
add_to_pos(n_pos, NOTHING)
return True, True
#return False
elif data[0] == b"i":
# if b"breeze" in data:
# add_to_pos(n_pos, BREEZE)
# if b"smell" in data:
# add_to_pos(n_pos, SMELL)
#if len(data) < 2:
add_to_pos(n_pos, NOTHING)
elif data[0] == b"e":
print("Had an error: ", data)
return False, False
return True, False
MOVE_LIST = {
(1, 0) : "d",
(-1, 0) : "a",
(0, 1) : "s",
(0, -1) : "w"
}
def update_flag(char, pos):
global actual_flag
actual_flag = actual_flag[:pos] + char + actual_flag[pos+1:]
def one_iter(s, move):
mv_char = MOVE_LIST[move]
send(s, mv_char)
again = True
while again:
data = recv(s)
alive, again = parse_data(data, next_pos(move))
if not alive:
return False
return True
def game_loop(next_move):
global current_pos, next_explore, did_visit_flag, outside_recs, flag_pos, flag_chars, map_data
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
current_pos = (0, 0)
outside_recs = 0
next_explore = find_next_unexplored()
did_visit_flag = False
cnt = 0
testing.initialize_map(map_data)
try:
alive = True
data = recv(s)
print(f"Initial Data: {data}")
while alive:
move = next_move()
alive = one_iter(s, move)
if alive:
current_pos = next_pos(move)
testing.tick_game(current_pos)
else:
if flag_pos == current_pos or flag_pos == next_pos(move):
print(f"This char seems good!: {flag_chars[-1]}")
print(f"Died after {cnt} {cnt // 2}")
except KeyboardInterrupt as e:
raise
except Exception as e:
print(e)
traceback_str = ''.join(traceback.format_tb(e.__traceback__))
print(traceback_str)
except:
print("Had an error")
def map_pos(pos):
global map_data
if pos in map_data:
return map_data[pos]
return ""
def find_bounds():
global current_pos
right = (0, 1)
down = (1, 0)
n_pos = next_pos(down)
nn_pos = add_pos(n_pos, right)
if PIT in map_pos(nn_pos):
nnn_pos = add_pos(next_pos(right), right)
if PIT in map_pos(nnn_pos):
print(current_pos)
return (0, -1)
return right
if PIT in map_pos(n_pos):
return right
return down
def is_in_bounds(pos):
global bounds
x, y = pos
return x >= 0 and y >= 0 and x < bounds[0] and y < bounds[1]
def explore():
global current_pos, map_data, outside_recs
outside_recs += 1
if outside_recs > 10:
return (0, 0)
options = [(0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (1, 0), (-1, 0), (0, -1), (0, -1), (0, -1), (0, -1), (0, -1), (0, -1), (0, -1)]
random.shuffle(options)
possibilities = []
for move in options:
n_pos = next_pos(move)
if is_in_bounds(n_pos) and PIT not in map_pos(n_pos):
possibilities.append((n_pos, move))
# first find anything with a smell
for poss in possibilities:
n_pos, move = poss
if SMELL in map_pos(n_pos):
return move
# next find anything with nothing
for poss in possibilities:
n_pos, move = poss
if NOTHING in map_pos(n_pos):
return move
if len(possibilities) > 0:
return possibilities[0][0]
return options[0]
def find_next_unexplored():
global map_data
for y in range(50):
for x in range(50):
if (x, y) not in map_data:
return (x, y)
return None
next_explore = (0, 1)
square_grid = implementation.GridWithWeights(50, 50)
def correct_square_grid():
global square_grid, map_data
walls = []
for y in range(50):
for x in range(50):
pos = (x,y)
if pos in map_data:
if map_data[pos] == PIT:
walls.append(pos)
square_grid.walls = walls
#implementation.draw_grid(square_grid)
correct_square_grid()
def make_path(pos):
global map_data, current_pos, square_grid
path, _ = implementation.a_star_search(square_grid, current_pos, pos)
real_path = []
current = pos
if current not in path:
return None
while current != current_pos:
real_path.append(current)
current = path[current]
real_path.reverse()
return real_path
def explore2():
global next_explore, current_pos
if current_pos == next_explore:
next_explore = find_next_unexplored()
if next_explore is None:
print("Nothing left to explore!")
return (0, 0)
path = make_path(next_explore)
if path is None or len(path) < 1:
#add_to_pos(next_explore, NOTHING)
print("*"*20)
print(f"Could not find a path to {next_explore} from {current_pos}")
print("*"*20)
next_explore = find_next_unexplored()
path = make_path(next_explore)
if (48, 0) in path:
print(f"Path has 48, 0, cur_pos: {current_pos}, target: {next_explore}")
nxt = path[0]
move = (nxt[0] - current_pos[0], nxt[1] - current_pos[1])
return move
def flag_char_pos(idx):
return (26 - 22 + idx, 26)
did_visit_flag = False
flag_pos = flag_char_pos(4)
outside_recs = 0
def explore3():
global did_visit_flag, current_pos, flag_pos
if did_visit_flag:
return (0,0)
return explore()
if current_pos == flag_pos:
did_visit_flag = True
return (0,0)
path = make_path(flag_pos)
if path is None or len(path) < 1:
return explore()
nxt = path[0]
move = (nxt[0] - current_pos[0], nxt[1] - current_pos[1])
return move
exp_next_location = (38, 33)
my_rand = random.Random()
def new_location():
global my_rand
while True:
rand_pos = my_rand.randint(2, 47), my_rand.randint(10, 40)
if map_pos(rand_pos) != PIT:
return rand_pos
def explore4():
global exp_next_location, current_pos
if exp_next_location == current_pos:
exp_next_location = new_location()
path = make_path(exp_next_location)
if path is None or len(path) < 1:
return (0, 0)
nxt = path[0]
move = (nxt[0] - current_pos[0], nxt[1] - current_pos[1])
return move
corner = (49, 49)
def explore_bounds():
global corner, current_pos
if corner == current_pos:
corner = (corner[0] + 1, corner[1])
path = make_path(corner)
if path is None or len(path) < 1:
print("No path!")
return (0, 0)
nxt = path[0]
move = (nxt[0] - current_pos[0], nxt[1] - current_pos[1])
return move
def print_map():
global map_data
s = "y |"
for x in range(50):
s += f" {x:02} |"
print(s)
print("-"*len(s))
for y in range(50):
s = f"{y:02} |"
for x in range(50):
data = map_pos((x, y))
#inner = " ".join(data)
s += f"{data: ^3} |"
print(s)
def save_map():
global map_data
mod_map = {}
for key, val in map_data.items():
mod_map[f"{key[0], key[1]}"] = val
with open("explored_map.json", "w+") as f:
json.dump(mod_map, f)
### For figuring out the bounds
# game_loop(explore_bounds)
### For dumping the map data
# for i in range(200):
# game_loop(explore2)
# #print_map()
# save_map()
### For figuring out the amount of chars in the flag
# flag_chars = []
# game_loop(explore4)
# print(len(flag_chars), flag_chars)
### For actually finding the flag
game_loop(explore4)
print(actual_flag)
{"(0, 0)": "0", "(1, 0)": "0", "(2, 0)": "0", "(3, 0)": "0", "(4, 0)": "0", "(5, 0)": "0", "(6, 0)": "0", "(7, 0)": "0", "(8, 0)": "0", "(9, 0)": "0", "(10, 0)": "0", "(11, 0)": "0", "(12, 0)": "0", "(13, 0)": "0", "(14, 0)": "0", "(15, 0)": "0", "(16, 0)": "0", "(17, 0)": "0", "(18, 0)": "0", "(19, 0)": "0", "(20, 0)": "0", "(21, 0)": "0", "(22, 0)": "0", "(23, 0)": "0", "(24, 0)": "0", "(25, 0)": "0", "(26, 0)": "0", "(27, 0)": "0", "(28, 0)": "0", "(29, 0)": "0", "(30, 0)": "0", "(31, 0)": "0", "(32, 0)": "0", "(33, 0)": "1", "(32, 1)": "0", "(33, 1)": "0", "(34, 1)": "0", "(34, 0)": "0", "(35, 0)": "0", "(36, 0)": "0", "(37, 0)": "1", "(35, 1)": "0", "(36, 1)": "0", "(37, 1)": "0", "(38, 1)": "0", "(38, 0)": "0", "(39, 0)": "0", "(40, 0)": "1", "(39, 1)": "0", "(40, 1)": "0", "(41, 1)": "1", "(40, 2)": "0", "(41, 2)": "1", "(40, 3)": "0", "(41, 3)": "0", "(42, 3)": "1", "(41, 4)": "0", "(42, 4)": "0", "(43, 4)": "1", "(41, 5)": "0", "(42, 5)": "0", "(43, 5)": "0", "(44, 5)": "0", "(44, 4)": "0", "(44, 3)": "0", "(43, 3)": "0", "(43, 2)": "0", "(42, 2)": "0", "(42, 1)": "0", "(42, 0)": "0", "(41, 0)": "0", "(43, 0)": "0", "(44, 0)": "0", "(45, 0)": "0", "(46, 0)": "0", "(47, 0)": "0", "(48, 0)": "0", "(49, 0)": "1", "(0, 1)": "0", "(1, 1)": "0", "(2, 1)": "0", "(3, 1)": "0", "(4, 1)": "0", "(5, 1)": "0", "(6, 1)": "0", "(7, 1)": "0", "(8, 1)": "0", "(9, 1)": "0", "(10, 1)": "0", "(11, 1)": "0", "(12, 1)": "0", "(13, 1)": "0", "(14, 1)": "0", "(15, 1)": "0", "(16, 1)": "1", "(17, 1)": "0", "(18, 1)": "1", "(19, 1)": "0", "(20, 1)": "1", "(21, 1)": "1", "(22, 1)": "0", "(23, 1)": "0", "(24, 1)": "0", "(25, 1)": "0", "(26, 1)": "0", "(27, 1)": "0", "(28, 1)": "0", "(29, 1)": "0", "(30, 1)": "0", "(31, 1)": "0", "(43, 1)": "0", "(44, 1)": "0", "(45, 1)": "0", "(46, 1)": "0", "(47, 1)": "0", "(48, 1)": "0", "(49, 1)": "0", "(44, 2)": "0", "(40, 5)": "0", "(39, 5)": "0", "(38, 5)": "1", "(0, 2)": "0", "(1, 2)": "0", "(2, 2)": "0", "(3, 2)": "0", "(4, 2)": "0", "(5, 2)": "0", "(6, 2)": "0", "(7, 2)": "0", "(8, 2)": "0", "(9, 2)": "1", "(10, 2)": "0", "(11, 2)": "0", "(12, 2)": "0", "(13, 2)": "0", "(14, 2)": "0", "(15, 2)": "1", "(14, 3)": "0", "(15, 3)": "0", "(16, 3)": "0", "(16, 2)": "0", "(17, 2)": "0", "(18, 2)": "0", "(19, 2)": "0", "(20, 2)": "1", "(19, 3)": "0", "(20, 3)": "0", "(21, 3)": "0", "(21, 2)": "0", "(22, 2)": "0", "(23, 2)": "0", "(24, 2)": "0", "(25, 2)": "0", "(26, 2)": "0", "(27, 2)": "0", "(28, 2)": "0", "(29, 2)": "0", "(30, 2)": "0", "(31, 2)": "0", "(32, 2)": "0", "(33, 2)": "0", "(34, 2)": "0", "(35, 2)": "0", "(36, 2)": "0", "(37, 2)": "0", "(38, 2)": "0", "(39, 2)": "0", "(45, 2)": "1", "(45, 3)": "0", "(46, 3)": "1", "(46, 2)": "0", "(47, 2)": "0", "(48, 2)": "0", "(49, 2)": "0", "(47, 3)": "0", "(47, 4)": "0", "(46, 4)": "0", "(45, 4)": "0", "(39, 4)": "0", "(38, 4)": "0", "(37, 4)": "0", "(36, 4)": "0", "(35, 4)": "0", "(34, 4)": "0", "(33, 4)": "0", "(32, 4)": "0", "(31, 4)": "1", "(0, 3)": "0", "(1, 3)": "0", "(2, 3)": "0", "(3, 3)": "0", "(4, 3)": "0", "(5, 3)": "0", "(6, 3)": "0", "(7, 3)": "0", "(8, 3)": "0", "(9, 3)": "0", "(10, 3)": "0", "(11, 3)": "0", "(12, 3)": "0", "(13, 3)": "0", "(17, 3)": "0", "(18, 3)": "0", "(22, 3)": "0", "(23, 3)": "0", "(24, 3)": "0", "(25, 3)": "0", "(26, 3)": "0", "(27, 3)": "0", "(28, 3)": "0", "(29, 3)": "0", "(30, 3)": "0", "(31, 3)": "0", "(32, 3)": "0", "(33, 3)": "0", "(34, 3)": "0", "(35, 3)": "0", "(36, 3)": "1", "(37, 3)": "0", "(38, 3)": "0", "(39, 3)": "1", "(48, 3)": "0", "(49, 3)": "0", "(0, 4)": "0", "(1, 4)": "1", "(2, 4)": "0", "(3, 4)": "0", "(4, 4)": "0", "(5, 4)": "0", "(6, 4)": "0", "(7, 4)": "0", "(8, 4)": "0", "(9, 4)": "0", "(10, 4)": "0", "(11, 4)": "0", "(12, 4)": "0", "(13, 4)": "0", "(14, 4)": "0", "(15, 4)": "0", "(16, 4)": "0", "(17, 4)": "0", "(18, 4)": "0", "(19, 4)": "0", "(20, 4)": "0", "(21, 4)": "0", "(22, 4)": "0", "(23, 4)": "0", "(24, 4)": "1", "(25, 4)": "0", "(26, 4)": "0", "(27, 4)": "0", "(28, 4)": "0", "(29, 4)": "0", "(30, 4)": "0", "(40, 4)": "0", "(48, 4)": "0", "(49, 4)": "1", "(0, 5)": "0", "(1, 5)": "0", "(2, 5)": "1", "(3, 5)": "0", "(4, 5)": "0", "(5, 5)": "0", "(6, 5)": "0", "(7, 5)": "0", "(8, 5)": "1", "(9, 5)": "0", "(10, 5)": "0", "(11, 5)": "0", "(12, 5)": "0", "(13, 5)": "0", "(14, 5)": "0", "(15, 5)": "1", "(16, 5)": "0", "(17, 5)": "0", "(18, 5)": "0", "(19, 5)": "0", "(20, 5)": "0", "(21, 5)": "0", "(22, 5)": "0", "(23, 5)": "0", "(24, 5)": "0", "(25, 5)": "0", "(26, 5)": "0", "(27, 5)": "0", "(28, 5)": "0", "(29, 5)": "0", "(30, 5)": "0", "(31, 5)": "0", "(32, 5)": "0", "(33, 5)": "1", "(34, 5)": "0", "(35, 5)": "1", "(36, 5)": "0", "(37, 5)": "0", "(45, 5)": "0", "(46, 5)": "0", "(47, 5)": "0", "(48, 5)": "0", "(49, 5)": "0", "(39, 6)": "1", "(0, 6)": "0", "(1, 6)": "1", "(0, 7)": "0", "(1, 7)": "0", "(2, 7)": "1", "(3, 6)": "0", "(2, 6)": "0", "(4, 6)": "0", "(5, 6)": "0", "(6, 6)": "0", "(7, 6)": "0", "(8, 6)": "0", "(9, 6)": "0", "(10, 6)": "0", "(11, 6)": "0", "(12, 6)": "1", "(13, 6)": "0", "(14, 6)": "0", "(15, 6)": "0", "(16, 6)": "0", "(17, 6)": "0", "(18, 6)": "0", "(19, 6)": "1", "(20, 6)": "0", "(21, 6)": "0", "(22, 6)": "0", "(23, 6)": "1", "(24, 6)": "0", "(25, 6)": "0", "(26, 6)": "0", "(27, 6)": "0", "(28, 6)": "0", "(29, 6)": "0", "(30, 6)": "1", "(31, 6)": "0", "(32, 6)": "1", "(31, 7)": "0", "(32, 7)": "0", "(33, 7)": "0", "(33, 6)": "0", "(34, 6)": "0", "(35, 6)": "0", "(36, 6)": "0", "(37, 6)": "0", "(38, 6)": "0", "(38, 7)": "0", "(39, 7)": "0", "(40, 7)": "0", "(40, 6)": "1", "(41, 6)": "0", "(42, 6)": "1", "(43, 6)": "1", "(44, 6)": "1", "(45, 6)": "1", "(46, 6)": "0", "(47, 6)": "0", "(48, 6)": "0", "(49, 6)": "0", "(46, 7)": "0", "(45, 7)": "0", "(44, 7)": "0", "(43, 7)": "0", "(42, 7)": "0", "(41, 7)": "0", "(37, 7)": "1", "(3, 7)": "0", "(4, 7)": "0", "(5, 7)": "0", "(6, 7)": "0", "(7, 7)": "1", "(8, 7)": "0", "(9, 7)": "0", "(10, 7)": "0", "(11, 7)": "0", "(12, 7)": "1", "(13, 7)": "1", "(14, 7)": "0", "(15, 7)": "0", "(16, 7)": "0", "(17, 7)": "0", "(18, 7)": "0", "(19, 7)": "0", "(20, 7)": "0", "(21, 7)": "0", "(22, 7)": "0", "(23, 7)": "0", "(24, 7)": "0", "(25, 7)": "0", "(26, 7)": "0", "(27, 7)": "0", "(28, 7)": "0", "(29, 7)": "1", "(28, 8)": "0", "(29, 8)": "0", "(30, 8)": "0", "(30, 7)": "1", "(34, 7)": "0", "(35, 7)": "0", "(36, 7)": "0", "(47, 7)": "0", "(48, 7)": "0", "(49, 7)": "0", "(38, 8)": "0", "(37, 8)": "0", "(36, 8)": "0", "(35, 8)": "1", "(0, 8)": "0", "(1, 8)": "0", "(2, 8)": "0", "(3, 8)": "0", "(4, 8)": "0", "(5, 8)": "0", "(6, 8)": "0", "(7, 8)": "0", "(8, 8)": "0", "(9, 8)": "0", "(10, 8)": "0", "(11, 8)": "0", "(12, 8)": "0", "(13, 8)": "0", "(14, 8)": "0", "(15, 8)": "0", "(16, 8)": "0", "(17, 8)": "0", "(18, 8)": "0", "(19, 8)": "0", "(20, 8)": "0", "(21, 8)": "0", "(22, 8)": "0", "(23, 8)": "1", "(24, 8)": "0", "(25, 8)": "0", "(26, 8)": "0", "(27, 8)": "0", "(31, 8)": "0", "(32, 8)": "0", "(33, 8)": "0", "(34, 8)": "0", "(39, 8)": "0", "(40, 8)": "0", "(41, 8)": "1", "(42, 8)": "0", "(43, 8)": "0", "(44, 8)": "0", "(45, 8)": "0", "(46, 8)": "0", "(47, 8)": "0", "(48, 8)": "0", "(49, 8)": "0", "(42, 9)": "0", "(41, 9)": "0", "(40, 9)": "0", "(39, 9)": "0", "(38, 9)": "0", "(37, 9)": "0", "(36, 9)": "0", "(35, 9)": "0", "(34, 9)": "0", "(33, 9)": "1", "(0, 9)": "0", "(1, 9)": "0", "(2, 9)": "0", "(3, 9)": "0", "(4, 9)": "0", "(5, 9)": "0", "(6, 9)": "0", "(7, 9)": "1", "(8, 9)": "0", "(9, 9)": "0", "(10, 9)": "0", "(11, 9)": "0", "(12, 9)": "1", "(13, 9)": "0", "(14, 9)": "0", "(15, 9)": "0", "(16, 9)": "0", "(17, 9)": "0", "(18, 9)": "0", "(19, 9)": "1", "(20, 9)": "0", "(21, 9)": "0", "(22, 9)": "0", "(23, 9)": "0", "(24, 9)": "0", "(25, 9)": "0", "(26, 9)": "0", "(27, 9)": "0", "(28, 9)": "0", "(29, 9)": "0", "(30, 9)": "0", "(31, 9)": "0", "(32, 9)": "0", "(43, 9)": "0", "(44, 9)": "0", "(45, 9)": "0", "(46, 9)": "0", "(47, 9)": "1", "(48, 9)": "0", "(49, 9)": "0", "(48, 10)": "0", "(47, 10)": "0", "(46, 10)": "0", "(45, 10)": "0", "(44, 10)": "0", "(43, 10)": "0", "(42, 10)": "0", "(41, 10)": "0", "(40, 10)": "0", "(39, 10)": "0", "(38, 10)": "0", "(37, 10)": "0", "(36, 10)": "0", "(35, 10)": "0", "(34, 10)": "0", "(33, 10)": "0", "(32, 10)": "0", "(31, 10)": "0", "(30, 10)": "0", "(29, 10)": "0", "(28, 10)": "0", "(27, 10)": "0", "(26, 10)": "0", "(25, 10)": "0", "(24, 10)": "0", "(23, 10)": "0", "(22, 10)": "0", "(21, 10)": "0", "(20, 10)": "0", "(19, 10)": "0", "(18, 10)": "0", "(17, 10)": "0", "(16, 10)": "0", "(15, 10)": "0", "(14, 10)": "0", "(13, 10)": "0", "(12, 10)": "0", "(11, 10)": "0", "(10, 10)": "0", "(9, 10)": "1", "(0, 10)": "0", "(1, 10)": "0", "(2, 10)": "0", "(3, 10)": "0", "(4, 10)": "0", "(5, 10)": "0", "(6, 10)": "1", "(5, 11)": "0", "(6, 11)": "0", "(7, 11)": "0", "(7, 10)": "0", "(8, 10)": "0", "(49, 10)": "0", "(10, 11)": "0", "(9, 11)": "0", "(8, 11)": "0", "(4, 11)": "0", "(3, 11)": "0", "(2, 11)": "0", "(1, 11)": "0", "(0, 11)": "0", "(11, 11)": "0", "(12, 11)": "0", "(13, 11)": "0", "(14, 11)": "0", "(15, 11)": "0", "(16, 11)": "0", "(17, 11)": "0", "(18, 11)": "0", "(19, 11)": "0", "(20, 11)": "0", "(21, 11)": "1", "(22, 11)": "0", "(23, 11)": "1", "(24, 11)": "0", "(25, 11)": "0", "(26, 11)": "0", "(27, 11)": "0", "(28, 11)": "0", "(29, 11)": "0", "(30, 11)": "1", "(31, 11)": "0", "(32, 11)": "0", "(33, 11)": "0", "(34, 11)": "0", "(35, 11)": "0", "(36, 11)": "0", "(37, 11)": "0", "(38, 11)": "0", "(39, 11)": "0", "(40, 11)": "0", "(41, 11)": "0", "(42, 11)": "0", "(43, 11)": "0", "(44, 11)": "0", "(45, 11)": "0", "(46, 11)": "0", "(47, 11)": "0", "(48, 11)": "0", "(49, 11)": "0", "(31, 12)": "0", "(30, 12)": "0", "(29, 12)": "1", "(0, 12)": "0", "(1, 12)": "0", "(2, 12)": "0", "(3, 12)": "0", "(4, 12)": "0", "(5, 12)": "0", "(6, 12)": "0", "(7, 12)": "0", "(8, 12)": "0", "(9, 12)": "0", "(10, 12)": "0", "(11, 12)": "0", "(12, 12)": "0", "(13, 12)": "0", "(14, 12)": "0", "(15, 12)": "0", "(16, 12)": "0", "(17, 12)": "0", "(18, 12)": "0", "(19, 12)": "0", "(20, 12)": "0", "(21, 12)": "0", "(22, 12)": "0", "(23, 12)": "0", "(24, 12)": "0", "(25, 12)": "1", "(26, 12)": "0", "(27, 12)": "1", "(28, 12)": "0", "(28, 13)": "0", "(29, 13)": "1", "(32, 12)": "0", "(33, 12)": "0", "(34, 12)": "0", "(35, 12)": "0", "(36, 12)": "0", "(37, 12)": "0", "(38, 12)": "0", "(39, 12)": "0", "(40, 12)": "0", "(41, 12)": "0", "(42, 12)": "0", "(43, 12)": "1", "(44, 12)": "0", "(45, 12)": "0", "(46, 12)": "1", "(47, 12)": "0", "(48, 12)": "0", "(49, 12)": "0", "(47, 13)": "0", "(46, 13)": "0", "(45, 13)": "0", "(44, 13)": "0", "(43, 13)": "0", "(42, 13)": "0", "(41, 13)": "0", "(40, 13)": "0", "(39, 13)": "0", "(38, 13)": "0", "(37, 13)": "0", "(36, 13)": "0", "(35, 13)": "0", "(34, 13)": "0", "(33, 13)": "0", "(32, 13)": "0", "(31, 13)": "0", "(30, 13)": "0", "(30, 14)": "0", "(29, 14)": "1", "(0, 13)": "0", "(1, 13)": "0", "(2, 13)": "0", "(3, 13)": "0", "(4, 13)": "0", "(5, 13)": "1", "(6, 13)": "0", "(7, 13)": "0", "(8, 13)": "0", "(9, 13)": "0", "(10, 13)": "0", "(11, 13)": "0", "(12, 13)": "0", "(13, 13)": "0", "(14, 13)": "0", "(15, 13)": "0", "(16, 13)": "0", "(17, 13)": "0", "(18, 13)": "0", "(19, 13)": "0", "(20, 13)": "0", "(21, 13)": "0", "(22, 13)": "0", "(23, 13)": "0", "(24, 13)": "0", "(25, 13)": "0", "(26, 13)": "1", "(25, 14)": "0", "(26, 14)": "0", "(27, 14)": "0", "(27, 13)": "0", "(28, 14)": "0", "(28, 15)": "1", "(48, 13)": "0", "(49, 13)": "0", "(30, 15)": "0", "(29, 15)": "0", "(29, 16)": "0", "(28, 16)": "0", "(27, 16)": "0", "(26, 16)": "0", "(25, 16)": "0", "(24, 16)": "0", "(23, 16)": "0", "(22, 16)": "0", "(21, 16)": "0", "(20, 16)": "0", "(19, 16)": "0", "(18, 16)": "0", "(17, 16)": "0", "(16, 16)": "0", "(15, 16)": "0", "(14, 16)": "1", "(0, 14)": "0", "(1, 14)": "0", "(2, 14)": "0", "(3, 14)": "0", "(4, 14)": "0", "(5, 14)": "0", "(6, 14)": "0", "(7, 14)": "0", "(8, 14)": "0", "(9, 14)": "0", "(10, 14)": "0", "(11, 14)": "1", "(12, 14)": "0", "(13, 14)": "0", "(14, 14)": "0", "(15, 14)": "0", "(16, 14)": "0", "(17, 14)": "0", "(18, 14)": "0", "(19, 14)": "0", "(20, 14)": "0", "(21, 14)": "0", "(22, 14)": "0", "(23, 14)": "0", "(24, 14)": "0", "(27, 15)": "0", "(31, 14)": "0", "(32, 14)": "0", "(33, 14)": "0", "(34, 14)": "0", "(35, 14)": "0", "(36, 14)": "0", "(37, 14)": "0", "(38, 14)": "0", "(39, 14)": "0", "(40, 14)": "0", "(41, 14)": "0", "(42, 14)": "0", "(43, 14)": "0", "(44, 14)": "0", "(45, 14)": "0", "(46, 14)": "0", "(47, 14)": "0", "(48, 14)": "0", "(49, 14)": "0", "(15, 15)": "0", "(14, 15)": "0", "(13, 15)": "0", "(12, 15)": "0", "(11, 15)": "0", "(10, 15)": "0", "(9, 15)": "0", "(8, 15)": "0", "(7, 15)": "0", "(6, 15)": "0", "(5, 15)": "0", "(4, 15)": "0", "(3, 15)": "0", "(2, 15)": "0", "(1, 15)": "0", "(0, 15)": "0", "(16, 15)": "0", "(17, 15)": "0", "(18, 15)": "0", "(19, 15)": "0", "(20, 15)": "0", "(21, 15)": "0", "(22, 15)": "0", "(23, 15)": "0", "(24, 15)": "0", "(25, 15)": "0", "(26, 15)": "0", "(31, 15)": "0", "(32, 15)": "0", "(33, 15)": "0", "(34, 15)": "0", "(35, 15)": "0", "(36, 15)": "1", "(37, 15)": "0", "(38, 15)": "1", "(39, 15)": "1", "(40, 15)": "1", "(41, 15)": "0", "(42, 15)": "1", "(43, 15)": "0", "(44, 15)": "0", "(45, 15)": "0", "(46, 15)": "0", "(47, 15)": "0", "(48, 15)": "0", "(49, 15)": "0", "(43, 16)": "0", "(42, 16)": "0", "(41, 16)": "0", "(40, 16)": "0", "(39, 16)": "0", "(38, 16)": "0", "(37, 16)": "0", "(36, 16)": "0", "(35, 16)": "0", "(34, 16)": "0", "(33, 16)": "0", "(32, 16)": "0", "(31, 16)": "0", "(30, 16)": "0", "(0, 16)": "0", "(1, 16)": "0", "(2, 16)": "0", "(3, 16)": "0", "(4, 16)": "0", "(5, 16)": "0", "(6, 16)": "0", "(7, 16)": "0", "(8, 16)": "0", "(9, 16)": "0", "(10, 16)": "0", "(11, 16)": "0", "(12, 16)": "0", "(13, 16)": "0", "(44, 16)": "0", "(45, 16)": "0", "(46, 16)": "1", "(47, 16)": "0", "(48, 16)": "0", "(49, 16)": "0", "(47, 17)": "0", "(46, 17)": "0", "(45, 17)": "0", "(44, 17)": "0", "(43, 17)": "1", "(0, 17)": "0", "(1, 17)": "0", "(2, 17)": "1", "(3, 17)": "0", "(4, 17)": "0", "(5, 17)": "0", "(6, 17)": "0", "(7, 17)": "0", "(8, 17)": "0", "(9, 17)": "0", "(10, 17)": "0", "(11, 17)": "0", "(12, 17)": "0", "(13, 17)": "0", "(14, 17)": "0", "(15, 17)": "0", "(16, 17)": "0", "(17, 17)": "0", "(18, 17)": "0", "(19, 17)": "0", "(20, 17)": "0", "(21, 17)": "0", "(22, 17)": "0", "(23, 17)": "0", "(24, 17)": "0", "(25, 17)": "1", "(26, 17)": "1", "(27, 17)": "0", "(28, 17)": "1", "(29, 17)": "0", "(30, 17)": "0", "(31, 17)": "1", "(32, 17)": "0", "(33, 17)": "0", "(34, 17)": "0", "(35, 17)": "0", "(36, 17)": "0", "(37, 17)": "0", "(38, 17)": "0", "(39, 17)": "0", "(40, 17)": "0", "(41, 17)": "0", "(42, 17)": "0", "(48, 17)": "0", "(49, 17)": "0", "(44, 18)": "0", "(43, 18)": "0", "(42, 18)": "0", "(41, 18)": "0", "(40, 18)": "0", "(39, 18)": "0", "(38, 18)": "0", "(37, 18)": "0", "(36, 18)": "0", "(35, 18)": "0", "(34, 18)": "0", "(33, 18)": "0", "(32, 18)": "0", "(31, 18)": "0", "(30, 18)": "0", "(29, 18)": "1", "(0, 18)": "0", "(1, 18)": "0", "(2, 18)": "0", "(3, 18)": "0", "(4, 18)": "0", "(5, 18)": "0", "(6, 18)": "0", "(7, 18)": "0", "(8, 18)": "0", "(9, 18)": "0", "(10, 18)": "0", "(11, 18)": "0", "(12, 18)": "0", "(13, 18)": "0", "(14, 18)": "0", "(15, 18)": "0", "(16, 18)": "0", "(17, 18)": "0", "(18, 18)": "0", "(19, 18)": "0", "(20, 18)": "0", "(21, 18)": "0", "(22, 18)": "0", "(23, 18)": "0", "(24, 18)": "0", "(25, 18)": "0", "(26, 18)": "0", "(27, 18)": "0", "(28, 18)": "0", "(28, 19)": "0", "(29, 19)": "0", "(30, 19)": "0", "(45, 18)": "0", "(46, 18)": "0", "(47, 18)": "0", "(48, 18)": "0", "(49, 18)": "1", "(0, 19)": "0", "(1, 19)": "0", "(2, 19)": "0", "(3, 19)": "0", "(4, 19)": "0", "(5, 19)": "0", "(6, 19)": "0", "(7, 19)": "0", "(8, 19)": "0", "(9, 19)": "0", "(10, 19)": "0", "(11, 19)": "0", "(12, 19)": "0", "(13, 19)": "0", "(14, 19)": "0", "(15, 19)": "0", "(16, 19)": "0", "(17, 19)": "0", "(18, 19)": "0", "(19, 19)": "0", "(20, 19)": "0", "(21, 19)": "0", "(22, 19)": "1", "(23, 19)": "0", "(24, 19)": "0", "(25, 19)": "0", "(26, 19)": "0", "(27, 19)": "0", "(31, 19)": "0", "(32, 19)": "0", "(33, 19)": "0", "(34, 19)": "0", "(35, 19)": "1", "(36, 19)": "0", "(37, 19)": "0", "(38, 19)": "0", "(39, 19)": "0", "(40, 19)": "0", "(41, 19)": "0", "(42, 19)": "0", "(43, 19)": "0", "(44, 19)": "0", "(45, 19)": "0", "(46, 19)": "0", "(47, 19)": "0", "(48, 19)": "0", "(49, 19)": "0", "(36, 20)": "0", "(35, 20)": "0", "(34, 20)": "0", "(33, 20)": "0", "(32, 20)": "0", "(31, 20)": "0", "(30, 20)": "0", "(29, 20)": "0", "(28, 20)": "0", "(27, 20)": "0", "(26, 20)": "0", "(25, 20)": "0", "(24, 20)": "0", "(23, 20)": "0", "(22, 20)": "0", "(21, 20)": "0", "(20, 20)": "0", "(19, 20)": "1", "(0, 20)": "0", "(1, 20)": "0", "(2, 20)": "1", "(3, 20)": "0", "(4, 20)": "1", "(5, 20)": "1", "(6, 20)": "0", "(7, 20)": "0", "(8, 20)": "0", "(9, 20)": "0", "(10, 20)": "0", "(11, 20)": "0", "(12, 20)": "0", "(13, 20)": "0", "(14, 20)": "0", "(15, 20)": "0", "(16, 20)": "0", "(17, 20)": "0", "(18, 20)": "1", "(37, 20)": "0", "(38, 20)": "0", "(39, 20)": "0", "(40, 20)": "0", "(41, 20)": "1", "(42, 20)": "1", "(43, 20)": "0", "(44, 20)": "0", "(45, 20)": "0", "(46, 20)": "0", "(47, 20)": "1", "(48, 20)": "0", "(49, 20)": "0", "(48, 21)": "0", "(47, 21)": "0", "(46, 21)": "0", "(45, 21)": "0", "(44, 21)": "0", "(43, 21)": "0", "(42, 21)": "0", "(41, 21)": "0", "(40, 21)": "0", "(39, 21)": "0", "(38, 21)": "0", "(37, 21)": "1", "(0, 21)": "0", "(1, 21)": "1", "(0, 22)": "0", "(1, 22)": "0", "(2, 22)": "0", "(2, 21)": "0", "(3, 21)": "0", "(4, 21)": "0", "(5, 21)": "0", "(6, 21)": "0", "(7, 21)": "0", "(8, 21)": "0", "(9, 21)": "0", "(10, 21)": "0", "(11, 21)": "0", "(12, 21)": "0", "(13, 21)": "0", "(14, 21)": "0", "(15, 21)": "0", "(16, 21)": "0", "(17, 21)": "0", "(18, 21)": "0", "(19, 21)": "0", "(20, 21)": "1", "(21, 21)": "0", "(22, 21)": "0", "(23, 21)": "0", "(24, 21)": "0", "(25, 21)": "0", "(26, 21)": "0", "(27, 21)": "0", "(28, 21)": "0", "(29, 21)": "0", "(30, 21)": "0", "(31, 21)": "1", "(32, 21)": "0", "(33, 21)": "0", "(34, 21)": "0", "(35, 21)": "1", "(36, 21)": "0", "(49, 21)": "0", "(38, 22)": "0", "(37, 22)": "0", "(36, 22)": "0", "(35, 22)": "0", "(34, 22)": "0", "(33, 22)": "0", "(32, 22)": "0", "(31, 22)": "0", "(30, 22)": "0", "(29, 22)": "0", "(28, 22)": "0", "(27, 22)": "0", "(26, 22)": "0", "(25, 22)": "0", "(24, 22)": "0", "(23, 22)": "0", "(22, 22)": "0", "(21, 22)": "0", "(20, 22)": "0", "(19, 22)": "0", "(18, 22)": "0", "(17, 22)": "0", "(16, 22)": "0", "(15, 22)": "0", "(14, 22)": "0", "(13, 22)": "0", "(12, 22)": "0", "(11, 22)": "0", "(10, 22)": "0", "(9, 22)": "0", "(8, 22)": "0", "(7, 22)": "0", "(6, 22)": "0", "(5, 22)": "1", "(3, 22)": "0", "(4, 22)": "1", "(39, 22)": "0", "(40, 22)": "0", "(41, 22)": "0", "(42, 22)": "0", "(43, 22)": "0", "(44, 22)": "0", "(45, 22)": "0", "(46, 22)": "0", "(47, 22)": "0", "(48, 22)": "0", "(49, 22)": "0", "(6, 23)": "0", "(5, 23)": "0", "(4, 23)": "0", "(3, 23)": "0", "(2, 23)": "0", "(1, 23)": "0", "(0, 23)": "0", "(7, 23)": "1", "(8, 23)": "0", "(9, 23)": "0", "(10, 23)": "0", "(11, 23)": "0", "(12, 23)": "0", "(13, 23)": "0", "(14, 23)": "0", "(15, 23)": "1", "(16, 23)": "0", "(17, 23)": "0", "(18, 23)": "0", "(19, 23)": "0", "(20, 23)": "0", "(21, 23)": "0", "(22, 23)": "0", "(23, 23)": "0", "(24, 23)": "0", "(25, 23)": "0", "(26, 23)": "0", "(27, 23)": "0", "(28, 23)": "0", "(29, 23)": "0", "(30, 23)": "1", "(31, 23)": "0", "(32, 23)": "0", "(33, 23)": "0", "(34, 23)": "0", "(35, 23)": "0", "(36, 23)": "0", "(37, 23)": "0", "(38, 23)": "0", "(39, 23)": "0", "(40, 23)": "0", "(41, 23)": "0", "(42, 23)": "0", "(43, 23)": "0", "(44, 23)": "0", "(45, 23)": "0", "(46, 23)": "0", "(47, 23)": "0", "(48, 23)": "0", "(49, 23)": "0", "(31, 24)": "0", "(30, 24)": "0", "(29, 24)": "0", "(28, 24)": "0", "(27, 24)": "0", "(26, 24)": "0", "(25, 24)": "0", "(24, 24)": "0", "(23, 24)": "0", "(22, 24)": "1", "(0, 24)": "0", "(1, 24)": "0", "(2, 24)": "0", "(3, 24)": "0", "(4, 24)": "0", "(5, 24)": "0", "(6, 24)": "0", "(7, 24)": "0", "(8, 24)": "0", "(9, 24)": "0", "(10, 24)": "0", "(11, 24)": "0", "(12, 24)": "0", "(13, 24)": "0", "(14, 24)": "0", "(15, 24)": "0", "(16, 24)": "0", "(17, 24)": "0", "(18, 24)": "0", "(19, 24)": "0", "(20, 24)": "0", "(21, 24)": "0", "(32, 24)": "0", "(33, 24)": "0", "(34, 24)": "1", "(35, 24)": "0", "(36, 24)": "0", "(37, 24)": "0", "(38, 24)": "0", "(39, 24)": "0", "(40, 24)": "0", "(41, 24)": "0", "(42, 24)": "0", "(43, 24)": "1", "(44, 24)": "0", "(45, 24)": "0", "(46, 24)": "0", "(47, 24)": "1", "(48, 24)": "0", "(49, 24)": "0", "(48, 25)": "0", "(47, 25)": "0", "(46, 25)": "0", "(45, 25)": "0", "(44, 25)": "0", "(43, 25)": "0", "(42, 25)": "0", "(41, 25)": "0", "(40, 25)": "0", "(39, 25)": "0", "(38, 25)": "0", "(37, 25)": "0", "(36, 25)": "0", "(35, 25)": "0", "(34, 25)": "0", "(33, 25)": "0", "(32, 25)": "0", "(31, 25)": "0", "(30, 25)": "0", "(29, 25)": "0", "(28, 25)": "0", "(27, 25)": "0", "(26, 25)": "0", "(25, 25)": "0", "(24, 25)": "0", "(23, 25)": "0", "(22, 25)": "0", "(21, 25)": "0", "(20, 25)": "0", "(19, 25)": "0", "(18, 25)": "0", "(17, 25)": "0", "(16, 25)": "0", "(15, 25)": "0", "(14, 25)": "0", "(13, 25)": "0", "(12, 25)": "0", "(11, 25)": "0", "(10, 25)": "0", "(9, 25)": "0", "(8, 25)": "0", "(7, 25)": "0", "(6, 25)": "0", "(5, 25)": "0", "(4, 25)": "0", "(3, 25)": "0", "(2, 25)": "0", "(1, 25)": "0", "(0, 25)": "0", "(49, 25)": "0", "(0, 26)": "0", "(1, 26)": "0", "(2, 26)": "1", "(3, 26)": "0", "(4, 26)": "1", "(5, 26)": "0", "(6, 26)": "0", "(7, 26)": "0", "(8, 26)": "0", "(9, 26)": "0", "(10, 26)": "0", "(11, 26)": "0", "(12, 26)": "0", "(13, 26)": "1", "(14, 26)": "0", "(15, 26)": "1", "(16, 26)": "0", "(17, 26)": "0", "(18, 26)": "0", "(19, 26)": "0", "(20, 26)": "0", "(21, 26)": "0", "(22, 26)": "0", "(23, 26)": "0", "(24, 26)": "0", "(25, 26)": "0", "(26, 26)": "1", "(27, 26)": "0", "(28, 26)": "0", "(29, 26)": "0", "(30, 26)": "0", "(31, 26)": "0", "(32, 26)": "0", "(33, 26)": "0", "(34, 26)": "0", "(35, 26)": "0", "(36, 26)": "1", "(37, 26)": "1", "(38, 26)": "0", "(39, 26)": "0", "(40, 26)": "1", "(41, 26)": "0", "(42, 26)": "0", "(43, 26)": "0", "(44, 26)": "0", "(45, 26)": "0", "(46, 26)": "0", "(47, 26)": "0", "(48, 26)": "0", "(49, 26)": "1", "(0, 27)": "0", "(1, 27)": "0", "(2, 27)": "0", "(3, 27)": "0", "(4, 27)": "0", "(5, 27)": "0", "(6, 27)": "0", "(7, 27)": "0", "(8, 27)": "0", "(9, 27)": "0", "(10, 27)": "1", "(11, 27)": "0", "(12, 27)": "0", "(13, 27)": "0", "(14, 27)": "0", "(15, 27)": "0", "(16, 27)": "0", "(17, 27)": "0", "(18, 27)": "0", "(19, 27)": "0", "(20, 27)": "1", "(21, 27)": "0", "(22, 27)": "0", "(23, 27)": "0", "(24, 27)": "0", "(25, 27)": "0", "(26, 27)": "0", "(27, 27)": "0", "(28, 27)": "0", "(29, 27)": "0", "(30, 27)": "0", "(31, 27)": "0", "(32, 27)": "0", "(33, 27)": "0", "(34, 27)": "0", "(35, 27)": "0", "(36, 27)": "0", "(37, 27)": "0", "(38, 27)": "0", "(39, 27)": "0", "(40, 27)": "0", "(41, 27)": "1", "(42, 27)": "0", "(43, 27)": "0", "(44, 27)": "0", "(45, 27)": "0", "(46, 27)": "0", "(47, 27)": "0", "(48, 27)": "0", "(49, 27)": "0", "(42, 28)": "0", "(41, 28)": "0", "(40, 28)": "0", "(39, 28)": "0", "(38, 28)": "1", "(0, 28)": "0", "(1, 28)": "0", "(2, 28)": "0", "(3, 28)": "0", "(4, 28)": "0", "(5, 28)": "0", "(6, 28)": "0", "(7, 28)": "0", "(8, 28)": "0", "(9, 28)": "0", "(10, 28)": "0", "(11, 28)": "0", "(12, 28)": "0", "(13, 28)": "0", "(14, 28)": "0", "(15, 28)": "0", "(16, 28)": "0", "(17, 28)": "0", "(18, 28)": "1", "(19, 28)": "0", "(20, 28)": "0", "(21, 28)": "0", "(22, 28)": "0", "(23, 28)": "0", "(24, 28)": "0", "(25, 28)": "0", "(26, 28)": "0", "(27, 28)": "0", "(28, 28)": "0", "(29, 28)": "0", "(30, 28)": "0", "(31, 28)": "0", "(32, 28)": "0", "(33, 28)": "1", "(34, 28)": "0", "(35, 28)": "0", "(36, 28)": "0", "(37, 28)": "0", "(43, 28)": "0", "(44, 28)": "0", "(45, 28)": "0", "(46, 28)": "0", "(47, 28)": "0", "(48, 28)": "0", "(49, 28)": "0", "(39, 29)": "0", "(38, 29)": "0", "(37, 29)": "1", "(0, 29)": "0", "(1, 29)": "0", "(2, 29)": "0", "(3, 29)": "0", "(4, 29)": "0", "(5, 29)": "0", "(6, 29)": "0", "(7, 29)": "0", "(8, 29)": "0", "(9, 29)": "0", "(10, 29)": "0", "(11, 29)": "0", "(12, 29)": "0", "(13, 29)": "0", "(14, 29)": "0", "(15, 29)": "1", "(16, 29)": "0", "(17, 29)": "0", "(18, 29)": "1", "(19, 29)": "0", "(20, 29)": "0", "(21, 29)": "0", "(22, 29)": "0", "(23, 29)": "0", "(24, 29)": "1", "(25, 29)": "1", "(26, 29)": "0", "(27, 29)": "0", "(28, 29)": "1", "(29, 29)": "0", "(30, 29)": "0", "(31, 29)": "0", "(32, 29)": "0", "(33, 29)": "0", "(34, 29)": "1", "(35, 29)": "0", "(36, 29)": "0", "(36, 30)": "0", "(37, 30)": "0", "(38, 30)": "0", "(40, 29)": "0", "(41, 29)": "0", "(42, 29)": "0", "(43, 29)": "0", "(44, 29)": "0", "(45, 29)": "0", "(46, 29)": "0", "(47, 29)": "0", "(48, 29)": "0", "(49, 29)": "0", "(35, 30)": "0", "(34, 30)": "0", "(33, 30)": "0", "(32, 30)": "0", "(31, 30)": "0", "(30, 30)": "0", "(29, 30)": "0", "(28, 30)": "0", "(27, 30)": "0", "(26, 30)": "0", "(25, 30)": "0", "(24, 30)": "0", "(23, 30)": "1", "(0, 30)": "0", "(1, 30)": "0", "(2, 30)": "0", "(3, 30)": "0", "(4, 30)": "0", "(5, 30)": "0", "(6, 30)": "0", "(7, 30)": "0", "(8, 30)": "0", "(9, 30)": "0", "(10, 30)": "0", "(11, 30)": "0", "(12, 30)": "0", "(13, 30)": "0", "(14, 30)": "0", "(15, 30)": "0", "(16, 30)": "0", "(17, 30)": "0", "(18, 30)": "0", "(19, 30)": "1", "(20, 30)": "0", "(21, 30)": "0", "(22, 30)": "0", "(22, 31)": "0", "(23, 31)": "0", "(24, 31)": "0", "(39, 30)": "0", "(40, 30)": "0", "(41, 30)": "0", "(42, 30)": "0", "(43, 30)": "0", "(44, 30)": "0", "(45, 30)": "0", "(46, 30)": "0", "(47, 30)": "0", "(48, 30)": "0", "(49, 30)": "0", "(21, 31)": "0", "(20, 31)": "0", "(19, 31)": "0", "(18, 31)": "0", "(17, 31)": "1", "(0, 31)": "0", "(1, 31)": "0", "(2, 31)": "0", "(3, 31)": "0", "(4, 31)": "0", "(5, 31)": "0", "(6, 31)": "0", "(7, 31)": "0", "(8, 31)": "0", "(9, 31)": "0", "(10, 31)": "1", "(11, 31)": "0", "(12, 31)": "1", "(13, 31)": "0", "(14, 31)": "0", "(15, 31)": "0", "(16, 31)": "0", "(25, 31)": "1", "(26, 31)": "0", "(27, 31)": "0", "(28, 31)": "0", "(29, 31)": "0", "(30, 31)": "0", "(31, 31)": "0", "(32, 31)": "0", "(33, 31)": "0", "(34, 31)": "0", "(35, 31)": "0", "(36, 31)": "0", "(37, 31)": "0", "(38, 31)": "0", "(39, 31)": "0", "(40, 31)": "0", "(41, 31)": "0", "(42, 31)": "0", "(43, 31)": "0", "(44, 31)": "0", "(45, 31)": "0", "(46, 31)": "0", "(47, 31)": "0", "(48, 31)": "0", "(49, 31)": "0", "(26, 32)": "0", "(25, 32)": "0", "(24, 32)": "0", "(23, 32)": "0", "(22, 32)": "0", "(21, 32)": "0", "(20, 32)": "0", "(19, 32)": "0", "(18, 32)": "0", "(17, 32)": "0", "(16, 32)": "0", "(15, 32)": "1", "(0, 32)": "0", "(1, 32)": "1", "(2, 32)": "0", "(3, 32)": "0", "(4, 32)": "0", "(5, 32)": "0", "(6, 32)": "0", "(7, 32)": "0", "(8, 32)": "0", "(9, 32)": "1", "(8, 33)": "0", "(9, 33)": "0", "(10, 33)": "0", "(10, 32)": "0", "(11, 32)": "0", "(12, 32)": "0", "(13, 32)": "0", "(14, 32)": "0", "(27, 32)": "0", "(28, 32)": "0", "(29, 32)": "0", "(30, 32)": "0", "(31, 32)": "0", "(32, 32)": "1", "(33, 32)": "0", "(34, 32)": "0", "(35, 32)": "0", "(36, 32)": "0", "(37, 32)": "0", "(38, 32)": "0", "(39, 32)": "0", "(40, 32)": "0", "(41, 32)": "1", "(42, 32)": "1", "(43, 32)": "0", "(44, 32)": "0", "(45, 32)": "0", "(46, 32)": "0", "(47, 32)": "0", "(48, 32)": "0", "(49, 32)": "0", "(43, 33)": "0", "(42, 33)": "0", "(41, 33)": "0", "(40, 33)": "0", "(39, 33)": "0", "(38, 33)": "0", "(37, 33)": "0", "(36, 33)": "1", "(0, 33)": "0", "(1, 33)": "0", "(2, 33)": "0", "(3, 33)": "0", "(4, 33)": "0", "(5, 33)": "0", "(6, 33)": "1", "(7, 33)": "0", "(11, 33)": "1", "(12, 33)": "0", "(13, 33)": "0", "(14, 33)": "0", "(15, 33)": "0", "(16, 33)": "0", "(17, 33)": "0", "(18, 33)": "0", "(19, 33)": "0", "(20, 33)": "0", "(21, 33)": "1", "(22, 33)": "0", "(23, 33)": "0", "(24, 33)": "0", "(25, 33)": "0", "(26, 33)": "0", "(27, 33)": "0", "(28, 33)": "1", "(29, 33)": "0", "(30, 33)": "0", "(31, 33)": "0", "(32, 33)": "0", "(33, 33)": "0", "(34, 33)": "0", "(35, 33)": "1", "(44, 33)": "0", "(45, 33)": "0", "(46, 33)": "1", "(47, 33)": "0", "(48, 33)": "0", "(49, 33)": "0", "(47, 34)": "0", "(46, 34)": "0", "(45, 34)": "0", "(44, 34)": "0", "(43, 34)": "0", "(42, 34)": "0", "(41, 34)": "0", "(40, 34)": "0", "(39, 34)": "0", "(38, 34)": "0", "(37, 34)": "0", "(36, 34)": "0", "(35, 34)": "0", "(34, 34)": "0", "(33, 34)": "0", "(32, 34)": "0", "(31, 34)": "0", "(30, 34)": "0", "(29, 34)": "0", "(28, 34)": "0", "(27, 34)": "0", "(26, 34)": "0", "(25, 34)": "0", "(24, 34)": "0", "(23, 34)": "0", "(22, 34)": "0", "(21, 34)": "0", "(20, 34)": "0", "(19, 34)": "0", "(18, 34)": "0", "(17, 34)": "0", "(16, 34)": "0", "(15, 34)": "1", "(0, 34)": "1", "(1, 34)": "0", "(2, 34)": "0", "(3, 34)": "0", "(4, 34)": "0", "(5, 34)": "0", "(6, 34)": "0", "(7, 34)": "0", "(8, 34)": "0", "(9, 34)": "0", "(10, 34)": "0", "(11, 34)": "0", "(12, 34)": "0", "(13, 34)": "0", "(14, 34)": "0", "(48, 34)": "0", "(49, 34)": "0", "(16, 35)": "0", "(15, 35)": "0", "(14, 35)": "1", "(1, 35)": "0", "(0, 35)": "0", "(2, 35)": "0", "(3, 35)": "0", "(4, 35)": "0", "(5, 35)": "0", "(6, 35)": "1", "(7, 35)": "0", "(8, 35)": "0", "(9, 35)": "0", "(10, 35)": "0", "(11, 35)": "0", "(12, 35)": "0", "(13, 35)": "0", "(13, 36)": "0", "(14, 36)": "0", "(15, 36)": "1", "(17, 35)": "0", "(18, 35)": "1", "(19, 35)": "0", "(20, 35)": "0", "(21, 35)": "0", "(22, 35)": "0", "(23, 35)": "0", "(24, 35)": "0", "(25, 35)": "0", "(26, 35)": "0", "(27, 35)": "0", "(28, 35)": "0", "(29, 35)": "0", "(30, 35)": "0", "(31, 35)": "0", "(32, 35)": "0", "(33, 35)": "0", "(34, 35)": "1", "(35, 35)": "0", "(36, 35)": "0", "(37, 35)": "0", "(38, 35)": "0", "(39, 35)": "0", "(40, 35)": "0", "(41, 35)": "0", "(42, 35)": "0", "(43, 35)": "0", "(44, 35)": "0", "(45, 35)": "0", "(46, 35)": "0", "(47, 35)": "0", "(48, 35)": "0", "(49, 35)": "1", "(0, 36)": "0", "(1, 36)": "0", "(2, 36)": "0", "(3, 36)": "0", "(4, 36)": "1", "(5, 36)": "0", "(6, 36)": "0", "(7, 36)": "0", "(8, 36)": "0", "(9, 36)": "0", "(10, 36)": "0", "(11, 36)": "1", "(12, 36)": "0", "(14, 37)": "0", "(15, 37)": "1", "(16, 36)": "0", "(17, 36)": "0", "(18, 36)": "0", "(19, 36)": "0", "(20, 36)": "0", "(21, 36)": "0", "(22, 36)": "0", "(23, 36)": "0", "(24, 36)": "0", "(25, 36)": "0", "(26, 36)": "0", "(27, 36)": "0", "(28, 36)": "0", "(29, 36)": "0", "(30, 36)": "0", "(31, 36)": "0", "(32, 36)": "0", "(33, 36)": "0", "(34, 36)": "0", "(35, 36)": "0", "(36, 36)": "0", "(37, 36)": "0", "(38, 36)": "0", "(39, 36)": "0", "(40, 36)": "0", "(41, 36)": "0", "(42, 36)": "0", "(43, 36)": "0", "(44, 36)": "0", "(45, 36)": "0", "(46, 36)": "0", "(47, 36)": "0", "(48, 36)": "0", "(49, 36)": "0", "(16, 37)": "0", "(16, 38)": "0", "(15, 38)": "0", "(14, 38)": "0", "(13, 38)": "0", "(12, 38)": "0", "(11, 38)": "0", "(10, 38)": "0", "(9, 38)": "0", "(8, 38)": "0", "(7, 38)": "0", "(6, 38)": "0", "(5, 38)": "0", "(4, 38)": "0", "(3, 38)": "0", "(2, 38)": "0", "(1, 38)": "0", "(0, 38)": "0", "(0, 37)": "0", "(1, 37)": "0", "(2, 37)": "0", "(3, 37)": "0", "(4, 37)": "0", "(5, 37)": "0", "(6, 37)": "0", "(7, 37)": "0", "(8, 37)": "0", "(9, 37)": "0", "(10, 37)": "1", "(11, 37)": "0", "(12, 37)": "0", "(13, 37)": "0", "(17, 37)": "1", "(18, 37)": "0", "(19, 37)": "0", "(20, 37)": "0", "(21, 37)": "0", "(22, 37)": "0", "(23, 37)": "0", "(24, 37)": "0", "(25, 37)": "1", "(26, 37)": "0", "(27, 37)": "0", "(28, 37)": "0", "(29, 37)": "0", "(30, 37)": "0", "(31, 37)": "0", "(32, 37)": "0", "(33, 37)": "0", "(34, 37)": "0", "(35, 37)": "0", "(36, 37)": "0", "(37, 37)": "0", "(38, 37)": "0", "(39, 37)": "0", "(40, 37)": "0", "(41, 37)": "0", "(42, 37)": "0", "(43, 37)": "0", "(44, 37)": "0", "(45, 37)": "0", "(46, 37)": "0", "(47, 37)": "1", "(48, 37)": "0", "(49, 37)": "0", "(48, 38)": "0", "(47, 38)": "0", "(46, 38)": "0", "(45, 38)": "0", "(44, 38)": "0", "(43, 38)": "1", "(17, 38)": "0", "(18, 38)": "0", "(19, 38)": "0", "(20, 38)": "0", "(21, 38)": "0", "(22, 38)": "0", "(23, 38)": "0", "(24, 38)": "0", "(25, 38)": "0", "(26, 38)": "0", "(27, 38)": "0", "(28, 38)": "0", "(29, 38)": "0", "(30, 38)": "0", "(31, 38)": "0", "(32, 38)": "0", "(33, 38)": "0", "(34, 38)": "0", "(35, 38)": "0", "(36, 38)": "0", "(37, 38)": "0", "(38, 38)": "0", "(39, 38)": "0", "(40, 38)": "0", "(41, 38)": "0", "(42, 38)": "0", "(49, 38)": "0", "(44, 39)": "0", "(43, 39)": "0", "(42, 39)": "0", "(41, 39)": "0", "(40, 39)": "0", "(39, 39)": "0", "(38, 39)": "0", "(37, 39)": "0", "(36, 39)": "0", "(35, 39)": "0", "(34, 39)": "0", "(33, 39)": "0", "(32, 39)": "0", "(31, 39)": "0", "(30, 39)": "0", "(29, 39)": "0", "(28, 39)": "0", "(27, 39)": "0", "(26, 39)": "0", "(25, 39)": "0", "(24, 39)": "0", "(23, 39)": "0", "(22, 39)": "0", "(21, 39)": "0", "(20, 39)": "0", "(19, 39)": "0", "(18, 39)": "0", "(17, 39)": "0", "(16, 39)": "0", "(15, 39)": "0", "(14, 39)": "0", "(13, 39)": "0", "(12, 39)": "0", "(11, 39)": "0", "(10, 39)": "0", "(9, 39)": "0", "(8, 39)": "0", "(7, 39)": "0", "(6, 39)": "0", "(5, 39)": "0", "(4, 39)": "0", "(3, 39)": "0", "(2, 39)": "0", "(1, 39)": "0", "(0, 39)": "0", "(45, 39)": "0", "(46, 39)": "0", "(47, 39)": "0", "(48, 39)": "0", "(49, 39)": "0", "(0, 40)": "0", "(1, 40)": "0", "(2, 40)": "0", "(3, 40)": "0", "(4, 40)": "0", "(5, 40)": "0", "(6, 40)": "0", "(7, 40)": "0", "(8, 40)": "0", "(9, 40)": "1", "(10, 40)": "0", "(11, 40)": "0", "(12, 40)": "0", "(13, 40)": "0", "(14, 40)": "0", "(15, 40)": "0", "(16, 40)": "0", "(17, 40)": "0", "(18, 40)": "0", "(19, 40)": "0", "(20, 40)": "0", "(21, 40)": "0", "(22, 40)": "1", "(23, 40)": "0", "(24, 40)": "0", "(25, 40)": "1", "(26, 40)": "0", "(27, 40)": "0", "(28, 40)": "0", "(29, 40)": "0", "(30, 40)": "0", "(31, 40)": "0", "(32, 40)": "0", "(33, 40)": "0", "(34, 40)": "0", "(35, 40)": "0", "(36, 40)": "0", "(37, 40)": "0", "(38, 40)": "0", "(39, 40)": "0", "(40, 40)": "0", "(41, 40)": "0", "(42, 40)": "0", "(43, 40)": "0", "(44, 40)": "1", "(45, 40)": "0", "(46, 40)": "0", "(47, 40)": "0", "(48, 40)": "0", "(49, 40)": "0", "(45, 41)": "0", "(44, 41)": "1", "(0, 41)": "0", "(1, 41)": "0", "(2, 41)": "0", "(3, 41)": "0", "(4, 41)": "0", "(5, 41)": "0", "(6, 41)": "0", "(7, 41)": "0", "(8, 41)": "0", "(9, 41)": "0", "(10, 41)": "0", "(11, 41)": "0", "(12, 41)": "0", "(13, 41)": "0", "(14, 41)": "0", "(15, 41)": "0", "(16, 41)": "0", "(17, 41)": "0", "(18, 41)": "0", "(19, 41)": "1", "(20, 41)": "0", "(21, 41)": "0", "(22, 41)": "0", "(23, 41)": "0", "(24, 41)": "0", "(25, 41)": "0", "(26, 41)": "0", "(27, 41)": "0", "(28, 41)": "0", "(29, 41)": "0", "(30, 41)": "0", "(31, 41)": "0", "(32, 41)": "0", "(33, 41)": "0", "(34, 41)": "0", "(35, 41)": "0", "(36, 41)": "0", "(37, 41)": "0", "(38, 41)": "0", "(39, 41)": "0", "(40, 41)": "0", "(41, 41)": "0", "(42, 41)": "0", "(43, 41)": "0", "(43, 42)": "0", "(44, 42)": "1", "(46, 41)": "1", "(47, 41)": "1", "(48, 41)": "1", "(49, 41)": "0", "(49, 42)": "0", "(48, 42)": "0", "(47, 42)": "0", "(46, 42)": "0", "(45, 42)": "0", "(45, 43)": "0", "(44, 43)": "0", "(43, 43)": "0", "(42, 43)": "0", "(41, 43)": "0", "(40, 43)": "0", "(39, 43)": "0", "(38, 43)": "0", "(37, 43)": "1", "(0, 42)": "0", "(1, 42)": "0", "(2, 42)": "0", "(3, 42)": "0", "(4, 42)": "0", "(5, 42)": "0", "(6, 42)": "0", "(7, 42)": "1", "(8, 42)": "0", "(9, 42)": "0", "(10, 42)": "0", "(11, 42)": "0", "(12, 42)": "0", "(13, 42)": "0", "(14, 42)": "0", "(15, 42)": "0", "(16, 42)": "0", "(17, 42)": "0", "(18, 42)": "0", "(19, 42)": "0", "(20, 42)": "0", "(21, 42)": "0", "(22, 42)": "0", "(23, 42)": "0", "(24, 42)": "0", "(25, 42)": "0", "(26, 42)": "0", "(27, 42)": "0", "(28, 42)": "0", "(29, 42)": "0", "(30, 42)": "0", "(31, 42)": "1", "(32, 42)": "0", "(33, 42)": "0", "(34, 42)": "0", "(35, 42)": "0", "(36, 42)": "0", "(37, 42)": "0", "(38, 42)": "0", "(39, 42)": "0", "(40, 42)": "0", "(41, 42)": "0", "(42, 42)": "0", "(32, 43)": "0", "(31, 43)": "0", "(30, 43)": "0", "(29, 43)": "1", "(0, 43)": "0", "(1, 43)": "0", "(2, 43)": "0", "(3, 43)": "0", "(4, 43)": "0", "(5, 43)": "0", "(6, 43)": "1", "(5, 44)": "0", "(6, 44)": "0", "(7, 44)": "0", "(7, 43)": "0", "(8, 43)": "0", "(9, 43)": "0", "(10, 43)": "0", "(11, 43)": "0", "(12, 43)": "1", "(13, 43)": "0", "(14, 43)": "0", "(15, 43)": "0", "(16, 43)": "0", "(17, 43)": "0", "(18, 43)": "0", "(19, 43)": "0", "(20, 43)": "0", "(21, 43)": "1", "(22, 43)": "0", "(23, 43)": "1", "(24, 43)": "0", "(25, 43)": "0", "(26, 43)": "0", "(27, 43)": "1", "(28, 43)": "0", "(33, 43)": "0", "(34, 43)": "1", "(35, 43)": "0", "(36, 43)": "0", "(46, 43)": "0", "(47, 43)": "0", "(48, 43)": "0", "(49, 43)": "0", "(38, 44)": "0", "(37, 44)": "0", "(36, 44)": "0", "(35, 44)": "0", "(34, 44)": "0", "(33, 44)": "0", "(32, 44)": "0", "(31, 44)": "0", "(30, 44)": "0", "(29, 44)": "0", "(28, 44)": "0", "(27, 44)": "0", "(26, 44)": "1", "(0, 44)": "1", "(1, 44)": "0", "(2, 44)": "0", "(3, 44)": "0", "(4, 44)": "0", "(8, 44)": "0", "(9, 44)": "0", "(10, 44)": "0", "(11, 44)": "0", "(12, 44)": "0", "(13, 44)": "0", "(14, 44)": "0", "(15, 44)": "0", "(16, 44)": "0", "(17, 44)": "0", "(18, 44)": "1", "(19, 44)": "0", "(20, 44)": "0", "(21, 44)": "0", "(22, 44)": "0", "(23, 44)": "0", "(24, 44)": "0", "(25, 44)": "0", "(25, 45)": "0", "(26, 45)": "0", "(27, 45)": "0", "(39, 44)": "0", "(40, 44)": "0", "(41, 44)": "0", "(42, 44)": "0", "(43, 44)": "0", "(44, 44)": "0", "(45, 44)": "0", "(46, 44)": "1", "(47, 44)": "0", "(48, 44)": "0", "(49, 44)": "0", "(47, 45)": "0", "(46, 45)": "0", "(45, 45)": "0", "(44, 45)": "0", "(43, 45)": "0", "(42, 45)": "1", "(1, 45)": "0", "(0, 45)": "1", "(2, 45)": "1", "(3, 45)": "0", "(4, 45)": "0", "(5, 45)": "1", "(6, 45)": "0", "(7, 45)": "0", "(8, 45)": "0", "(9, 45)": "0", "(10, 45)": "0", "(11, 45)": "0", "(12, 45)": "0", "(13, 45)": "0", "(14, 45)": "0", "(15, 45)": "0", "(16, 45)": "0", "(17, 45)": "0", "(18, 45)": "1", "(19, 45)": "0", "(20, 45)": "0", "(21, 45)": "0", "(22, 45)": "0", "(23, 45)": "0", "(24, 45)": "1", "(28, 45)": "0", "(29, 45)": "0", "(30, 45)": "0", "(31, 45)": "0", "(32, 45)": "0", "(33, 45)": "0", "(34, 45)": "0", "(35, 45)": "0", "(36, 45)": "0", "(37, 45)": "1", "(38, 45)": "0", "(39, 45)": "1", "(40, 45)": "0", "(41, 45)": "0", "(48, 45)": "0", "(49, 45)": "0", "(43, 46)": "0", "(42, 46)": "0", "(41, 46)": "0", "(40, 46)": "1", "(1, 46)": "0", "(0, 46)": "0", "(2, 46)": "0", "(3, 46)": "0", "(4, 46)": "0", "(5, 46)": "0", "(6, 46)": "0", "(7, 46)": "0", "(8, 46)": "0", "(9, 46)": "0", "(10, 46)": "0", "(11, 46)": "0", "(12, 46)": "0", "(13, 46)": "0", "(14, 46)": "0", "(15, 46)": "1", "(16, 46)": "0", "(17, 46)": "0", "(18, 46)": "0", "(19, 46)": "1", "(20, 46)": "0", "(21, 46)": "0", "(22, 46)": "0", "(23, 46)": "1", "(22, 47)": "0", "(23, 47)": "0", "(24, 47)": "0", "(24, 46)": "0", "(25, 46)": "0", "(26, 46)": "0", "(27, 46)": "0", "(28, 46)": "0", "(29, 46)": "0", "(30, 46)": "0", "(31, 46)": "0", "(32, 46)": "0", "(33, 46)": "0", "(34, 46)": "0", "(35, 46)": "0", "(36, 46)": "0", "(37, 46)": "0", "(38, 46)": "1", "(37, 47)": "0", "(38, 47)": "0", "(39, 47)": "0", "(39, 46)": "1", "(44, 46)": "0", "(45, 46)": "0", "(46, 46)": "0", "(47, 46)": "0", "(48, 46)": "0", "(49, 46)": "0", "(41, 47)": "0", "(40, 47)": "1", "(0, 47)": "0", "(1, 47)": "1", "(2, 47)": "0", "(3, 47)": "0", "(4, 47)": "0", "(5, 47)": "0", "(6, 47)": "0", "(7, 47)": "0", "(8, 47)": "0", "(9, 47)": "1", "(10, 47)": "0", "(11, 47)": "0", "(12, 47)": "0", "(13, 47)": "0", "(14, 47)": "0", "(15, 47)": "0", "(16, 47)": "0", "(17, 47)": "0", "(18, 47)": "0", "(19, 47)": "1", "(20, 47)": "0", "(21, 47)": "0", "(25, 47)": "0", "(26, 47)": "0", "(27, 47)": "0", "(28, 47)": "0", "(29, 47)": "0", "(30, 47)": "0", "(31, 47)": "0", "(32, 47)": "0", "(33, 47)": "1", "(34, 47)": "1", "(35, 47)": "0", "(36, 47)": "0", "(39, 48)": "0", "(40, 48)": "0", "(41, 48)": "0", "(42, 47)": "1", "(43, 47)": "0", "(44, 47)": "0", "(45, 47)": "0", "(46, 47)": "0", "(47, 47)": "0", "(48, 47)": "0", "(49, 47)": "1", "(0, 48)": "0", "(1, 48)": "0", "(2, 48)": "0", "(3, 48)": "0", "(4, 48)": "0", "(5, 48)": "1", "(6, 48)": "0", "(7, 48)": "0", "(8, 48)": "0", "(9, 48)": "0", "(10, 48)": "0", "(11, 48)": "0", "(12, 48)": "0", "(13, 48)": "0", "(14, 48)": "0", "(15, 48)": "0", "(16, 48)": "0", "(17, 48)": "0", "(18, 48)": "0", "(19, 48)": "0", "(20, 48)": "0", "(21, 48)": "0", "(22, 48)": "0", "(23, 48)": "0", "(24, 48)": "0", "(25, 48)": "1", "(26, 48)": "0", "(27, 48)": "0", "(28, 48)": "0", "(29, 48)": "0", "(30, 48)": "0", "(31, 48)": "0", "(32, 48)": "0", "(33, 48)": "0", "(34, 48)": "0", "(35, 48)": "0", "(36, 48)": "0", "(37, 48)": "0", "(38, 48)": "0", "(42, 48)": "0", "(43, 48)": "1", "(44, 48)": "0", "(45, 48)": "0", "(46, 48)": "0", "(47, 48)": "0", "(48, 48)": "0", "(49, 48)": "0", "(44, 49)": "0", "(43, 49)": "0", "(42, 49)": "0", "(41, 49)": "0", "(40, 49)": "0", "(39, 49)": "0", "(38, 49)": "0", "(37, 49)": "0", "(36, 49)": "0", "(35, 49)": "1", "(0, 49)": "0", "(1, 49)": "0", "(2, 49)": "0", "(3, 49)": "1", "(4, 49)": "0", "(5, 49)": "0", "(6, 49)": "0", "(7, 49)": "0", "(8, 49)": "0", "(9, 49)": "0", "(10, 49)": "0", "(11, 49)": "0", "(12, 49)": "0", "(13, 49)": "0", "(14, 49)": "0", "(15, 49)": "1", "(16, 49)": "0", "(17, 49)": "1", "(18, 49)": "0", "(19, 49)": "0", "(20, 49)": "1", "(21, 49)": "0", "(22, 49)": "0", "(23, 49)": "0", "(24, 49)": "1", "(26, 49)": "0", "(25, 49)": "0", "(27, 49)": "0", "(28, 49)": "0", "(29, 49)": "0", "(30, 49)": "0", "(31, 49)": "0", "(32, 49)": "0", "(33, 49)": "0", "(34, 49)": "0", "(45, 49)": "0", "(46, 49)": "0", "(47, 49)": "1", "(48, 49)": "0", "(49, 49)": "0"}
hxp{and_n0w_try_t0_c4tch_m3_w1th0ut_dy1ng}
import sys
import random
import time
class FlagChar:
def __init__(self, char, x, y, width, height):
self.char = char
self.x = x
self.y = y
self.width, self.height = width, height
random.seed(int(time.time()))
def move(self, fields):
"""
fields: (0,1,2,3)
1
0 current 2
3
True = something is there
"""
# 10 tries, else do not move
for _ in range(10):
s = random.randint(0,3)
if s == 1 and (self.y <= 0 or fields[1]):
continue
if s == 0 and (self.x <= 0 or fields[0]):
continue
if s == 2 and (self.x >= (self.width - 1) or fields[2]):
continue
if s == 3 and (self.y >= (self.height - 1) or fields[3]):
continue
if s == 0:
self.x -= 1
if s == 1:
self.y -= 1
if s == 2:
self.x += 1
if s == 3:
self.y += 1
# we moved, break loop
break
def catch(self, x, y):
if self.x == x and self.y == y:
return self.char
else:
return None
# Sample code from https://www.redblobgames.com/pathfinding/a-star/
# Copyright 2014 Red Blob Games <redblobgames@gmail.com>
#
# Feel free to use this code in your own projects, including commercial projects
# License: Apache v2.0 <http://www.apache.org/licenses/LICENSE-2.0.html>
class SimpleGraph:
def __init__(self):
self.edges = {}
def neighbors(self, id):
return self.edges[id]
example_graph = SimpleGraph()
example_graph.edges = {
'A': ['B'],
'B': ['A', 'C', 'D'],
'C': ['A'],
'D': ['E', 'A'],
'E': ['B']
}
import collections
class Queue:
def __init__(self):
self.elements = collections.deque()
def empty(self):
return len(self.elements) == 0
def put(self, x):
self.elements.append(x)
def get(self):
return self.elements.popleft()
# utility functions for dealing with square grids
def from_id_width(id, width):
return (id % width, id // width)
def draw_tile(graph, id, style, width):
r = "."
if 'number' in style and id in style['number']: r = "%d" % style['number'][id]
if 'point_to' in style and style['point_to'].get(id, None) is not None:
(x1, y1) = id
(x2, y2) = style['point_to'][id]
if x2 == x1 + 1: r = ">"
if x2 == x1 - 1: r = "<"
if y2 == y1 + 1: r = "v"
if y2 == y1 - 1: r = "^"
if 'start' in style and id == style['start']: r = "A"
if 'goal' in style and id == style['goal']: r = "Z"
if 'path' in style and id in style['path']: r = "@"
if id in graph.walls: r = "#" * width
return r
def draw_grid(graph, width=2, **style):
for y in range(graph.height):
for x in range(graph.width):
print("%%-%ds" % width % draw_tile(graph, (x, y), style, width), end="")
print()
# data from main article
DIAGRAM1_WALLS = [from_id_width(id, width=30) for id in [21,22,51,52,81,82,93,94,111,112,123,124,133,134,141,142,153,154,163,164,171,172,173,174,175,183,184,193,194,201,202,203,204,205,213,214,223,224,243,244,253,254,273,274,283,284,303,304,313,314,333,334,343,344,373,374,403,404,433,434]]
class SquareGrid:
def __init__(self, width, height):
self.width = width
self.height = height
self.walls = []
def in_bounds(self, id):
(x, y) = id
return 0 <= x < self.width and 0 <= y < self.height
def passable(self, id):
return id not in self.walls
def neighbors(self, id):
(x, y) = id
results = [(x+1, y), (x, y-1), (x-1, y), (x, y+1)]
if (x + y) % 2 == 0: results.reverse() # aesthetics
results = filter(self.in_bounds, results)
results = filter(self.passable, results)
return results
class GridWithWeights(SquareGrid):
def __init__(self, width, height):
super().__init__(width, height)
self.weights = {}
def cost(self, from_node, to_node):
return self.weights.get(to_node, 1)
diagram4 = GridWithWeights(10, 10)
diagram4.walls = [(1, 7), (1, 8), (2, 7), (2, 8), (3, 7), (3, 8)]
diagram4.weights = {loc: 5 for loc in [(3, 4), (3, 5), (4, 1), (4, 2),
(4, 3), (4, 4), (4, 5), (4, 6),
(4, 7), (4, 8), (5, 1), (5, 2),
(5, 3), (5, 4), (5, 5), (5, 6),
(5, 7), (5, 8), (6, 2), (6, 3),
(6, 4), (6, 5), (6, 6), (6, 7),
(7, 3), (7, 4), (7, 5)]}
import heapq
class PriorityQueue:
def __init__(self):
self.elements = []
def empty(self):
return len(self.elements) == 0
def put(self, item, priority):
heapq.heappush(self.elements, (priority, item))
def get(self):
return heapq.heappop(self.elements)[1]
def dijkstra_search(graph, start, goal):
frontier = PriorityQueue()
frontier.put(start, 0)
came_from = {}
cost_so_far = {}
came_from[start] = None
cost_so_far[start] = 0
while not frontier.empty():
current = frontier.get()
if current == goal:
break
for next in graph.neighbors(current):
new_cost = cost_so_far[current] + graph.cost(current, next)
if next not in cost_so_far or new_cost < cost_so_far[next]:
cost_so_far[next] = new_cost
priority = new_cost
frontier.put(next, priority)
came_from[next] = current
return came_from, cost_so_far
# thanks to @m1sp <Jaiden Mispy> for this simpler version of
# reconstruct_path that doesn't have duplicate entries
def reconstruct_path(came_from, start, goal):
current = goal
path = []
while current != start:
path.append(current)
current = came_from[current]
path.append(start) # optional
path.reverse() # optional
return path
def heuristic(a, b):
(x1, y1) = a
(x2, y2) = b
return abs(x1 - x2) + abs(y1 - y2)
def a_star_search(graph, start, goal):
frontier = PriorityQueue()
frontier.put(start, 0)
came_from = {}
cost_so_far = {}
came_from[start] = None
cost_so_far[start] = 0
while not frontier.empty():
current = frontier.get()
if current == goal:
break
for next in graph.neighbors(current):
new_cost = cost_so_far[current] + graph.cost(current, next)
if next not in cost_so_far or new_cost < cost_so_far[next]:
cost_so_far[next] = new_cost
priority = new_cost + heuristic(goal, next)
frontier.put(next, priority)
came_from[next] = current
return came_from, cost_so_far
#!/usr/bin/env python3
import time
from flag_char import FlagChar
width, height = 50, 50
mapp = []
flagstr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
flagstr = flagstr[:42]
player_pos = (0, 0)
cnt = 0
updated_map = []
NOTHING = "0"
PIT = "1"
FLAG_CHAR = "2"
def write_map(actual_map):
mapp = [NOTHING]*(width*height+1)
for y in range(50):
for x in range(50):
pos = (x,y)
if pos in actual_map and actual_map[pos] == PIT:
mapp[index(x, y)+1] = PIT
else:
mapp[index(x, y)+1] = NOTHING
with open("map", "w+") as f:
#f.write("0")
for i in range(width * height):
if i == 0:
continue
if (i % width - 1) == 0 and i > 1:
f.write("\n")
f.write(mapp[i])
f.write("0")
def initialize_map(actual_map):
global mapp, flag, flagstr, player_pos, cnt, updated_map
flag = []
mapp = [NOTHING]*(width*height)
for y in range(50):
for x in range(50):
pos = (x,y)
if pos in actual_map and actual_map[pos] == PIT:
mapp[index(x, y)] = PIT
else:
mapp[index(x, y)] = NOTHING
#with open("flag.txt", "r") as f:
tmp = flagstr#f.read().strip()
for x, i in enumerate(tmp):
flag.append(FlagChar(i, (width // 2) - (len(tmp) // 2) + x, height // 2, width, height))
print("FLAG LENGTH:")
print(len(flag))
player_pos = (0, 0)
cnt = 0
updated_map = mapp.copy()
# build map with current flag positions
for i in flag:
updated_map[index(i.x, i.y)] = FLAG_CHAR
flag = []
def index(x,y):
return x + y * width
def get_neighbor_values(m, x, y):
"""
return (west, north, east, south)
"""
w = map_pos(m, x - 1, y)
n = map_pos(m, x, y - 1)
e = map_pos(m, x + 1, y)
s = map_pos(m, x, y + 1)
return (w, n, e, s)
def map_pos(m, x, y):
if x < 0 or x > width - 1 or y < 0 or y > height - 1:
return "wall"
return m[index(x, y)]
def flag_char_to_index(char):
global flagstr
return flagstr.index(char)
def flag_char_for_pos(pos):
global flag
x, y = pos
for i in flag:
if i.x == x and i.y == y:
return i.char
return None
def move_flag():
global flag, updated_map, player_pos
px, py = player_pos
updated_map[index(px, py)] = "3"
for i in flag:
neighbors = get_neighbor_values(updated_map, i.x, i.y)
old_idx = index(i.x, i.y)
i.move((neighbors[0] != NOTHING,
neighbors[1] != NOTHING,
neighbors[2] != NOTHING,
neighbors[3] != NOTHING))
updated_map[old_idx] = NOTHING
updated_map[index(i.x, i.y)] = FLAG_CHAR
def check_catch():
global player_pos, flag
for f in flag:
caught = f.catch(player_pos[0], player_pos[1])
if caught:
flag.remove(f)
def tick_game(next_position):
global updated_map, flag
global cnt, player_pos
slow = 2
player_pos = next_position
check_catch()
cnt += 1
if cnt % slow == 0:
move_flag()
updated_map = mapp.copy()
# build map with current flag positions
for i in flag:
updated_map[index(i.x, i.y)] = FLAG_CHAR
def game_loop(flag_idx):
global updated_map
cnt = 0
slow = 2
locations = {}
while cnt < 40:
updated_map = mapp.copy()
# build map with current flag positions
for i in flag:
updated_map[index(i.x, i.y)] = FLAG_CHAR
cnt += 1
if cnt % slow == 0:
move_flag()
f = flag[flag_idx]
if (cnt > 10):
locations[cnt // 2] = (f.x, f.y)
return locations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment