Пример #1
0
def init():
	print(welcome_message)
	
	# Get player/s info
	num_human = num_ai = 0
	num_players = int(raw_input("How many players? (Human and AI): "))
	if num_players >= 1:
		num_human = int(raw_input("How many human players?: ".format(num_players)))
	if not num_players == 1:
		num_ai = num_players - num_human
	
	# Play one game unless no human players
	num_games = 1
	if num_human == 0:
		num_games = int(raw_input("How many simulations do you want to run?: "))

	# Init human players
	for p in range(0, num_human):
		player = Player(raw_input("Enter player name: "), False)
		players.append(player)
	# Init AI players
	for p in range(num_human, num_players):
		player = Player()
		player.gen_name()
		players.append(player)
	
	return num_games
Пример #2
0
def parsePlayersFromRawString(data):
  only_players =  SoupStrainer(class_="playerlist")
  soup = BeautifulSoup(data,"html.parser", parse_only=only_players)
  players = soup.find_all("div",class_="playerlist")
  parsed_player_list = []
  # Tracer()()
  for player in players:
    p_name = player.attrs['a'].encode('ascii', 'ignore')
    p_id = player.attrs['value'].encode('ascii', 'ignore')
    p_price = player.attrs['p'].encode('ascii', 'ignore')
    p_team = player.find(class_="teamsorting").text.encode('ascii', 'ignore')
    p_isoverseas = bool(player.find(class_="overseasimg"))
    p_isuncapped = bool( player.find(class_="uncappedimg"))
    skills = [False]*5;
    for skill in player.attrs['d']:
      skills[int(skill)] = True
    p_iskeeper = skills[1]
    p_isallrounder = skills[2]
    p_isbowler = skills[3]
    p_isbatsman = skills[4]
    parsed_player = Player(p_name, p_id, p_team, p_price)
    parsed_player.setBitValues(p_isoverseas, p_isuncapped, p_iskeeper, p_isallrounder, p_isbowler, p_isbatsman)
    print parsed_player
    parsed_player_list.append(parsed_player)
  return parsed_player_list
Пример #3
0
def player_setup():
    """Set up the player, initialize the rooms and their contents."""
    print('--------------------------------------------------------------------------------')
    print('')
    print('What is your name? [Defaults to "Zelda"]')
    name = input()
    if not name:
        name = 'Zelda'
    elif name == 'admin':
        print("Welcome supreme leader, we have gifts for you.")
    print('Strange name, that. But, as you wish, {name}.'.format(name=name))
    print('')
    print('What is your symbol? [Defaults to 👸 ]')
    emoji = input()
    if not emoji:
        emoji = '👸'
    print('Fascinating. Kids today...')
    print('')
    player = Player(name, emoji)
    if player.name == 'admin':
        super_dagger_of_awesomeness = Dagger("I am a super dagger... wait for it ... of awesomeness.")
        player.possessions = [super_dagger_of_awesomeness]
    print('I dub thee, {description}'.format(description=player.description))
    print('Onwards!')
    print('')

    time.sleep(1)  # add a little drama...
    return player
Пример #4
0
def waitforclients():
    while True:
        c, addr = server.accept()
        print("Got connection from", addr)

        newplayer = Player(connection = c)
        newplayer.connection.send("Connection Established".encode('ascii'))
        newplayer.name = newplayer.connection.recv(1024).decode('ascii')
        players.append(newplayer)

        lock.acquire()
        print(newplayer.name, "has connected to the server.")
        lock.release()

        rbuffer[newplayer] = []
        sbuffer[newplayer] = []

        rbuffermanager = threading.Thread(target = fillrbuffer, args = (newplayer,))
        rbuffermanager.daemon = True
        rbuffermanager.start()

        sbuffermanager = threading.Thread(target = sendsbuffer, args = (newplayer,))
        sbuffermanager.daemon = True
        sbuffermanager.start()

        updatemanager = threading.Thread(target=waitforupdate, args=(newplayer,))
        updatemanager.daemon = True
        threads.append(updatemanager)
        updatemanager.start()
Пример #5
0
 def move(self, x, galaxians):
     if self.active:
         # updates the sprite and hit rectangle
         Player.move(self)
         
         state = States()
         for f in range(len(galaxians)):
             if self.hitArea.colliderect(galaxians[f].hitArea):
                 x_offset = self.hitArea[0] - galaxians[f].hitArea[0]
                 y_offset = self.hitArea[1] - galaxians[f].hitArea[1]
                 
                 if galaxians[f].getMask().overlap(self.mask, (x_offset, y_offset)):
                     galaxians[f].destroyed = True
                     if galaxians[f].state == state.FORMATION_DIVING and galaxians[f].number != 17 and galaxians[f].number != 33:
                         self.reduceDivingArray(galaxians, galaxians[f].number)
                     self.active = False
                     # no BREAK - let it run through array of galaxians,
                     # because a laser can destroy multiple galaxians
         
         # only move if active other wise reinitialise back to rocket ship position
         if self.active:
             self.y -= 12 * self.active
             if self.y < 30:
                 self.active = False
                 self.reinit(x)
         else:
             self.reinit(x)
         
         
     else:
         self.reinit(x)
Пример #6
0
    def do_action(self):
        # random.seed(self.random_seed)
        self.env["player"] = []
        self.env["map"] = Map()
        self.env["food"] = []
        self.env["timer"] = 0
        self.env["skill_cool_time"] = 0
        self.env['bgm'] = pygame.mixer.Channel(0)
        self.env['bgm'].play(pygame.mixer.Sound('Sound/bgm.wav'))
        self.env['gamec'].set_pause_event(EventBeforePause(self.env['bgm']), EventAfterPause(self.env['bgm']))
        self.env["crash"] = []

        # setup charater
        start_pos = [ ( 1 , 1 ) , ( 1 , 9 ) , ( 17 , 1 ) , ( 17 , 9 ) ]
        for i in range( 4 ):
            p = Player()
            p.index = i
            ( tx , ty ) = start_pos[ i ]
            p.pos = (tx, ty)
            p.pos_draw = (tx, ty)
            self.getAi( self.ailist , p )
            self.env["player"].append(p)

        self.env["pyQUIT"] = False
        self.env["uic"].add_event( Event.io_event.EventPyEvent(self.env, self.priority) )
        self.env["gamec"].add_event( EventTimer(self.env, self.priority) )
        self.env["uic"].add_event( Event.ui_event.EventDrawInit(self.env, self.priority + 1) )
        self.env["gamec"].add_event( EventMove(self.env, self.priority + 2) )
        self.env["gamec"].add_event( EventCheckCrash(self.env, self.priority + 3) )
        self.env["gamec"].add_event( EventCheckSamePlace(self.env, self.priority + 4) )
        self.env["gamec"].add_event( EventEatFood(self.env, self.priority + 5) )
        self.env["gamec"].add_event( EventAddFood(self.env, self.priority + 6) )
        self.env["gamec"].add_event( EventDecide(self.env, self.priority + 7) )
