-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
172cc0d
commit ea200c2
Showing
37 changed files
with
252 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ | |
|
||
# Profiling output | ||
flamegraph.svg | ||
|
||
# Development data | ||
/data |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
//! under which all database implementations' errors can be grouped into). | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 2/24/2024 ([email protected]) | ||
use std::{error::Error, fmt}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
//! solution set data, hopefully in an efficient and scalable way. | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 4/14/2023 ([email protected]) | ||
use anyhow::Result; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
//! # Database Test Module | ||
//! # Database Test Utilities Module | ||
//! | ||
//! This module provides integration tests for the database module. | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Benjamin Riley Zimmerman, 3/8/2024 ([email protected]) | ||
// #[test] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
//! leaving this for cases where their functionality intersects. | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 2/24/2024 ([email protected]) | ||
use anyhow::Result; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
//! of memory may be materialized on arbitrary operations. | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 4/14/2023 ([email protected]) | ||
use anyhow::Result; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
//! in-memory hashmap. | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 2/24/2024 ([email protected]) | ||
use anyhow::Result; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
//! [1]: https://www.jaapsch.net/puzzles/crosstsr.htm | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 11/5/2023 ([email protected]) | ||
//! - Cindy Xu, 11/28/2023 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,4 @@ | |
//! which partially ensure compatibility with a game variant. | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 3/7/2023 ([email protected]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
//! game into parameters that can help build a game session. | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 11/5/2023 ([email protected]) | ||
//! - Atharva Gupta, 11/28/2023 | ||
//! - Cindy Xu, 11/28/2023 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
//! input or an incomplete game implementation. | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 2/24/2024 ([email protected]) | ||
use std::{error::Error, fmt}; | ||
|
@@ -48,12 +47,6 @@ pub enum GameError { | |
game_name: &'static str, | ||
hint: String, | ||
}, | ||
|
||
/// An error to indicate that a game-building rule within the abstract | ||
/// extensive mock game implementation was violated during construction. | ||
/// Since this is intended as an internal feature, it is a very general | ||
/// error variant. | ||
MockViolation { hint: String }, | ||
} | ||
|
||
impl Error for GameError {} | ||
|
@@ -93,7 +86,6 @@ impl fmt::Display for GameError { | |
hint, game_name | ||
) | ||
}, | ||
Self::MockViolation { hint } => write!(f, "{}", hint), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
//! Mock Extensive Game Builder Pattern Module | ||
//! Mock Extensive Test Game Builder Pattern Module | ||
//! | ||
//! This module provides an implementation of a declarative builder pattern for | ||
//! an extensive-form game `Session`, which allows the construction of a graph | ||
//! of nodes representing game states. | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 3/31/2024 | ||
//! - Max Fierro, 3/31/2024 ([email protected]) | ||
use anyhow::anyhow; | ||
use anyhow::Result; | ||
use petgraph::Direction; | ||
use petgraph::{graph::NodeIndex, Graph}; | ||
|
||
use std::collections::{HashMap, HashSet}; | ||
|
||
use crate::game::error::GameError::MockViolation; | ||
use crate::game::mock::Node; | ||
use crate::game::mock::Session; | ||
use crate::model::PlayerCount; | ||
|
@@ -81,8 +80,8 @@ impl<'a> SessionBuilder<'a> { | |
/// count that is incompatible with existing nodes. | ||
pub fn edge(mut self, from: &'a Node, to: &'a Node) -> Result<Self> { | ||
if let Node::Terminal(_) = from { | ||
Err(MockViolation { | ||
hint: format!( | ||
Err(anyhow! { | ||
format!( | ||
"There was an attempt to add a terminal node on the \ | ||
outgoing side of an edge during the construction of the \ | ||
game '{}'.", | ||
|
@@ -120,8 +119,8 @@ impl<'a> SessionBuilder<'a> { | |
self.start = Some(index); | ||
Ok(self) | ||
} else { | ||
Err(MockViolation { | ||
hint: format!( | ||
Err(anyhow! { | ||
format!( | ||
"There was an attempt to set the start state of mock game \ | ||
'{}', but the indicated start node has not been added to \ | ||
the game yet.", | ||
|
@@ -160,8 +159,8 @@ impl<'a> SessionBuilder<'a> { | |
Node::Terminal(vector) => { | ||
let result = vector.len(); | ||
if result == 0 { | ||
Err(MockViolation { | ||
hint: format!( | ||
Err(anyhow! { | ||
format!( | ||
"While constructing the game '{}', there was an \ | ||
attempt to add a terminal node with containing no \ | ||
utility entries. Games with no players are not \ | ||
|
@@ -177,8 +176,8 @@ impl<'a> SessionBuilder<'a> { | |
|
||
if finalized { | ||
if new.terminal() && old_count != new_count { | ||
Err(MockViolation { | ||
hint: format!( | ||
Err(anyhow! { | ||
format!( | ||
"While constructing the game '{}', a terminal node was \ | ||
added containing {} utility entries, but then a new \ | ||
one was added with {} entries. Utility entries must be \ | ||
|
@@ -187,8 +186,8 @@ impl<'a> SessionBuilder<'a> { | |
), | ||
})? | ||
} else if new.medial() && new_count > old_count { | ||
Err(MockViolation { | ||
hint: format!( | ||
Err(anyhow! { | ||
format!( | ||
"While constructing the game '{}', a terminal node was \ | ||
added containing {} utility entries, but then a new \ | ||
medial node was added with a 0-indexed turn of {}, \ | ||
|
@@ -201,8 +200,8 @@ impl<'a> SessionBuilder<'a> { | |
} | ||
} else { | ||
if new.terminal() && new_count < old_count { | ||
Err(MockViolation { | ||
hint: format!( | ||
Err(anyhow! { | ||
format!( | ||
"While constructing the game '{}', a medial node was \ | ||
added with a 0-indexed turn of {}, but then a new \ | ||
terminal node was added with {} entries. All turn \ | ||
|
@@ -230,8 +229,8 @@ impl<'a> SessionBuilder<'a> { | |
if let Some(index) = self.start { | ||
Ok(index) | ||
} else { | ||
Err(MockViolation { | ||
hint: format!( | ||
Err(anyhow! { | ||
format!( | ||
"No starting node was specified for the game '{}'.", | ||
self.name, | ||
), | ||
|
@@ -263,8 +262,8 @@ impl<'a> SessionBuilder<'a> { | |
} | ||
} | ||
|
||
Err(MockViolation { | ||
hint: format!( | ||
Err(anyhow! { | ||
format!( | ||
"No terminal node is reachable from the node marked as the \ | ||
start in the game '{}'.", | ||
self.name | ||
|
@@ -283,8 +282,8 @@ impl<'a> SessionBuilder<'a> { | |
.count() | ||
.eq(&0) | ||
}) { | ||
Err(MockViolation { | ||
hint: format!( | ||
Err(anyhow! { | ||
format!( | ||
"There exists a medial state with no outgoing edges in the \ | ||
constructed game '{}', which is a contradiction.", | ||
self.name | ||
|
@@ -326,6 +325,10 @@ mod tests { | |
use super::*; | ||
use crate::node; | ||
|
||
/// Used for storing generated visualizations of the mock games being used | ||
/// for testing purposes in this module under their own subdirectory. | ||
const MODULE_NAME: &str = "mock-builder-tests"; | ||
|
||
#[test] | ||
fn cannot_add_incorrect_utility_entries() -> Result<()> { | ||
let m1 = node!(0); | ||
|
@@ -475,6 +478,7 @@ mod tests { | |
.start(&a)? | ||
.build()?; | ||
|
||
game.visualize(MODULE_NAME)?; | ||
assert_eq!(game.players, 2); | ||
|
||
Ok(()) | ||
|
@@ -505,6 +509,7 @@ mod tests { | |
.start(&a)? | ||
.build()?; | ||
|
||
game.visualize(MODULE_NAME)?; | ||
assert_eq!(game.players, 4); | ||
|
||
Ok(()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
//! Example Mock Game Module | ||
//! Example Mock Test Game Module | ||
//! | ||
//! This module provides concrete examples of small games that adhere to useful | ||
//! interface definitions that can be used for testing purposes. The games here | ||
//! are built over the `mock` game graph implementation. | ||
//! | ||
//! #### Authorship | ||
//! | ||
//! - Max Fierro, 4/8/2024 |
Oops, something went wrong.