Ejemplo n.º 1
0
import Day09_Computer as COMPUTER

program = COMPUTER.getprogram('Day09/Day09_Input.txt')

def main():
    return str(COMPUTER.start(program, [1])[0])

if __name__ == '__main__':
    print main()
Ejemplo n.º 2
0
import sys, os
sys.path.append(
    (os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +
     '/Day09/'))

import Day09_Computer as COMPUTER

import Queue
from threading import Thread
from os import system
from getkey import getkey, keys

program = COMPUTER.getprogram('Day13/Day13_Input.txt')


class screen():
    def __init__(self):
        self.pixels = [[0]]

    def writetoscreen(self):
        text = ''
        for r in self.pixels:
            text += self.writerow(r) + '\n'
        system('cls')
        print text

    def writerow(self, row):
        line = ''
        for p in row:
            if p == 0:
                line += ' '
Ejemplo n.º 3
0
import sys, os, itertools

sys.path.append(
    (os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +
     '/Day09/'))

import Queue
from threading import Thread

import Day09_Computer as COMPUTER
program = COMPUTER.getprogram('Day25/Day25_Input.txt')

layout = {}
routetopressuresensitivefloor = []
banneditems = [
]  #['escape pod', 'giant electromagnet', 'photons', 'infinite loop', 'molten lava']
items = []
lastitem = ''
alive = True


def writetoscreen(output):
    text = ''
    for c in output:
        text += unichr(c)
    print text
    return text


def tounicodelist(string):
    unicodelist = []
Ejemplo n.º 4
0
import sys, os

sys.path.append(
    (os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +
     '/Day09/'))

import Day09_Computer as COMPUTER
program = COMPUTER.getprogram('Day21/Day21_Input.txt')


class instructions():
    def __init__(self):
        self.myinstruction = []

    def texttoinstruction(self, text):
        instruction = []
        for c in text:
            instruction.append(ord(c))
        instruction.append(10)  #\n
        return instruction

    def add(self, text):
        self.myinstruction.extend(self.texttoinstruction(text))

    def getinstruction(self):
        instruction = self.myinstruction
        instruction.extend(self.texttoinstruction('RUN'))
        return instruction


def main():
Ejemplo n.º 5
0
import sys, os

sys.path.append((os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
+ '/Day09/'))

import Day09_Computer as COMPUTER

import Queue
from threading import Thread

program = COMPUTER.getprogram('Day17/Day17_Input.txt')

class screen():
    def __init__(self, myrobot):
        self.pixels = [[]]
        self.robot = myrobot

    def outputtopixels(self, output):
        self.pixels = []
        width = output.index(10)
        for row in (output[x:x + width] for x in range(0, len(output) - 1, width + 1)):
            self.pixels.append(row)
            if row.count(94) != 0:
                self.robot.pos = [len(self.pixels) - 1, row.index(94)]

    def writetoscreen(self, input, cls = False):
        text = ''
        for c in input:
            text += str(unichr(c))
        if cls:
            os.system('cls')