Пример #7
0
 def __init__(self, image, x, y, game):
     self.name = "Tasmanian Devil"
     
     self.init_image = image_util.load_image("tasmanian.png")
     self.init_x = x
     self.init_y = y
     
     image = image_util.load_image("tasmanian.png")
     attack_image = image_util.load_image("tasmanian_attack.png")
     
     unselected_images = image_util.load_sliced_sprites(32, 32, "tasmanian_unselected.png")
     
     rect = image.get_rect()
     rect.left = 5
     rect.top = 5
     rect.width = rect.width-10
     rect.height = rect.height-10
     speed = 3
     
     attack_length = 250
     attack_delay = 200
     
     Player.__init__(self, game, x, y, image, attack_image, unselected_images, rect, speed, attack_length, attack_delay)
     
     self.canDriveCar = False
Пример #8
0
    def load_map(self, filename):
        self.data = pytmx.TiledMap(filename)
        self.width = self.data.width * self.data.tilewidth
        self.height = self.data.height * self.data.tileheight

        for layer in self.data.layers:
            if layer.name.upper() == "PLAYER":
                p1 = layer[0]
                p2 = layer[1]
                self.player1 = Player(p1.x, p1.y, p1.width, p1.height, ASSET.player1, PLAYER.one)
                self.player2 = Player(p2.x, p2.y, p2.width, p2.height, ASSET.player2, PLAYER.two)                

            elif layer.name.upper() == "BLOCKS":
                self.blocks = layer
            elif layer.name.upper() == "DATA":
                self.datafragments = layer
            elif layer.name.upper() == "ENEMIES":
                self.enemies = layer
            elif layer.name.upper() == "SAWS":
                self.saws = layer
            elif layer.name.upper() == "SAW_BOUNDS":
                self.bounds = layer
            elif layer.name.upper() == "DATASPAWNER":
                self.dataspawner = layer
            elif layer.name.upper() == "PORTALS":
                self.portals = layer
Пример #9
0
def runGame(tiles,dispSurf):

    # index of tile we're currently drawing
    curTile = 1
    p = Player()

    #set cursor initial position to middle
    #on initialization the cursor's at map 0,0, the top corne
    for i in range(0, E_VARS().MAPWIDTH-1):
        p.move(K_DOWN)

    while True:

        curTile = handleEvents(p,tiles,curTile)
      
        #draw background, placed tiles, and static grid 
        dispSurf.fill(COLORS.BGCOLOR)
        fillTiles(tiles,p,dispSurf)
        drawLowerGrid(dispSurf)

        # draw currently selected tile type at cursor's loc
        image = tiles[curTile].pic
        drawWithOffset(image,(p.coords[STRINGS.X], p.coords[STRINGS.Y]),(OFFSET[0],OFFSET[1]+(p.level * E_VARS().CELLRISE)),dispSurf)

        #make tile grid
        drawUpperGrid(p,dispSurf)

        pygame.display.update()
        FPSCLOCK.tick(E_VARS().FPS)
        print "FRAMERATE:",FPSCLOCK.get_fps()
Пример #10
0
    def test_place_bomb(self):
        game_display = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
        arena = Arena()
        player = Player((112, 0), arena)
        player.place_bomb()

        self.assertEqual(player.placed_bomb, 1)
Пример #11
0
    def test_set_player_tile_position(self):
        game_display = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
        arena = Arena()
        player = Player((0, 0), arena)
        player.set_player_tile_position((90, 45))

        self.assertEqual(player.position(), (67, 0))
Пример #12
0
    def test_move_down(self):
        game_display = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
        arena = Arena()
        player = Player((14, 80), arena)
        player.move_down()

        self.assertEqual(player.position(), (14, 83))
Пример #13
0
    def test_die(self):
        game_display = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
        arena = Arena()
        player = Player((112, 0), arena)
        player.die()

        self.assertEqual(player.is_alive(), False)
Пример #14
0
class Level(object):

    def __init__(self, size):
        self.bounds = Rect((0,0), size)
        self.bg = image.load("background.bmp")

    def background(self, surf):
        tw, th = self.bg.get_size()
        sw, sh = surf.get_size()

    def restart(self):
        self.player = Player()
        self.player.rect.center = self.bounds.center


        # start the background music
      
    def update(self, dt):
        self.player.update(dt)
     
        # lock player in bounds
        self.player.rect.clamp_ip(self.bounds)

        # collide player with coins
       # if spritecollide(self.player, self.cookies, True):
           # self.coin_sfx.stop()#
           # self.coin_sfx.play()#
        
    def draw(self, surf):
        surf.blit(self.player.image, self.player.rect)
Пример #15
0
    def __init__(self, game):
        super(MultiPlayerState, self).__init__(game)
        self.listen_keys = (pygame.K_ESCAPE,)
        self.player1 = Player(game.input, PLAYER1, Pad(Vector2(GAME_WIDTH - PAD_DISTANCE - PAD_WIDTH, GAME_HEIGHT/2 - PAD_HEIGHT/2), dash_direction=PLAYER1_DASH), MULTIPLAYER_LIVES)
        self.player2 = Player(game.input, PLAYER2, Pad(Vector2(0 + PAD_DISTANCE, GAME_HEIGHT/2 - PAD_HEIGHT/2), dash_direction=PLAYER2_DASH), MULTIPLAYER_LIVES)
        self.balls = []
        self.powerups = []
        self.time_since_powerup_check = 0
        self.winner = None
        self.instructions = True

        # Text rendering
        self.font = None
        self.font_renderer = None

        # Player 1 Text
        self.player1_lives_label_surface = None
        self.player1_lives_surface = None
        self.player1_charge_label_surface = None
        self.player1_charge_surface = None

        # Player 2 Text
        self.player2_lives_label_surface = None
        self.player2_lives_surface = None
        self.player2_charge_label_surface = None
        self.player2_charge_surface = None

        # Sounds
        self.wall_hit_sound = None
        self.pad_hit_sound = None
        self.powerup_sound = None
