Ejemplo n.º 1
0
def testConstantAverage():
    "test rolling pace when other boat moves at a constant rate"
    ob = BoatConstant("constant")
    b = BoatRollingAverage("test", ob, 100)
    ob.pace = 90
    time = 1
    for distance in xrange(1, 111):
        ob.distance = distance
        b.move(time)
        time += 1
    assert b.pace == 90, "b.pace was %s" % b.pace
Ejemplo n.º 2
0
def testConstantAverage():
    "test rolling pace when other boat moves at a constant rate"
    ob = BoatConstant("constant")
    b = BoatRollingAverage("test", ob, 100)
    ob.pace = 90
    time = 1
    for distance in xrange(1, 111):
        ob.distance = distance
        b.move(time)
        time += 1
    assert b.pace == 90, "b.pace was %s" % b.pace
Ejemplo n.º 3
0
def testAverageAfterBufferHasRolled():
    "test that the rolling boat pace is the average of the last 100 paces' when set to update every meter"
    # so the other pat pace goes from 0 to 200, we set rolling to look average the last 100, therefore rolling pace should be 150
    ob = BoatConstant("constant")
    b = BoatRollingAverage("test", ob, 100, 1)
    ob.pace = 0
    time = 1
    for distance in xrange(0, 200):
        ob.distance = distance
        b.move(time)
        time += 1
        ob.pace += 1
    assert b.pace == 150, "b.pace is:%s, ob.pace is %s, ave=%s" % (b.pace, ob.pace, b.buffer.average)
Ejemplo n.º 4
0
def testAverageAfterBufferHasRolled():
    "test that the rolling boat pace is the average of the last 100 paces' when set to update every meter"
    # so the other pat pace goes from 0 to 200, we set rolling to look average the last 100, therefore rolling pace should be 150
    ob = BoatConstant("constant")
    b = BoatRollingAverage("test", ob, 100, 1)
    ob.pace = 0
    time = 1
    for distance in xrange(0, 200):
        ob.distance = distance
        b.move(time)
        time += 1
        ob.pace += 1
    assert b.pace == 150, "b.pace is:%s, ob.pace is %s, ave=%s" % (
        b.pace, ob.pace, b.buffer.average)
Ejemplo n.º 5
0
def main():
    # init the player boat
    player = BoatConcept2(dynrow_args.args.name)
    playground.setPlayerBoat(player)

    #init the AI boats
    playground.addBoat(BoatBoomerang("Armin", 130, 20, 20))
    playground.addBoat(BoatBoomerang("Bahne", 135, 22, 20))
    playground.addBoat(BoatRollingAverage("Emil", playground.getPlayerBoat()))

    if not newestGhost == "":
        playground.addBoat(BoatGhost("Ghost", newestGhost))

    # Init the Concept2
    ErgStats.connectToErg()

    #init the UI, register the GameLoop and run it
    ui.registerCallback(gameLoop)
    ui.setCycleTime(DELTAT)
    ui.run()
Ejemplo n.º 6
0
def testReset():
    "simple test for the framework as much as the reset"
    b = BoatRollingAverage("test", BoatConstant("constant"))
    b.pace = 120
    b.reset()
    assert b.pace == BoatRollingAverage.DEFAULT_PACE
Ejemplo n.º 7
0
def testReset():
    "simple test for the framework as much as the reset"
    b = BoatRollingAverage("test", BoatConstant("constant"))
    b.pace = 120
    b.reset()
    assert b.pace == BoatRollingAverage.DEFAULT_PACE