Darwin Neuroevolution Framework
pong.h
1 // Copyright 2018 The Darwin Neuroevolution Framework Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include "ann_player.h"
18 #include "game.h"
19 
20 #include <core/darwin.h>
21 
22 namespace pong {
23 
24 void init();
25 
58 class Pong : public darwin::Domain {
59  public:
60  size_t inputs() const override { return AnnPlayer::kInputs; }
61  size_t outputs() const override { return AnnPlayer::kOutputs; }
62 
63  bool evaluatePopulation(darwin::Population* population) const override;
64 
65  unique_ptr<core::PropertySet> calibrateGenotype(
66  const darwin::Genotype* genotype) const override;
67 };
68 
69 class Factory : public darwin::DomainFactory {
70  unique_ptr<darwin::Domain> create(const core::PropertySet& config) override;
71 
72  unique_ptr<core::PropertySet> defaultConfig(darwin::ComplexityHint hint) const override;
73 };
74 
75 } // namespace pong
size_t outputs() const override
Number of outputs from a Brain.
Definition: pong.h:61
ComplexityHint
A generic hint for the initial population & domain setup.
Definition: darwin.h:47
A population implementation encapsulates the fixed-size set of genotypes, together with the rules for...
Definition: darwin.h:161
Interface to the domain factory.
Definition: darwin.h:263
Definition: player.cpp:18
The foundation for data structures supporting runtime reflection.
Definition: properties.h:388
Domain: The classic Pong game.
Definition: pong.h:58
Interface to a domain implementation.
Definition: darwin.h:229
size_t inputs() const override
Number of inputs to a Brain.
Definition: pong.h:60
The interface to the population-specific "genetic material", the Genotype
Definition: darwin.h:126
bool evaluatePopulation(darwin::Population *population) const override
Assigns fitness values to every genotype.
Definition: pong.cpp:36