Пример #16
0
    def test_run(self, os, redis):
        player = Player('player', output_device=Mock())
        player.play = Mock()
        pubsub = Mock()
        pubsub.listen.return_value = [
            {'type': 'subscribe'},
            {'type': 'message',
             'data': json.dumps({
                 'action': 'quit',
                 'player': 'name'})},
            {'type': 'message',
             'data': json.dumps({
                 'action': 'won',
                 'player': 'name'})},
            {'type': 'message',
             'data': json.dumps({
                 'action': 'join',
                 'before': 'name'})},
            {'type': 'message',
             'data': json.dumps({
                 'action': 'skip',
                 'next': player.name,
                 'middle': 'middle'})},
            {'type': 'message',
             'data': json.dumps({
                 'action': 'won',
                 'player': player.name})},
        ]
        client = Mock()
        client.pubsub.return_value = pubsub
        redis.from_url.return_value = client

        player.run()
        self.assertTrue(client.pubsub.called)
        self.assertTrue(pubsub.subscribe.called)
Пример #17
0
def enter():
    global timer, player, map, Player_missile, FirstEnemys, SecondEnemys, enemy_missile, enemy_explosion, bomb, bomb_explosion, item, boss, boss_missile
    global angle, ui
    global score
    score = Score()
    timer = Timer()
    player = Player()
    player.kind = 2
    map = Map()
    map.kind = 2

    ui = UI()
    bomb = []
    FirstEnemys = []
    SecondEnemys = []
    Player_missile = []
    enemy_missile = []
    enemy_explosion = []
    bomb_explosion = []
    item = []
    boss = []
    boss_missile = [Boss_missile(10,10 ) for i in range(72)]
    for member in boss_missile:
        angle += 10
        if angle >360 :
            member.y +=400
        member.angle = angle
Пример #18
0
 def test_receive_down_card(self):
     """test the receive_down_card method"""
     player = Player('Blue')
     card = Card(Rank(0, 'x'), Suit('y'))
     player.receive_down_card(card)
     self.assertEqual(1, len(player.cards))
     self.assertEqual(card, player.cards[0])
Пример #19
0
class Game(DirectObject):
  def __init__(self):
    self.title_text = self.info((-1.32, 0.96), title)

    base.disableMouse()
    #base.camLens.setNear(0.0001)

    self.create_world()
    base.taskMgr.add(self.step, "physics-step")

    self.stars = Sprite("media/textures/asteroids/stars", depth = 100, scale = 146, transparency = False)

    self.static_body = pymunk.Body(pymunk.inf, pymunk.inf)
    self.static_lines = [pymunk.Segment(self.static_body, Vec2d(-SCREEN_X, -SCREEN_Y), Vec2d(-SCREEN_X, SCREEN_Y), 0.0),
                         pymunk.Segment(self.static_body, Vec2d(-SCREEN_X, -SCREEN_Y), Vec2d(SCREEN_X, -SCREEN_Y), 0.0),
                         pymunk.Segment(self.static_body, Vec2d(SCREEN_X, -SCREEN_Y), Vec2d(SCREEN_X, SCREEN_Y), 0.0),
                         pymunk.Segment(self.static_body, Vec2d(-SCREEN_X, SCREEN_Y), Vec2d(SCREEN_X, SCREEN_Y), 0.0)
                         ]
    for l in self.static_lines:
      l.friction = 0.3
      l.elasticity = 0.6
    self.world.add_static(self.static_lines)


    self.ship = Player()
    self.ship.activate()
    body, shape = self.ship.physical_presence()
    self.world.add(body, shape)

    # Initialize Cameras
    self.god_camera = GodCamera()

    # Activate Free Lopok
    self.god_camera.activate()

    self.accept("r", self.snapshot)
    self.accept("escape", sys.exit)

  def create_world(self):
    pymunk.init_pymunk()
    self.world = pymunk.Space()
    self.world._space.contents.elasticIterations = 10
    self.world.gravity = Vec2d(0.0, 0.0)

  def step(self, task):
    steps = 10
    for x in range(steps):
      self.world.step(1/60.0/steps)
    return Task.cont

  """take a snapshot"""
  def snapshot(self):
    base.screenshot("snapshot")

  """info"""
  def info(self, pos, msg):
    self.font = base.loader.loadFont(APP_PATH + 'media/fonts/OCR.otf')
    return OnscreenText(font = self.font, text = msg, style = 1, fg = (1, 1, 1, 1),
                        pos = pos, align = TextNode.ALeft, scale = .035,
                        mayChange = True)
Пример #20
0
 def _onServerMessageReceived(self, message):
     print 'message from bootstrap server', message
     if message['action'] == 'createGameAck':
         self.gameId = message['game_id']
         for player in self.players:
             if player.id == -1:
                 player.id = message['player_id']
                 self.connectionManager.player = player.id
                 self.connectionManager.gameId = self.gameId
         self._findColor()
         self._findCountries()
         QTimer.singleShot(500, self._joinedGame)
     elif message['action'] == 'joinGameAck':
         self.connectionManager.player = message['player_id']
         self.connectionManager.gameId = self.gameId
         players = message['playerInfoList']
         for player in players:
             playerName = '...' if player['player_id'] != message['player_id'] else self.myNickName
             p = Player(player['player_id'], playerName)
             p.host = str(player['ip'])
             p.port = player['port']
             self.addPlayer(p)
         for player in self.players:
             if player.id == self.connectionManager.player:    continue
             self.connectionManager.unicast(player.id, {'type': 'join', 'action': 'req'})
Пример #21
0
	def run_simulation(self):
		print datetime.datetime.now().time()
		players = []
		if int(self.rules.players.get()) > 1:
			extra = int(self.rules.players.get()) - 1
			for _ in range(extra):
				player = Player()
				players.append(player)
		player = Player()
		player.set_player_style(int(self.count.ace_entry.get()), int(self.count.two_entry.get()), int(self.count.three_entry.get()), int(self.count.four_entry.get()), int(self.count.five_entry.get()), int(self.count.six_entry.get()), int(self.count.seven_entry.get()), int(self.count.eight_entry.get()), int(self.count.nine_entry.get()), int(self.count.tens_entry.get()), int(self.player_strategy.bankroll_entry.get()), int(self.player_strategy.min_bet_entry.get()), int(self.player_strategy.max_bet_entry.get()), int(self.player_strategy.count_bet_entry.get()), int(self.player_strategy.bet_inc_entry.get()), False)
		players.append(player)
		card_table = CardTable()
		card_table.set_table_style(self.rules.insurance.get(), float(self.rules.blackjack_payout.get()), int(self.rules.decks.get()))
		card_table.seat_players(players)
		bankroll = 0
		bankrupt = 0
		for num in range(10000):
			for _ in range(int(self.player_strategy.session_entry.get())*100):
				card_table.play_round()
			if card_table.chairs[-1].player.bankroll < 1:
				bankrupt += 1
			bankroll += card_table.chairs[-1].player.bankroll
			for chair in card_table.chairs:
				chair.player.bankroll = 5000
			card_table.chairs[-1].player.bankroll = int(self.player_strategy.bankroll_entry.get())
			card_table.shoe.cards = []
		num_bankrupt = float(bankrupt) / float(100)
		self.bankrupt["text"] = 'Bankrupt: %.2f%%' % num_bankrupt
		bankroll = bankroll / 10000
		self.bankroll["text"] = "Average Bankroll: $ %.2f" % bankroll
		print datetime.datetime.now().time()
