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

#include <agent.hpp>

Classes

struct  parameters
 

Public Types

enum  opcode {
  OP_NOP, OP_ADD, OP_MINUS, OP_MAX,
  OP_MIN, OP_UMINUS, OP_MUL, OP_DIV,
  OP_LOG, OP_EXP, OP_COS, OP_POPCOUNT,
  OP_IF, OP_SIZE
}
 
using instruction = uint64_t
 
using reg = double
 

Public Member Functions

 agent ()=default
 
 agent (const parameters &params)
 
int get_action (const std::vector< unsigned char > &screen)
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 
void reset_registers ()
 
bool execute_block (const std::vector< unsigned char > &screen, int block)
 
void execute_instruction (const std::vector< unsigned char > &screen, int pc)
 
double sigmoid (double x) const
 
auto begin_outputs ()
 
auto end_outputs ()
 
std::string reg_to_string (int reg) const
 
void print_instruction (std::ostream &, instruction ins) const
 
void print_block (std::ostream &, int block) const
 

Public Attributes

parameters params
 
std::vector< instructionprogram
 
std::vector< regregisters
 

Member Typedef Documentation

◆ instruction

using agent::instruction = uint64_t

◆ reg

using agent::reg = double

Member Enumeration Documentation

◆ opcode

Enumerator
OP_NOP 
OP_ADD 
OP_MINUS 
OP_MAX 
OP_MIN 
OP_UMINUS 
OP_MUL 
OP_DIV 
OP_LOG 
OP_EXP 
OP_COS 
OP_POPCOUNT 
OP_IF 
OP_SIZE 

Constructor & Destructor Documentation

◆ agent() [1/2]

agent::agent ( )
default

◆ agent() [2/2]

agent::agent ( const parameters params)

Member Function Documentation

◆ begin_outputs()

auto agent::begin_outputs ( )
inline

◆ end_outputs()

auto agent::end_outputs ( )
inline

◆ execute_block()

bool agent::execute_block ( const std::vector< unsigned char > &  screen,
int  block 
)

◆ execute_instruction()

void agent::execute_instruction ( const std::vector< unsigned char > &  screen,
int  pc 
)
inline

◆ get_action()

int agent::get_action ( const std::vector< unsigned char > &  screen)

◆ print_block()

void agent::print_block ( std::ostream &  os,
int  block 
) const

◆ print_instruction()

void agent::print_instruction ( std::ostream &  os,
instruction  ins 
) const

◆ reg_to_string()

std::string agent::reg_to_string ( int  reg) const

◆ reset_registers()

void agent::reset_registers ( )

◆ serialize()

template<typename Archive >
void agent::serialize ( Archive &  ar,
const unsigned int   
)
inline

◆ sigmoid()

double agent::sigmoid ( double  x) const
inline

Member Data Documentation

◆ params

parameters agent::params

◆ program

std::vector<instruction> agent::program

◆ registers

std::vector<reg> agent::registers

The documentation for this struct was generated from the following files: