예제 #1
0
파일: Test.py 프로젝트: nebulak/Creatures
    def milestone2(self):
        """ tests Milestone 2

        """ 
        world = World(79, 29, 6, 12, 7, 25)
        world_controller = WorldController(world)
        command_interpreter = CommandInterpreter(world_controller)
        command_interpreter.spawn(20, "Corn", world_controller)
        print("initial World with 20 Corn objects")
        world_controller.printWorld()
        print("cumputing 30 lifecycles")
        print("new world after 30 lifecycles")
        cycle_rounds = 30
        for i in range(0, cycle_rounds):
            world_controller.computeLifeCycle()
        world_controller.printWorld()
예제 #2
0
파일: main.py 프로젝트: nebulak/Creatures
"""Starts the Simulation.

Creates a World-, WorldController- and CommandInterpreter Object. Gets User\
input and calls CommandInterpreter.unteroret_command() with it.

"""

from CommandInterpreter import CommandInterpreter
from World import World
from WorldController import WorldController
from copy import copy
from random import random
from Corn import Corn

# main

world = World(79, 29, 6, 12, 7, 25)
world_controller = WorldController(world)
command_interpreter = CommandInterpreter(world_controller)

runProgram = True
world_controller.printWorld()

while(runProgram):
	input_string = input("Enter command <h> for help, <Return> for next cycle)\
                             >>")
	runProgram = command_interpreter.interpret_command(input_string)
예제 #3
0
파일: Test.py 프로젝트: nebulak/Creatures
    def milestone1(self):
        """ tests Milestone 1

        """ 
        world = World(20, 10, 6, 12, 7, 25)
        world_controller = WorldController(world)
        thing1 = Thing(15, 0, world_controller)
        thing2 = Thing(15, 9, world_controller)
        world_controller.addThingAtPos(15, 0, thing1)
        world_controller.addThingAtPos(15, 9, thing2)
        print(world_controller.getThingAtPos(15, 0).symbol)
        world_controller.getNorthAt(15, 0)
        world_controller.deleteThingAtPos(15, 9)
        world_controller.getNorthAt(15, 0)
        world_controller.printWorld()