Пример #22
0
    def add_webcasts(self, webcasts, pos=None, sort=False, play=False):
        if not webcasts:
            return
        if not isinstance(webcasts, (list, tuple, set)):
            webcasts = [ webcasts ]

        webcast_items = [ WebcastListItem(webcast) for webcast in webcasts if webcast not in self.get_webcasts()]

        if webcast_items:
            if not self.items:
                self.emit_add_signal()
            self.add_items(webcast_items, pos, sort)

            if len(self.items) > self.limit_number:
                being_delete_items = self.items[self.limit_number:]
                if self.highlight_item in being_delete_items:
                    being_delete_items.remove(self.highlight_item)
                self.delete_items(being_delete_items)

        if len(webcasts) >= 1 and play:
            del self.select_rows[:]
            self.queue_draw()
            self.set_highlight_webcast(webcasts[0])
            Player.play_new(self.highlight_item.get_webcast(), seek=self.highlight_item.get_webcast().get("seek", 0))
            if Player.get_source() != self:
                Player.set_source(self)
Пример #23
0
def redo_search():
    #should return results html here
    positions = ', '.join(_parse_check_box(POSITIONS))
    regions = ', '.join(_parse_check_box(REGIONS))
    languages = ', '.join(_parse_check_box(LANGUAGES))

    player_info = Player.build_player_info(request.form['username'], request.form['amount'], positions, regions, languages)
    current_player = Player(player_info)
    
    db = connect_db()
    current_player._update_user_to_db(db)
    # We are providing an mmr range of 200 as a search criteria
    matching_player_list = current_player.get_matching_players(200, db)
    my_results = []
    for matching_player_id in matching_player_list:
        my_results.append(get_steam_userinfo(matching_player_id))
    if my_results:
        results = ', '.join(my_results)
    else:
        results = 'Could not match MMR for your profile'

    session['redo_search'] = True
    #flash new player infos
    #concat player data into flash info
    flash(results)
    return render_template('index.html')
Пример #24
0
def play():
    world.load_tiles()
#    pcs = npcs()
    global player
    global room

    player = Player()
    room = world.tile_exists(player.location_x, player.location_y)
    
#    print vars(room)
    print room.room_name()
    print room.intro_text()
    if room.inventory is not None:
        for item in room.inventory:
            print "\t{} is here.".format(item.name)
    room.exits_text()         
    while player.is_alive() and not player.victory:
        room = world.tile_exists(player.location_x, player.location_y)
        room.modify_player(player)
        # Check again since the room could have changed the player's state
        if player.is_alive() and not player.victory:
#            print("Choose an action:\n")
            global available_actions
            available_actions = room.available_actions()
            Prompt().cmdloop()
 def SetPosition(self, track_id, position):
     if track_id == self._get_trackid(Player.song):
         position /= MICROSECOND
         Player.seek(position)
     else:
         # treat request as stale
         pass
Пример #26
0
def engine():
    intro = title.choose_title()
    raw_input(intro)
    world.load_tiles()
    player = Player()
    # room_old to make sure a new room intro is given
    room_old = None
    while player.is_alive() and not player.victory:
        room = world.tile_exists(player.loc_x, player.loc_y)
        if room is not room_old:
            print room.intro_text()
            room_old = room
        room.alter_player(player)
        if player.is_alive() and not player.victory:
            available_actions = room.available_actions()
            # print '\tChoose from the following actions:'
            # for action in available_actions:
            #     print '\t\t', action.name[0]
            action_in = raw_input('\n\t> ').lower()
            # if action_in == help or other special actions?
            if action_in == 'exit' or action_in == 'quit':
                sys.exit("\n\tSEE YOU SPACE COWBOY...\n")

            for action in available_actions:
                # problem with user just hitting enter?
                if action_in in action.name:
                    player.do_action(action)
                    done = True
                    break
                else:
                    done = False
                    continue

            if not done:
                print "\n\tSorry, I don't know what that means..."
Пример #27
0
  def testBuildForFirm(self):
    b = Board()
    p = Player()
    # Doctor the board
    for resource in FirmsOrGoods:
      b.revenues[resource] = 0
    column = BuildingColumn(Resources.Red, [
        BuildingCard(5, Resources.Red, Resources.Glass),
        BuildingCard(6, Resources.Red, Resources.Iron),
        BuildingCard(5, Resources.Red, Resources.Glass),
        BuildingCard(2, Resources.Red, Resources.Bank),
        BuildingCard(3, Resources.Red, Resources.Red),
        BuildingCard(3, Resources.Red, Resources.Red),
        ])
    b.buildingColumn[Resources.Red] = column
    b.roofStack = [RoofCard(5, 5, 3)]
    column.setRoof(RoofCard(4, 4, 2))

    p.amount = 20
    b.buildForFirm(p, Resources.Red)

    self.assertEqual(0, p.amount)
    self.assertEqual(4, p.getLevel())
    self.assertIn(ShareCard(Resources.Red, 3), p.cards)
    self.assertEqual(10, b.revenues[Resources.Red])
    self.assertEqual(5, b.revenues[Resources.Glass])
    self.assertEqual(5, b.shareScore[Resources.Red])
    self.assertEqual(5, column.length())
    self.assertEqual(6, column.getLevel())
Пример #28
0
    def __init__(self, game, index, spy):
        """Constructor called before a game starts.  It's recommended you don't
        override this function and instead use onGameRevealed() to perform
        setup for your AI.
        @param name     The public name of your bot.
        @param index    Your own index in the player list.
        @param spy      Are you supposed to play as a spy?
        """
        Player.__init__(self, self.__class__.__name__, index)
        self.game = game
        self.spy = spy

        self.spyplans = [  
                        "110000000000100000000000000100000000000000000000000000000000000000000000000000000000000000000000000000100010000000000000000000000000000000000000000000000000000000000000000000000"
        ]

        self.resplans = [
                        "100000010000000000000000000000000000000000000000000000000000000000000000000001101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

        ]

        self.rawPlan = self.getPlansFor(index, spy)

        self.plan = BotPlan()
        self.plan.init(game)
        self.plan.load(self.rawPlan)

        self.log = logging.getLogger(str(self))
        if not self.log.handlers:
            try:
                output = logging.FileHandler(filename='logs/'+str(self)+'.xml')
                self.log.addHandler(output)
                self.log.setLevel(logging.DEBUG)
            except IOError:
                pass
