Ejemplo n.º 1
0
def print_game_status():
    print "game (printing board, top tiles only)"
    print_board(9,9,False)
    x,y = tw.chips_pos()
    print "game (Keys R:%d B:%d Y:%d G:%d)" % tw.get_keys()
    print "game (Boots Ice:%d Suction:%d Fire:%d Water:%d)" % tw.get_boots()
    print "game (Player: %d,%d)" % (x, y)
    print "game (Chips left: %d)" % tw.chips_needed()
Ejemplo n.º 2
0
def verbose_agent():
    """print out lots of debug and then return a random direction"""
    print_board(9,9)
    x,y = tworld.chips_pos()
    print "Keys R:%d B:%d Y:%d G:%d" % tworld.get_keys()
    print "Boots Ice:%d Suction:%d Fire:%d Water:%d" % tworld.get_boots()
    print "(%d,%d)" % (x, y)
    print "Chips left: %d" % tworld.chips_needed()
    return random_move()
Ejemplo n.º 3
0
 def write_chips_pddl(self, out):
     """produce the pddl for the board in it's current state to explore"""
     print >> out, """(define (problem p01-%d-cc)
       (:domain chips-challenge)
       """ % self.tick
     max_num = tw.chips_needed() + 5
     produce_objects( out, max_num)
     self.produce_init( out, max_num)
     self.produce_chips_goal( out)
     print >> out, ")"
Ejemplo n.º 4
0
 def write_random_explore_pddl(self, out):
 #ugly code duplication, but project due in 2 days!
     """produce the pddl for the board in it's current state to explore"""
     print >> out, """(define (problem p01-%d-cc)
       (:domain chips-challenge)
       """ % self.tick
     max_num = tw.chips_needed() + 5
     produce_objects( out, max_num)
     self.produce_init( out, max_num)
     self.produce_random_explore_goal( out)
     print >> out, ")"
Ejemplo n.º 5
0
 def produce_init( self, out, max_num ):
     """Produce intial state"""
     print >> out, """(:init"""
     print >> out, "(chips-left n%d)" % tw.chips_needed()
     print >> out, "(switched-walls-open n0)" 
     print >> out, "(has-keys red n%d)" % tw.get_keys()[0] 
     print >> out, "(has-keys blue n%d)" % tw.get_keys()[1]
     print >> out, "(has-keys yellow n%d)" % tw.get_keys()[2]
     print >> out, "(has-keys green n%d)" % tw.get_keys()[3]
     if tw.get_boots()[0]: # ICE
         print >> out, "(has-boots ice)"
     if tw.get_boots()[1]: # SUCTION
         print >> out, "(has-boots slide)"
     if tw.get_boots()[2]: # FIRE
         print >> out, "(has-boots fire)"
     if tw.get_boots()[3]: # WATER
         print >> out, "(has-boots water)"
     produce_succesors(out, max_num) 
     self.produce_predicates( out, 32, 32)
     print >> out, ")"