#ifndef TABLE_FITNESS_H
#define TABLE_FITNESS_H

#include "generic_individual.h"
#include "generic_fitness.h"

#define TF_RT_NO_FILENAME_GIVEN -1
#define TF_RT_ROW_TOO_SHORT -2
#define TF_RT_FILE_ERROR -3

#define TF_GF_WRONG_CELL_COUNT -10

#define DONT_CARE 'x'

class table_fitness : public generic_fitness {
  char **table;
  int row_size; // set by read_table(), checked by get_fitness()

  int read_table(char *, int);
  void reset_table();
  void delete_table();

  bool compare_vectors(char *, char *, int);
  float cover_table(char *, int);

  float get_matrix_fitness(GENE *, GENE *, int, int);
  float get_rule_fitness(int *, GENE *, int, int);
public:
  table_fitness(int *, int, char *, int); // a rules-based ind.
  table_fitness(char *, int); // a matrix-based ind.

  ~table_fitness() {
    delete_rule_table();
    delete_table();
  }

  float get_fitness(generic_individual *, int);
};

#endif /* TABLE_FITNESS_H */

