Esempio n. 1
0
    def AI_move(self, player):

	debug_console.get()._print("Started dog AI_move")

	self.find_goal(player.pos)

	debug_console.get()._print("Found goal")

	coor = self.future_moves.pop(0)

	self.move(coor)

	return
Esempio n. 2
0
def main(): 

    curses.initscr()
    curses.noecho()
    curses.curs_set(0)

    if farm_config.INTRO:
	windows.start_introwin()

    if farm_config.DEBUG_WIN:
	debug_console.get()

    farm_game = game.get_instance()
    farm_game.run()
Esempio n. 3
0
    def __init__(self):

	self.name = 'World'

	Space.__init__(self)

	if farm_config.DEBUG_WIN:
	    debug_console.get()._print("World created.")

	self.house = House(1, 1, HOUSE_GRAPHIC, self)
	self.ship_box = Shipbox(4, 12, SHIP_BOX_GRAPHIC, self)
	self.pond = Pond(GAME_WIN_SIZE_Y - 5,
			 GAME_WIN_SIZE_X - 16,
			 POND_GRAPHIC,
			 self
			 )

	self.seed(Cave_Entrance, CAVE_GRAPHICS_DIR + 'entrance_external', 1)
	self.seed(Tree, 'GRAPHICS/tree', NUMBER_TREES)
	self.seed(Rock, 'GRAPHICS/rock', NUMBER_ROCKS)
	self.seed(Bush, 'GRAPHICS/bush', NUMBER_BUSHES)

	if farm_config.DEBUG_WIN:
	    debug_console.get()._print("World populated.")

	self.sort_contents()

	if farm_config.DEBUG_WIN:
	    debug_console.get()._print("World contents sorted.")
Esempio n. 4
0
    def updateNPCs(self):

        try:

            for pet in self.characters["Pet"]:
                debug_console.get()._print("Moving pet.")
                pet.AI_move(self.characters["Player"][0])

            for npc in self.characters["NPC"]:
                debug_console.get()._print("Moving npc.")
                npc.AI_move()

        except Exception as e:
            debug_console.get()._print(str(e))
            return
Esempio n. 5
0
    def __init__(self):

	if farm_config.DEBUG_WIN:
	    debug_console.get()._print("Cave created.")

	self.name = 'Cave'

	Space.__init__(self)

	# Used only by Astar
	self.closed_list = []

	self.seed(Room, CAVE_GRAPHICS_DIR + 'room', 5)

	if farm_config.DEBUG_WIN:
	    debug_console.get()._print("Rooms seeded.")

	entrance = Entrance(0,
			    10,
			    CAVE_GRAPHICS_DIR + 'entrance_internal',
			    self)

	rooms = self.contents['Room']

	self.Astar = RoomWrapper(Astar)
	halls = self.Astar(rooms, self.closed_list)

	if farm_config.DEBUG_WIN:
	    debug_console.get()._print("%d halls found." % len(halls))

	for coor in halls:

	    Hall.create(coor[0], coor[1], CAVE_GRAPHICS_DIR + 'hall', self)

	if farm_config.DEBUG_WIN:
	    debug_console.get()._print("Halls created.")
Esempio n. 6
0
    def find_goal(self, goal):

	debug_console.get()._print("In find_goal")

	start = self.pos
	end = goal 	

	debug_console.get()._print("Start and end found")

	closed_list = []

	for key in self.current_space.contents:
	    for obj in self.current_space.contents[key]:
		closed_list.extend(obj.boundaries)

	debug_console.get()._print("Starting Astar")

	self.future_moves = Astar(start, end, closed_list)