예제 #1
0
if __name__ == "__main__":

    # gameFilename = "examples.gridphysics.simpleGame_push_boulders_multigoal"
    # gameFilename = "examples.gridphysics.waypointtheory"
    # gameFilename = "examples.gridphysics.demo_teleport"
    # gameFilename = "examples.gridphysics.movers3c"
    # gameFilename = "examples.gridphysics.scoretest"
    # gameFilename = "examples.gridphysics.portals"
    gameFilename = "examples.gridphysics.demo_transform_small"

    # gameFilename = "examples.gridphysics.demo_dodge"
    # gameFilename = "examples.gridphysics.rivercross"
    # gameFilename = "examples.gridphysics.demo_chaser_transformer"

    gameString, levelString = defInputGame(gameFilename, randomize=True)
    rleCreateFunc = lambda: createRLInputGame(gameFilename)
    rle = rleCreateFunc()

    p = Planner(rle, gameString, levelString)
    embed()
    # print rle.show()
    # print ""
    # print "Initializing learner. Playing", gameFilename
    # ql = QLearner(rle, gameString, levelString, alpha=1, epsilon=.5, gamma=.9, \
    # 	episodes=200, partitionWeights=[20,0], stepLimit=100)
    # # ql.immovables = ['wall', 'poison']

    # # embed()
    # t1 = time.time()
    # ql.learn(satisfice=0)
    # time_elapsed = time.time()-t1
예제 #2
0
파일: mcts_old.py 프로젝트: lcary/RC_RL
				new_state = res["observation"]
				terminal = not res['pcontinue']
				print rle.show()
				finalStates.append(rle._game.getFullState())

		i+=1

	if playback:
		from vgdl.core import VGDLParser
		from examples.gridphysics.simpleGame_randomNPC import box_level, push_game
		game = push_game
		level = box_level
		VGDLParser.playGame(game, level, finalStates)

	# return finalStates

if __name__ == "__main__":
	## passing a function. That function contains things set in
	## 'rlenvironmentnonstatic' file
	## You have to make a function that creates the environment.
	## Make the game, then follow the layout in 'rlenvironmentnonstatic'
	
	filename = "examples.gridphysics.simpleGame4_huge"
	game_to_play = lambda obsType: createRLInputGame(filename)
	planActLoop(game_to_play, 10, 100, 50)
	embed()

	# planActLoop(game_to_play, 10, 100, 50)


예제 #3
0
파일: bigloop2.py 프로젝트: lcary/RC_RL
		print "in playback"
		from vgdl.core import VGDLParser
		from examples.gridphysics.simpleGame4 import level, game
		playbackGame = push_game
		playbackLevel = box_level
		embed()
		VGDLParser.playGame(playbackGame, playbackLevel, total_states_encountered)

	return hypotheses, won, unknown_objects, goalColor, finalEventList, total_states_encountered

if __name__ == "__main__":

	finalEventList = []

	filename = "examples.gridphysics.simpleGame4"
	game_to_play = lambda: createRLInputGame(filename)

	thinking_steps = 50
	thinking_default_steps=50
	
	numEpisodes = 10

	hypotheses, tally = [], []
	unknown_objects = False
	goalColor = None
	# goalColor='BROWN'
	for episode in range(numEpisodes):
		hypotheses, won, unknown_objects, goalColor, finalEventList, total_states_encountered = \
		playEpisode(rleCreateFunc=game_to_play, hypotheses=hypotheses, \
			unknown_objects=unknown_objects, goalColor=goalColor, finalEventList=finalEventList, \
			playback=True)