-
Notifications
You must be signed in to change notification settings - Fork 173
/
controller_specialist_demo.py
executable file
·44 lines (34 loc) · 1.52 KB
/
controller_specialist_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. #
# specialist solutions for each enemy (game) #
# Author: Karine Miras #
# karine.smiras@gmail.com #
#######################################################################################
# imports framework
import sys, os
from evoman.environment import Environment
from demo_controller import player_controller
# imports other libs
import numpy as np
experiment_name = 'controller_specialist_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 single objective mode (specialist) 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,
visuals=True)
# tests saved demo solutions for each enemy
for en in range(1, 9):
#Update the enemy
env.update_parameter('enemies',[en])
# Load specialist controller
sol = np.loadtxt('solutions_demo/demo_'+str(en)+'.txt')
print('\n LOADING SAVED SPECIALIST SOLUTION FOR ENEMY '+str(en)+' \n')
env.play(sol)