Пример #29
0
def test_find_moves_W():
    plansza = Plansza()
    player = Player('W')
    expected=set([(2, 3), (3, 2), (4, 5), (5, 4)])
    actual = set(player.find_moves(plansza))

    assert actual==expected
Пример #30
0
def test_check_direction_wrong_B():
    plansza = Plansza()
    x,y = 3,2
    dir = Point(0,1)
    player = Player('B')
    result = player.check_direction(x, y, dir, plansza)
    assert result==False, 'ruch w tym kierunku powinien być możliwy'
Пример #31
0
room['foyer'].e = room['narrow']
room['overlook'].s = room['foyer']
room['narrow'].w = room['foyer']
room['narrow'].n = room['treasure']
room['treasure'].s = room['narrow']

#
# Main
#

room['overlook'].take(Key('Key', 'To the treasure!', room['treasure']))
room['outside'].take(Key('Key', 'To foyer!', room['foyer']))

# Make a new player object that is currently in the 'outside' room.

player = Player('Bob', room['outside'])

# Write a loop that:
#
# * Prints the current room name
# * Prints the current description (the textwrap module might be useful here).
# * Waits for user input and decides what to do.
#
# If the user enters a cardinal direction, attempt to move to the room there.
# Print an error message if the movement isn't allowed.
#
# If the user enters "q", quit the game.

directionsList = ['n', 's', 'e', 'w', 'i', 'score']
actionsList = ['take', 'drop']
Пример #32
0
 def __init__(self):
     Player.__init__(self, "Thanos")
     self.moves.pop("attack")
     self.moves["smash"] = self.attack
     self.moves["Thanos Snap"] = self.finger_snap
Пример #33
0
class Controller:
    player = None

    def start_game(self):
        print(" Welcome to the game!")
        print()
        name = input("What is your name? ")
        self.player = Player(name)
        self.player.move_to(game_locations.location_start)
        self.main_loop()

    def main_loop(self):
        exit = False

        while not exit:
            location = self.player.location

            # describe the current location
            print(location.long_description)

            if location.end:
                # end the game at an ending location
                print("Thank you for playing, {}!".format(self.player.name))
                break

            if location.monster:
                print("Oh no! There is a {} here!".format(
                    location.monster.name))
                self.fight(location)

                # if the player is at 0 hp after the fight, end the game
                if self.player.hp <= 0:
                    print("You have died.")
                    break

            print()
            print("You can go: ")
            options = list(location.paths)

            for index, option in enumerate(options):
                to_location = location.paths[option]
                print("{:>3} {} to {}".format(index + 1, option,
                                              to_location.short_description))

            print()
            choice = input("Your choice: ")
            try:
                choice = int(choice)

            except ValueError:
                print()
                print("\tERROR Improper input.")
                continue

            if choice < 1 or choice > len(options):
                print()
                print("\tERROR Improper input.")
                continue

            self.player.move_to(location.paths[options[choice - 1]])

    def fight(self, location):
        """ The player and the monster attack until one or the other is dead
        if the monster dies, it is removed from the location. """

        monster = location.monster

        while monster.hp > 0 and self.player.hp > 0:
            if monster.attackhit():
                print("The {} hits you!".format(monster.name))
                self.player.hp -= monster.attackdamage()
            else:
                print("The {} misses!".format(monster.name))

            if self.player.hp < 0:
                break

            print()
            print("You have {} HP and the monster has {}".format(
                self.player.hp, monster.hp))

            input("input anything to attack")
            if self.player.attackhit():
                print("You hit the {}!".format(monster.name))
                monster.hp -= self.player.attackdamage()
            else:
                print("You miss!")

            print()

        if monster.hp < 0:
            print("Congratulations! You have killed the {}! ".format(
                monster.name))
            location.remove_monster()
Пример #34
0
#
# Main
#


# I help
def goTo(direction, shipRoom):
    attr = direction + '_to'
    if hasattr(shipRoom, attr):
        return getattr(shipRoom, attr)

    return shipRoom


player1 = Player(room['outside'])
directions = set(['n', 's', 'e''w'])

playerChoice = None
# Write a loop that:
while True:
    # * Prints the current room name
    print(player1.currentRoom.name)
# * Prints the current description (the textwrap module might be useful here).
    print(textwrap.wrap(player1.currentRoom.description))
# * Waits for user input and decides what to do.
    playerChoice = input("Make a Choice\nOptions are n,s,e,w or q to quit.")
#
# If the user enters a cardinal direction, attempt to move to the room there.
# Print an error message if the movement isn't allowed.
    if playerChoice in directions:
Пример #35
0
 def __init__(self):
     Player.__init__(self, "Medusa")
     self.moves.pop("attack")
     self.moves["claw slice"] = self.attack
     self.moves["stone attack"] = self.stone_attack
     self.moves["snake bite"] = self.snake_bite
