Skip to content

Commit

Permalink
Play/Discard now work using Hint instead of card index, Adding Privat…
Browse files Browse the repository at this point in the history
…eInfo, reworking rollout to use both private/public info
  • Loading branch information
coreylowman committed Oct 12, 2020
1 parent a70df5b commit 503ed54
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 151 deletions.
28 changes: 21 additions & 7 deletions src/env.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
use crate::rand::Rng;

pub trait Env {
type PublicInfo;
type Action;
type Reward;

pub trait HasEnd {
fn is_over(&self) -> bool;
}

pub trait HasReward {
type Reward;
fn reward(&self) -> Self::Reward;
fn public_info(&self, player_perspective: bool) -> Self::PublicInfo;
fn determinize<R: Rng>(public_info: &Self::PublicInfo, rng: &mut R) -> Self;
}

pub trait Env: HasEnd + HasReward {
type PublicInfo: HasEnd + HasReward + Clone;
type PrivateInfo: Clone;
type Action;

fn determinize<R: Rng>(
public_info: &Self::PublicInfo,
private_info: &Self::PrivateInfo,
rng: &mut R,
) -> Self;

fn public_info(&self) -> Self::PublicInfo;
fn private_info(&self, player_perspective: bool) -> Self::PrivateInfo;

fn actions(&self) -> Vec<Self::Action>;
fn step<R: Rng>(&mut self, action: &Self::Action, rng: &mut R);
}
Loading

0 comments on commit 503ed54

Please sign in to comment.