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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use std::fmt::{Display, Debug, Formatter, Error};
pub use gdl_parser::{Description, Clause, Rule, Sentence, Term, Literal, Constant, Variable,
Function, Relation, Proposition, Not, Or, Distinct};
pub use gdl_parser::parse;
#[allow(unused)]
pub mod constants {
use gdl::{Constant, Move};
lazy_static! {
pub static ref TRUE_CONST: Constant = Constant::new("true");
pub static ref DOES_CONST: Constant = Constant::new("does");
pub static ref NEXT_CONST: Constant = Constant::new("next");
pub static ref LEGAL_CONST: Constant = Constant::new("legal");
pub static ref GOAL_CONST: Constant = Constant::new("goal");
pub static ref TERMINAL_CONST: Constant = Constant::new("terminal");
pub static ref NIL_MOVE: Move = Move::new(Constant::new("nil").into());
}
}
pub type Score = u8;
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct Role {
name: String
}
impl Role {
pub fn new<T: Into<String>>(name: T) -> Role {
Role { name: name.into() }
}
pub fn name(&self) -> &str {
&self.name
}
}
#[derive(Clone, Eq, PartialEq, Hash)]
pub struct Move {
#[doc(hidden)]
pub contents: Term
}
impl Move {
#[doc(hidden)]
pub fn new(t: Term) -> Move {
Move { contents: t }
}
}
impl Display for Move {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "{}", self.contents.to_string())
}
}
impl Debug for Move {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
Display::fmt(self, f)
}
}