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
use crate::neural_network::nn::NeuralNetwork;
use crate::topology::topology::Topology;
use async_trait::async_trait;
use num::Float;
use std::fmt::Display;
pub trait Game<T>
where
T: Float + std::ops::AddAssign + Display,
{
fn run_generation(&mut self) -> Vec<T>;
fn reset_players(&mut self, nets: Vec<NeuralNetwork<T>>);
fn post_training(&mut self, history: &[Topology<T>]);
}
#[async_trait]
pub trait GameAsync<T>: Game<T>
where
T: Float + std::ops::AddAssign + Display,
{
async fn run_generation_async(&mut self) -> Vec<T>;
}