Ejemplo n.º 1
0
 def create_player(self, player_type, symbol):
     if player_type == 'user':
         return User(symbol, self.board)
     elif player_type == 'easy':
         return Easy(symbol, self.board)
     elif player_type == 'medium':
         return Medium(symbol, self.board)
     elif player_type == 'hard':
         return Hard(symbol, self.board)
Ejemplo n.º 2
0
def gameMaker(level):
    if level == 1:
        return Dumb()
    if level == 2:
        return Medium()
    if level == 3:
        return Smart()
    else:
        raise Exception('Level inválido')
Ejemplo n.º 3
0
 def init(self) -> None:
     self.reg = Radio.RadioRegister()
     self.sim.map_peripheral(self.pid, self.reg)
     self.medium: Medium = self.sim.context.get('medium', Medium())
     self.rcvr = LoraMsgReceiver(self.sim.runtime,
                                 self.medium,
                                 cb=self.rxdone)
     self.xmtr = LoraMsgTransmitter(self.sim.runtime,
                                    self.medium,
                                    cb=self.txdone)
def main():
    cord = Medium(100)
    pc1 = Device(cord, 4)
    pc1.add_message('1' * 100)
    pc1.add_message('1' * 100)
    pc1.add_message('1' * 100)
    pc2 = Device(cord, 70)
    pc2.add_message('1' * 100)
    pc2.add_message('1' * 100)
    pc2.add_message('1' * 100)

    for i in range(1000):
        print('iteration {}: '.format(i + 1), end='')
        cord.display()
        pc2.work()
        pc1.work()
        cord.propagate()
Ejemplo n.º 5
0
            f.write(self.buffer)
        success(
            f"writing to {self.filename} with {self.buffer} successfully after TIMEOUT"
        )
        status("see you.")
        os._exit(1)
        # exit(0)

    def timeout_routine(self):
        while True:
            time.sleep(self.max_timeout)
            if self.received:
                self.received = False
                continue
            else:
                self.write_buffer_to_file()


try:
    status("start")

    medium = Medium(as_sender=False,
                    should_emulate_timeout=True,
                    emulate_timeout_fact=0.1,
                    max_timeout=10)
    receiver = Receiver(medium, "received_result.txt")
    receiver.medium.set_role(receiver)
    receiver.medium.run()
except Exception:
    os._exit(1)
Ejemplo n.º 6
0
#
#
#     for line, data in zip(lines, dataLines):
#         # NOTE: there is no .set_data() for 3 dim data...
#         line.set_data(data[0:2, :num])
#         line.set_3d_properties(data[2, :num])


naccept = 0
nreject = 0
with open('first_setup.json') as json_file:
    input_json = json.load(json_file)

    nbofiterations = 300

    gliadin_medium = Medium(input_json['sequencea'], input_json['aminoacid'])
    mediumSize = gliadin_medium.getNbOfGliadin()
    #water

    old_energy = gliadin_medium.getEnergy()
    positionsHistory = pd.DataFrame()
    i = 1
    while i in range(nbofiterations):
        print("Iteration "+str(i))
        # Pick a random atom (random.randint(x,y) picks a random
        # integer between x and y, including x and y)

        selectedGliadin = rn.randint(0,mediumSize)-1;
        gliadin = gliadin_medium.getGliadin(selectedGliadin)
        print("start posities")
        print(gliadin.getPositions())
Ejemplo n.º 7
0
pygame.mixer.music.load('01 BGM #01.mp3')
pygame.mixer.music.play(-1)

# size of the grid
width = 16
height = 16
margin = 5
text = pygame.font.SysFont('Comic Sans MS', 10, True)
lev = "Game on"

num_bombs = 40
time_count = []
grid = []

easy = [Easy()]
medium = [Medium()]
difficult = [Difficult()]
level = [lev]


def ModePressed():
    pass


def delObjects():
    global grid
    global time_count
    global mode
    global lev
    global p_pressed
    p_pressed = 0