Пример #36
0
class Game(object):
    def __init__(self):
        self.player = Player()
        self.dealer = Dealer()
        self.deck = Deck()
        self.discarded = self.deck.discarded

    def seed_player(self):
        os.system('clear')
        input_check = False
        while input_check == False:
            print(
                'Welcome to Blackjack. Please enter your starting money amount'
            )
            money = input()

            if money == 'q':
                exit()

            try:
                money = float(money)
                self.player.money = money
                input_check = True
                os.system('clear')
            except ValueError as e:
                os.system('clear')
                print(
                    "Input error - Plese input a starting amount greater than 0"
                )

    def place_bet(self):
        input_check = False
        while input_check == False:
            print(
                'Please enter your bet amount. You currently have ${}'.format(
                    self.player.money))
            bet = input()

            if bet == 'q':
                exit()

            try:
                bet = float(bet)
            except ValueError as e:
                os.system('clear')
                print('You did not enter a valid bet amount')
                continue

            if self.player.money - bet < 0:
                os.system('clear')
                print('You do not have that much money')
                continue
            else:
                os.system('clear')
                print('Player bets ${}'.format(bet))
                input_check = True
                return bet

    def deal(self):
        while len(self.dealer.hand) < 2:
            self.dealer.draw(self.deck)
            self.player.draw(self.deck)

    def discard_all(self):
        self.player.discard(self.discarded)
        self.dealer.discard(self.discarded)

    def show_status(self, start=False, clear=True):
        if clear is True:
            os.system('clear')
        dealer_total = self.dealer.show_hand(start=start)
        player_total = self.player.show_hand()
        return dealer_total, player_total

    def offer_insurance(self):
        input_check = False
        insurance = 0
        while input_check is False:
            print('\nDealer Shows Ace. Would you like to buy Insurance? - Y/N')
            ins = input()
            if ins.lower() == 'y':
                print('How much would you like to bet?')
                insurance = input()
                try:
                    insurance = float(insurance)
                    input_check = True
                    if self.dealer.total == 21:
                        return insurance
                    else:
                        return -insurance
                except ValueError as e:
                    self.show_status(start=True)
                    print('\nYou did not enter a valid bet amount')
                    continue

            elif ins.lower() == 'n':
                return insurance
            elif ins.lower() == 'q':
                exit()
            else:
                self.show_status(start=True)
                print('\nInvalid Input...')
                continue

    def split(self):
        pass
        #TODO: Add splitting flow

    def play_hand(self, bet):

        # Function to play hand and return the winner - Player, Dealer, Push, or Blackjack if player is dealt blackjack
        self.deal()
        self.dealer.total, self.player.total = self.show_status(start=True,
                                                                clear=False)

        insurance = 0

        if self.dealer.hand[1].name == 'Ace':
            insurance = self.offer_insurance()

        # Initial Blackjack check
        if (self.player.total == 21) and (self.dealer.total == 21):
            self.show_status()
            self.discard_all()
            return 'push', bet, insurance
        elif self.player.total == 21:
            self.discard_all()
            return 'blackjack', bet, insurance
        elif self.dealer.total == 21:
            self.show_status()
            self.discard_all()
            return 'dealer', bet, insurance

        while self.player.total < 21:
            # Initial Player Action - Hit, Stand or Double Down
            # TODO: Add Splitting
            if len(self.player.hand) < 3:
                print('\nHit, Stand or Double Down - H/S/D')
                action = input()

                if action.lower() == 'h':
                    self.player.draw(self.deck)
                    self.player.total = self.show_status(start=True)[1]

                elif action.lower() == 's':
                    self.show_status()
                    time.sleep(2)
                    break

                elif action.lower() == 'd':
                    if self.player.money - (2 * bet) >= 0:
                        bet = 2 * bet
                        self.player.draw(self.deck)
                        self.player.total = self.show_status(start=True)[1]
                        time.sleep(2)
                        if self.player.total <= 21:
                            self.show_status()
                            time.sleep(2)
                        break
                    else:
                        self.show_status(start=True)
                        print('\nYou do not have enough money to double down')
                elif action.lower() == 'q':
                    exit()
                else:
                    continue

            # Second+ Player Action - Hit or Stand
            else:
                print('\nHit or Stand? - H/S')
                action = input()
                if action.lower() == 'h':
                    self.player.draw(self.deck)
                    self.player.total = self.show_status(start=True)[1]

                elif action.lower() == 's':
                    self.show_status()
                    time.sleep(2)
                    break
                elif action.lower() == 'q':
                    exit()
                else:
                    continue

        # Draw dealer hand - stopping at 17
        while (self.dealer.total < 17) and (self.player.total <= 21):
            self.dealer.draw(self.deck)
            self.dealer.total = self.show_status()[0]
            time.sleep(2)

        self.discard_all()

        # Declare winner of hand
        if self.dealer.total == self.player.total:
            return 'push', bet, insurance
        elif (self.dealer.total <= 21) and (self.dealer.total >
                                            self.player.total):
            return 'dealer', bet, insurance
        elif (self.player.total <= 21) and (self.player.total >
                                            self.dealer.total):
            return 'player', bet, insurance
        elif self.player.total > 21:
            return 'dealer', bet, insurance
        elif self.dealer.total > 21:
            return 'player', bet, insurance

    def play_game(self):
        self.seed_player()
        while self.player.money >= 1:
            bet = self.place_bet()
            winner, bet, insurance = self.play_hand(bet)
            if winner == 'player':
                self.player.win_money(bet, insurance=insurance)
            elif winner == 'dealer':
                self.player.lose_money(bet, insurance=insurance)
            elif winner == 'blackjack':
                self.player.win_money(bet * 1.5,
                                      insurance=insurance,
                                      blackjack=True)
            else:
                print("\nIt's a push...\n")
                continue
Пример #37
0
 def __init__(self):
     Player.__init__(self, "Hercules")
     self.moves["arrow shots"] = self.arrow_shots
     self.moves["club strike"] = self.club_strike
     self.moves["equalize healths"] = self.equalize_healths
Пример #38
0
#space
space = 1

#game screen generation
pygame.display.set_caption('Surrender')
size = width, height = 1280, 720
screen = pygame.display.set_mode((size))
icon = pygame.image.load('assets/icon.png')
pygame.display.set_icon(icon)

#mouse
pygame.mouse.set_cursor(*pygame.cursors.diamond)

#Player creation
player = Player()

#Map creation
maps = Map()
objects_light = Objects(0)
objects_dark = Objects(1)

hud = HudText()
hud.render_text("Press [SPACE].", "", "")

#Sound
ost = pygame.mixer.Sound('assets/ost.ogg')
ost.set_volume(0.2)
ost.play(loops=-1, maxtime=0, fade_ms=0)

running = True
Пример #39
0
 def __init__(self):
     self.player = Player()
     self.dealer = Dealer()
     self.deck = Deck()
     self.discarded = self.deck.discarded
Пример #40
0
file.close()

# Convert the maze map into a list of integers to use smaller storage.
for i in range(len(maze)):
    maze[i] = list(map(int, maze[i].split()))

# Movable directions
allDirections = ['N', 'E', 'S', 'W']

# True when the solution is found or when all paths are tested
stop = False

# True when a path has been found. False when maze has no solution.
solution = False

player = Player(start_x, start_y)

# Loop to find the solution
while (stop == False) and (solution == False):

    # Check if the 'Player' have moved in a loop cycle. False means dead-end.
    stuck = True

    # Store all walkable directions from the Player's current position
    walkable_directions = []
    for direction in allDirections:
        check = player.checkAdjacent(direction, maze)
        if check is True:
            walkable_directions.append(direction)

    # If there are any walkable directions, move the Player
Пример #41
0
from runner import Runner

