IAtari
Genetic algorithm generating AI capable to play Atari2600 games.
agent.cpp File Reference

Handle the true representation of an agent, i.e. an AI. More...

#include "agent.hpp"
#include "Random.h"
#include <random>
#include <algorithm>

Namespaces

 genetic_operators
 Handle genetic operations performed on agents.
 

Macros

#define BINARY(OP)
 
#define UNARY(OP)
 

Functions

std::ostream & operator<< (std::ostream &os, const agent &a)
 Operator << overloaded so that an agent's program can be displayed by using this operator directly on the agent. More...
 
static agent::instruction genetic_operators::random_instruction (const agent &a)
 Generate a random instruction. More...
 
void genetic_operators::initialize (agent &a)
 Initialize an agent with random instructions. More...
 
void genetic_operators::mutate (agent &a)
 Mutate an agent, i.e. modify some instructions. More...
 
void genetic_operators::crossover (agent &a1, agent &a2)
 Swap instructions between two agents. More...
 

Detailed Description

Handle the true representation of an agent, i.e. an AI.

Macro Definition Documentation

◆ BINARY

#define BINARY (   OP)
Value:
[](std::ostream& os, const agent& a, int reg_dst, int reg1, int reg2, int, int, int) \
{ \
os \
<< a.reg_to_string(reg_dst) \
<< " <- " \
<< a.reg_to_string(reg1) \
<< OP \
<< a.reg_to_string(reg2); \
}
Represents an agent, i.e. an AI.
Definition: agent.hpp:16

◆ UNARY

#define UNARY (   OP)
Value:
[](std::ostream& os, const agent& a, int reg_dst, int reg1, int, int, int, int) \
{ \
os \
<< a.reg_to_string(reg_dst) \
<< " <- " \
<< OP \
<< "(" \
<< a.reg_to_string(reg1) \
<< ")"; \
}
Represents an agent, i.e. an AI.
Definition: agent.hpp:16

Function Documentation

◆ operator<<()

operator<< ( std::ostream &  os,
const agent a 
)

Operator << overloaded so that an agent's program can be displayed by using this operator directly on the agent.

Returns
Display the agent's program