Beispiel #1
0
def main():
    global humanPlayer
    spinner = CPUSpinnerController()
    kbController = KeyboardController()
    pygameView = PygameView()
    catan.init()
    from cpu_player_minimal import CPUPlayer

    events.post("PlayerJoin", CPUPlayer(1))
    events.post("PlayerJoin", CPUPlayer(2))
    events.post("PlayerJoin", CPUPlayer(3))
    humanPlayer = catan.HumanPlayer(4)
    events.post("PlayerJoin", humanPlayer)
    spinner.run()
Beispiel #2
0
    def showMap(self):
        # clear the screen first
        self.background.fill( (0,0,0) )
        self.window.blit( self.background, (0,0) )
        pygame.display.flip()

        catan.init()
        board = catan.game.board

        row = 0
        column = 0
        for i, t in enumerate(board.tiles):
            sprite = Tile(t)
            x = 300 + sprite.tile.graphicalPosition[0]*75
            # minus because pygame uses less = up in the y dimension
            y = 300 - sprite.tile.graphicalPosition[1]*75
            sprite.rect.move_ip(x,y)
        for c in catan.mapmodel.allCorners:
            corner = Corner(c)
Beispiel #3
0
                  17883920: [17605456],
                  17883984: [17605712],
                  17884112: [17605456],
                  17884176: [17606096],
                  17884368: [17605712],
                  17884560: [17606096]
          },
    }
    reg1 = {}
    reg2 = {}

    retval = catan.game.board.getStateToCopy(reg2)
    assert stateDict.keys() == retval.keys()
       

if __name__ == '__main__':
    print 'Running tests...'
    import catan
    import events
    catan.init()
    events.post('PlayerJoin', catan.CPUPlayer(1))
    events.post('PlayerJoin', catan.CPUPlayer(2))
    events.post('PlayerJoin', catan.CPUPlayer(3))
    events.post('PlayerJoin', catan.HumanPlayer(4))
    events.post(events.Tick())

    test_Game()
    test_Player()
    test_Board()