-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGenome.h
More file actions
49 lines (39 loc) · 1.33 KB
/
Genome.h
File metadata and controls
49 lines (39 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// Created by Owner on 2024/11/21.
//
#ifndef NEWDIRECTORY_GENOME_H
#define NEWDIRECTORY_GENOME_H
#include <cstdint>
#include "Player.h"
/**
* @struct Genome
* @brief バトルの最適化における個体の情報を管理する構造体
*
* この構造体は最適化アルゴリズムで使用される個体(Genome)のステータスや状態を表現します。
* 各個体はプレイヤー情報、ゲーム状態、ターン数、アクション履歴、フィットネススコアなどの情報を含みます。
* また、優先度付きキューでの操作のための比較演算子も実装されています。
*/
struct Genome {
Player AllyPlayer{};
Player EnemyPlayer{};
uint64_t state = 0;
int turn = 0;
int position = 0;
int fitness = 0;
int Visited = 0;
int EActions[2] = {};
int Aactions = 0;
int actions[350] = {};
bool Initialized = false;
int processed = 0;
// 比較演算子(優先度付きキュー用、fitnessが高い方が優先)
bool operator<(const Genome& other) const {
return (fitness) < (other.fitness);
//return fitness< other.fitness;
}
bool operator>(const Genome& other) const {
return (fitness) > (other.fitness);
//return fitness > other.fitness;
}
};
#endif //NEWDIRECTORY_GENOME_H