if __name__ == "__main__":
    N_WORKERS = 1
    agent = Agent()
    if len(sys.argv) > 1:
        saveFile = sys.argv[1]
        print(f'Training agent from checkpoint: {saveFile}')
        checkpoint = torch.load(saveFile)
        agent.load_state_dict(checkpoint["model_state_dict"], strict=True)
        #agent.eval()

        #success = agent.load_state_dict(torch.load(saveFile))
        #print(f'Loading returned: {success}')

        #agent.eval()
        directory = './videos/car-racing/fromCheckpoint' + str(time.time())
        player = Player(agent=agent, directory=directory, train=True)
        #points = player.play()
        #print(f'loaded agent scored {points} Points')

        trainer = Trainer(gamma=0.99, agent=agent, workers=N_WORKERS)
        trainer.optimizer.load_state_dict(checkpoint["optimizer_state_dict"])

    else:
        print('Training new agent')
        trainer = Trainer(gamma=0.99, agent=deepcopy(agent), workers=N_WORKERS)
    queue = mp.SimpleQueue()
    runner = Runner(agent=agent, ix=0)

    trainer.train_one(runner, queue)
Пример #42
0
room['narrow'].n_to = room['treasure']
room['treasure'].s_to = room['narrow']
#
# Main
#




room['outside'].addItem('fire branch')
room['foyer'].addItem('jump spell')
room['overlook'].addItem('shovel')
room['narrow'].addItem('Map')

# Make a new player object that is currently in the 'outside' room.
player = Player(room['outside'])

#print(f"Welcome, {player.name}!\n")

print("#######################")
print("***** WELCOME PLAYER 1 *****")
print("***** ONE RULE AND ONE RULE ONLY *****")
print("   STAY WOKE OR PERISH!  ")
print("#######################")


# Write a loop that:
#
# * Prints the current room name
# * Prints the current description (the textwrap module might be useful here).
# * Waits for user input and decides what to do.
Пример #43
0
# You may uncomment the smaller graphs for development and testing purposes.
# map_file = "maps/test_line.txt"
# map_file = "maps/test_cross.txt"
# map_file = "maps/test_loop.txt"
# map_file = "maps/test_loop_fork.txt"
map_file = "maps/main_maze.txt"

# Loads the map into a dictionary

room_graph=literal_eval(open(map_file, "r").read())
world.load_graph(room_graph)

# Print an ASCII map
world.print_rooms()

player = Player(world.starting_room)

# Fill this out with directions to walk
# traversal_path = ['n', 'n']
traversal_path = []
#traversal graph
map_graph = {}

#test graph
# map_graph={0:{'n':1, 's':2}, 1:{'s':'?'}, 2:{'n':0, 'w': 1}}

#referance only:
# print(player.current_room.id)
# print(player.current_room.get_exits())
# player.travel('n')
Пример #44
0
    destination = getattr(rooms[currentRoom], key)
    if destination == None:
        print("You can't go that way!")
        return currentRoom
    return destination


def tryToPickUp(item, currentRoom):
    for thing in getattr(rooms[currentRoom], 'items'):
        if thing.name == item:
            return thing
    return None


# Make a new player object that is currently in the 'outside' room.
player = Player('outside', 'Ellen')

# Write a loop that:
# * Prints the current room name
# * Prints the current description (the textwrap module might be useful here).
# * Waits for user input and decides what to do.

# If the user enters a cardinal direction, attempt to move to the room there.
# Print an error message if the movement isn't allowed.
# If the user enters "q", quit the game.

done = False

while not done:
    currentRoom = getattr(player, 'currentRoom')
Пример #45
0
import field_map
from player import Player

# 以下メイン処理
if __name__ == '__main__':
    # 開始メッセージを表示
    print("すごろくゲーム、Start!!")

    # プレイヤーの名前を取得する
    p_name = input("プレイヤーの名前を教えてください>> ")

    # Playerクラスのオブジェクトを作成
    hero = Player(p_name)

    # ゲームからの呼びかけメッセージを表示
    print("やあ、" + hero.name + "!旅をはじめよう!")

    # ゴールに到達するまで繰り返す
    while hero.cur_pos < field_map.goal_pos:
        hero.choose_action_in_field()

    # ゴール到達のメッセージを表示
    print("ゴールしました。おめでとうございます!")

Пример #46
0
    'sword': Item('Sword', 'Steel blade'),
    'shield': Item('Shield', 'Wooden protection'),
    'wand': Item('Wand', 'Magical Wand'),
    'materia': Item('Materia', 'Powers unknown')
}

# Link items to rooms

room['outside'].add_item(items['coins'])
room['foyer'].add_item(items['sword'])
room['overlook'].add_item(items['shield'])
room['treasure'].add_item(items['materia'])
room['narrow'].add_item(items['wand'])

name = input('What is your name, Adventurer? ')
player = Player(name, room['outside'])
# player.current_room = room['outside']
print(player.current_room)
print(room['outside'].show_items())
running = True
while running:
    # Prints the current room name
    print(player.current_room.name)
    # Prints the current description
    print(player.current_room.description)
    # Prints current inventory
    print(player.current_room)

    # Waits for user input and decides what to do.
    input_var = input("type a direction ")
Пример #47
0

#
# Main
#
def find_item(name, location):

    for item in location.items:
        if item.name == name:
            return item
    return None


# Make a new player object that is currently in the 'outside' room.
name = input('Enter your name: ')
player = Player(name, room['outside'])
print(player.room.description)

print(crayons.green(f'\n Welcome, {player.name}!\n'))

# Write a loop that:
#
# * Prints the current room name
# * Prints the current description (the textwrap module might be useful here).
# * Waits for user input and decides what to do.
#
# If the user enters a cardinal direction, attempt to move to the room there.
# Print an error message if the movement isn't allowed.
#
# If the user enters "q", quit the game.
Пример #48
0
    from player import Player
    pygame.init()

    disp_width = 1080
    disp_height = 720
    #globals
    disp = pygame.display.set_mode((disp_width, disp_height))
    disp.fill((192, 192, 192))
    pygame.display.set_caption('Battleboats')
    clock = pygame.time.Clock()
    draw_once=True
    gameState = "welcome"
    winner = "null"
    num_destroyed = 0
    numberOfBoats = 0
    player1 = Player()
    player2 = Player()
    placeNumber = 1
    spotsToCheck = [] #[[0 for x in range(2)] for y in range(placeNumber)]
    turn = 0
    grid = None
    leftGrid = None
    rightGrid = None

    # variables used when gameState = "gamePlay"
    checkbox=pygame.draw.rect(disp, (255, 255, 255), (533, 200, 15, 15))
    toggled=False

    rects_clicked1=[]
    rects_missed1 = []
    rects_hit1 = []
