From 7d3bc15cd24f2a1f79e9cc4042300d85fc6f2f16 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 27 Feb 2024 11:56:51 -0500 Subject: [PATCH] format environment --- src/environments/environment.jl | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/environments/environment.jl b/src/environments/environment.jl index 7be77f6..14e1e47 100644 --- a/src/environments/environment.jl +++ b/src/environments/environment.jl @@ -1,20 +1,16 @@ export step!, done, play # Creation should be done as an environment constructor -function step!(env::AbstractEnvironment, args...; kwargs...) - @error "step! not implemented for $(typeof(env))" -end -function done(::AbstractEnvironment)::Bool - true -end +done(::AbstractEnvironment)::Bool = true play(match::Match) = play(match.environment_creator, match.individuals) -function play(environment_creator::AbstractCreator, individuals::Vector{<:AbstractIndividual}) - play(environment_creator(), develop.(individuals)) +step!(env::AbstractEnvironment, args...; kwargs...) = + @error "step! not implemented for $(typeof(env))" -end +play(environment_creator::AbstractCreator, individuals::Vector{<:AbstractIndividual}) = + play(environment_creator(), develop.(individuals)) function play(env::AbstractEnvironment, phenotypes::Vector{<:AbstractPhenotype}) is_done = false - scores = zeros(length(phenotypes)) + scores = zeros(Float32, length(phenotypes)) while !is_done scores += step!(env, phenotypes) is_done = done(env)