@@ -8,8 +8,10 @@ use crate::{game::{Game, Normal, NormalImpartial}, player::ImpartialPlayer};
8
8
/// two impartial normal combinatorial games.
9
9
///
10
10
/// Since `Game` isn't object safe, we use `dyn Any` internally with downcast safety.
11
+ ///
12
+ /// We restrict games to being normal impartial to force implementation of the marker trait.
11
13
#[ derive( Clone ) ]
12
- pub struct DisjointImpartialNormalGame < L : Game , R : Game > {
14
+ pub struct DisjointImpartialNormalGame < L : Game + NormalImpartial , R : Game + NormalImpartial > {
13
15
left : L ,
14
16
right : R
15
17
}
@@ -31,9 +33,20 @@ pub enum DisjointMoveError<L: Game, R: Game> {
31
33
type LeftMoveMap < L , R > = Box < dyn Fn ( <L as Game >:: Move ) -> DisjointMove < L , R > > ;
32
34
type RightMoveMap < L , R > = Box < dyn Fn ( <R as Game >:: Move ) -> DisjointMove < L , R > > ;
33
35
34
- impl < L : Game + Debug + ' static , R : Game + Debug + ' static > Normal for DisjointImpartialNormalGame < L , R > { }
35
- impl < L : Game + Debug + ' static , R : Game + Debug + ' static > NormalImpartial for DisjointImpartialNormalGame < L , R > { }
36
- impl < L : Game + Debug + ' static , R : Game + Debug + ' static > Game for DisjointImpartialNormalGame < L , R > {
36
+ impl <
37
+ L : Game + Debug + NormalImpartial + ' static ,
38
+ R : Game + Debug + NormalImpartial + ' static
39
+ > Normal for DisjointImpartialNormalGame < L , R > { }
40
+
41
+ impl <
42
+ L : Game + Debug + NormalImpartial + ' static ,
43
+ R : Game + Debug + NormalImpartial + ' static
44
+ > NormalImpartial for DisjointImpartialNormalGame < L , R > { }
45
+
46
+ impl <
47
+ L : Game + Debug + NormalImpartial + ' static ,
48
+ R : Game + Debug + NormalImpartial + ' static
49
+ > Game for DisjointImpartialNormalGame < L , R > {
37
50
type Move = DisjointMove < L , R > ;
38
51
type Iter < ' a > = Interleave <
39
52
Map < <L as Game >:: Iter < ' a > , LeftMoveMap < L , R > > ,
0 commit comments