-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller_generalist_demo.py
executable file
·44 lines (34 loc) · 1.5 KB
/
controller_generalist_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#######################################################################################
# EvoMan FrameWork - V1.0 2016 #
# DEMO : perceptron neural network controller evolved by Genetic Algorithm. #
# general solution for enemies (games) #
# Author: Karine Miras #
# karine.smiras@gmail.com #
#######################################################################################
# imports framework
import sys,os
sys.path.insert(0, 'evoman')
from environment import Environment
from demo_controller import player_controller
# imports other libs
import numpy as np
experiment_name = 'controller_generalist_demo'
if not os.path.exists(experiment_name):
os.makedirs(experiment_name)
# Update the number of neurons for this specific example
n_hidden_neurons = 0
# initializes environment for multi objetive mode (generalist) with static enemy and ai player
env = Environment(experiment_name=experiment_name,
playermode="ai",
player_controller=player_controller(n_hidden_neurons),
speed="normal",
enemymode="static",
level=2)
sol = np.loadtxt('solutions_demo/demo_all.txt')
print('\n LOADING SAVED GENERALIST SOLUTION FOR ALL ENEMIES \n')
# tests saved demo solutions for each enemy
for en in range(1, 9):
#Update the enemy
env.update_parameter('enemies',[en])
env.play(sol)
print('\n \n')