Пример #49
0
def run():
    pygame.init()

    screen = Screen()
    # mixer.music.load('sounds/background.wav')
    # mixer.music.play(-1)

    player = Player()
    playerX_change = 0
    playerY_change = 0
    screen.add_player(player)
    score = 0
    bullets = []

    for enemy in enemies:
        screen.add_enemy(enemy)

    # Game Loop
    running = True
    while running:
        screen.fill()
        screen.show_score(score)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False

            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_LEFT or event.key == pygame.K_a:
                    playerX_change -= 0.5
                if event.key == pygame.K_RIGHT or event.key == pygame.K_d:
                    playerX_change += 0.5
                if event.key == pygame.K_UP or event.key == pygame.K_w:
                    playerY_change -= 0.5
                if event.key == pygame.K_DOWN or event.key == pygame.K_s:
                    playerY_change += 0.5
                if event.key == pygame.K_SPACE:
                    if len(bullets) < 50:
                        bullet = Bullet(player)
                        bullets.append(bullet)
                        mixer.Sound('sounds/laser.wav').play()

            if event.type == pygame.KEYUP:
                if event.key == pygame.K_LEFT or event.key == pygame.K_a or event.key == pygame.K_RIGHT or event.key == pygame.K_d:
                    playerX_change = 0
                if event.key == pygame.K_UP or event.key == pygame.K_w or event.key == pygame.K_DOWN or event.key == pygame.K_s:
                    playerY_change = 0

        player.move_player(playerX_change, playerY_change)
        screen.add_player(player)

        for enemy in enemies:
            enemy.move_enemy()
            screen.add_enemy(enemy)
            if enemy.check_for_collision(player):
                screen.game_over()
                running = False
            for bullet in bullets:
                screen.add_bullet(bullet)
                if bullet.Y < 0:
                    bullets.remove(bullet)
                if enemy.check_for_collision(bullet):
                    screen.kill_enemy(enemy)
                    # Show Explosion briefly
                    pygame.display.update()
                    enemies.remove(enemy)
                    mixer.Sound('sounds/explosion.wav').play()
                    score += 1

        if len(enemies) == 0:
            x = random.randint(0, 320)
            if score < 80:
                while len(enemies) < 5:
                    if score < 20:
                        create_enemyA(x)
                    if 20 <= score < 50:
                        create_enemyB(x)
                    if 50 <= score < 80:
                        create_enemyC(x)
                    x += 64
            if 80 <= score < 150:
                while len(enemies) < 10:
                    create_enemyC(x)
                    x += 64
            if 150 <= score:
                while len(enemies) < 15:
                    create_enemyC(x)
                    x += 64

        pygame.display.update()
Пример #50
0
 def __init__(self):
     Player.__init__(self)
Пример #51
0
#

# Make a new player object that is currently in the 'outside' room.
# Write a loop that:
#
# Prints the current room name
# Checks if player has joined
# Waits for user input and decides what to do.
# If the user enters a cardinal direction, attempt to move to the room there.
# Print an error message if the movement isn't allowed.
#
# If the user enters "q", quit the game.

directions = ["n", "s", "e", "w"]

player = Player(input("\nWhat is your name? "), room['outside'])

print("\nHello, %s!" % player.name)

error = ""

while True:
    print(player.curRoom)
    if error != "":
        print(error)
        error = ""
    inp = input(" >")
    inputs = inp.split()
    numArgs = len(inputs)
    if numArgs == 1:
        if inp in directions:
Пример #52
0
#
# Main
#

# declare items

room['outside'].addItem(Item('sword', 'a sword for slashing'))
room['foyer'].addItem(Item('shield', 'a sheild for protection'))
room['overlook'].addItem(Item('compass', 'a compass to show the direction'))
room['foyer'].addItem(Treasure('key', 'a key', 300))
room['outside'].addItem(Treasure('picture', 'a picture', 100))
room['treasure'].addItem(Treasure('Gold', 'a piece of gold', 500))

# Make a new player object that is currently in the 'outside' room.
name = input('Who are you? \n')
me = Player(name ,room['outside'])

# Write a loop that:
#
# * Prints the current room name
# * Prints the current description (the textwrap module might be useful here).
# * Waits for user input and decides what to do.
#
# If the user enters a cardinal direction, attempt to move to the room there.
# Print an error message if the movement isn't allowed.
#
# If the user enters "q", quit the game.

print (f"""
    {me.startRoom.name}:
    {me.startRoom.description}
Пример #53
0
    490: [(33, 25), {
        's': 437
    }],
    436: [(33, 27), {
        'w': 413
    }],
    434: [(33, 28), {
        'e': 446,
        'w': 433
    }],
    446: [(34, 28), {
        'w': 434
    }]
}
world.loadGraph(roomGraph)
player = Player("Name", world.startingRoom)

# FILL THIS IN
traversalPath = [
    'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'w', 'n', 's', 'e', 's', 'w', 'e',
    's', 's', 's', 'w', 'n', 'n', 's', 'w', 'n', 'n', 'w', 'n', 'n', 'n', 'n',
    'n', 's', 'w', 'n', 'n', 'e', 'n', 's', 'w', 's', 's', 's', 'n', 'e', 's',
    's', 's', 'e', 'n', 'n', 'n', 'n', 'n', 'n', 's', 'e', 'n', 's', 'w', 's',
    's', 's', 'e', 'n', 'n', 's', 's', 'e', 'e', 'n', 'n', 's', 's', 's', 's',
    's', 's', 's', 's', 's', 'w', 'e', 'e', 'e', 'n', 'n', 'n', 'n', 'w', 'e',
    's', 's', 's', 'e', 'n', 'n', 'n', 'n', 'n', 's', 'w', 'n', 'n', 'n', 's',
    's', 's', 'w', 'e', 'e', 's', 'e', 'n', 'n', 'n', 'n', 'w', 'n', 'w', 'e',
    's', 'e', 's', 'w', 'e', 's', 's', 's', 'w', 's', 'e', 'e', 'n', 'n', 'n',
    'e', 'n', 'n', 'e', 'n', 'n', 'n', 's', 's', 'e', 'n', 's', 'w', 's', 'e',
    'e', 'n', 's', 's', 'e', 'w', 'n', 'w', 'w', 'w', 's', 'w', 'n', 'n', 'n',
    'n', 's', 'w', 'n', 's', 's', 'n', 'e', 's', 'e', 'n', 'n', 'n', 's', 's',