diff --git a/gamelog.ron b/gamelog.ron index 9947a0a..f92dc86 100644 --- a/gamelog.ron +++ b/gamelog.ron @@ -4,19 +4,358 @@ [ GameRecord( - version: "0.1.0", + version: "0.2.0", periods: [ Period( start: First, - end: Fourth, + end: Third, plays: [ Play( action: None, down: Kickoff( - offence: Nebraska + offence: ArizonaState ), terrain: Distance(10) ), + Play( + action: None, + down: First, + terrain: 10 + ), + Play( + action: None, + down: Second, + terrain: 2 + ), + Play( + action: ThrowLeft, + down: First, + terrain: 10 + ), + Play( + action: ThrowRight, + down: Second, + terrain: 10 + ), + Play( + action: None, + down: First, + terrain: 10 + ), + Play( + action: PlayAction ThrowRight, + down: Second, + terrain: 2 + ), + Play( + action: PlayAction RunRight, + down: Third, + terrain: 7 + ), + Play( + action: HandoffRushLeft, + down: Fourth, + terrain: 11 + ), + Play( + action: None, + down: First, + terrain: 10 + ), + TURNOVER, + Play( + action: PlayAction ThrowRight, + down: Second, + terrain: 11 + ), + Play( + action: None, + down: Third, + terrain: 9 + ), + Play( + action: PassCentre, + down: First, + terrain: 10 + ), + Play( + action: TossRunRight, + down: Second, + terrain: 3 + ), + Play( + action: FailedThrow, + down: First, + terrain: 10 + ), + Play( + action: Kickoff( offence: TexasAnM ), + down: First, + terrain: 10 + ), + Play( + action: SpikeCentre, + down: Second, + terrain: 6 + ), + Play( + action: None, + down: Third, + terrain: 13 + ), + Play( + action: ThrowRight, + down: Fourth, + terrain: 13 + ), + TURNOVER + Play( + action: ShotgunDoubleFlex Throw, + down: Second, + terrain: 10 + ), + Play( + action: SpikeCentre, + down: First, + terrain: 10 + ), + Play( + action: Dupe SpikeCentre, + down: First, + terrain: 10 + ), + Play( + action: FailedThrow, + down: Second, + terrain: 10 + ), + Play( + action: TransferRushRight, + down: Third, + terrain: 15 + ), + ] + ), + //Texas offence + Period( + start: Fourth, + end: None, + plays: [ + Play( + action: None, + down: Fourth, + terrain 17 + ), + Play( + action: Punt, + down: First, + terrain: 10 + ), + Play( + action: ThrowLeft, + down: First, + terrain: 10 + ), + Play( + action: None, + down: First, + terrain: 10 + ), + Play( + action: ThrowCentre, + down: First, + terrain: 10 + ), + Play( + action: Transfer RunLeft, + down: Second, + terrain: 12 + ), + Play( + action: ThrowCentre, + down: First, + terrain: 10 + ), + Play( + action: TransferRushRight, + down: Second, + terrain: 8 + ), + Play( + action: , + down: First, + terrain: 10 + ), + Play( + action: Kickoff(offence: ArizonaState), + down: First, + terrain: 10 + ), + ] + ) + ] + ), + GameRecord( + version: "0.2.0", + periods: [ + Period( + start: First, + end: None, + plays: [ + Play( + action: None + down: Kickoff(offence: Syracuse), + terrain: Distance(10) + + ), + Play( + action: None, + down: Second, + terrain: 3 + ), + Play( + action: SpikeCentre, + down: Third, + terrain: 3, + ), + Play( + action: Curls, + down: Fourth, + terrain: 3 + ), + Play( + action: Mesh || PassCentre, + down: First, + terrain: 10 + ), + Play( + action: None, + down: Second, + terrain: 15 + ), + Play( + action: PlayAction ThrowLeft, + down: First, + terrain: 10 + ) + ] + ), + Period( + start: Second, + end: None, + plays: [ + Play( + action: PA ThrowCentre, + down: Second, + terrain: 10 + ), + Play( + action: Transfer Rush Centre/Left, + down: First, + terrain: 10 + ), + Play( + action: Shotgun ThrowRight, + down: Second, + terrain: 8 + ), + Play( + action: PlayAction RushRight, + down: Third, + terrain: 1 + ), + Play( + action: HB? Rush Centre/Right, + down: Fourth, + terrain: 6 + ), + Play( + action: PlayAction RushCentre, + ), + //Turnover, Colorado Offence + Play( + action: ShotgunDoubleFlex PlayActionComebacks, //Big Throw Right + down: First, + terrain: 10 + ), + Play( + action: Transfer HB? RushCentre, + down: Second, + terrain: 9 + ), + Play( + action: FailedThrow, + down: Third, + terrain: 17 + ), + Play( + action: Same FailedThrow, + ) + ] + ), + Period( + start: Third, + end: None, + plays: [ + Play( + action: Kickoff(offence:Colorado), + down: First, + terrain: 10 + ), + Play( + action: ThrowRight, + down: First, + terrain: 10 + ), + Play( + action: ShotgunDoubleFlex ThrowRight, + down: First, + terrain: 10 + ), + Play( + action: Pass RushCentre, + down: First, + terrain: 10 + ), + Play( + action: PowerZero, + down: Second, + terrain: 6 + ) + ] + ), + Period( + start: Fourth, + end: None, + plays: [ + Play( + action: CrackStudentBodyRightTackle, + down: Third, + terrain: 11 + ), + Play( + action: SpikeCentre, + down: Fourth, + terrain: 3 + ), + Play( + action: SpecialTeams... PuntIntoNet, + ), + Play( + action: Kickoff(offence: Syracuse), + down: First, + terrain: 10 + ), + Play( + action: PlayAction ThrowCentre, + down: First, + terrain: 10 + ), + Play( + action: SpeedOption, + down: Second, + terrain: 3 + ) ] ) ] diff --git a/.gitignore b/gamelog/.gitignore similarity index 100% rename from .gitignore rename to gamelog/.gitignore diff --git a/gamelog/Cargo.lock b/gamelog/Cargo.lock new file mode 100644 index 0000000..a94f63e --- /dev/null +++ b/gamelog/Cargo.lock @@ -0,0 +1,104 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +dependencies = [ + "serde", +] + +[[package]] +name = "gamelog" +version = "0.3.0" +dependencies = [ + "ron", + "semver", + "serde", +] + +[[package]] +name = "proc-macro2" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "ron" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63f3aa105dea217ef30d89581b65a4d527a19afc95ef5750be3890e8d3c5b837" +dependencies = [ + "base64", + "bitflags", + "serde", + "serde_derive", + "unicode-ident", +] + +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "syn" +version = "2.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" diff --git a/gamelog/Cargo.toml b/gamelog/Cargo.toml new file mode 100644 index 0000000..e80c272 --- /dev/null +++ b/gamelog/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "gamelog" +version = "0.3.0" +edition = "2024" + +[dependencies] +ron = "0.9" + +[dependencies.semver] +version = "1.0" +features = ["serde"] + +[dependencies.serde] +version = "1.0" +features = ["derive"] diff --git a/src/error.rs b/gamelog/src/error.rs similarity index 93% rename from src/error.rs rename to gamelog/src/error.rs index 5432365..7816ff0 100644 --- a/src/error.rs +++ b/gamelog/src/error.rs @@ -14,7 +14,7 @@ impl fmt::Display for LogFileError { Self::CompatibilityCheck(ver) => write!( f, "GameLogs cannot be older than {}, but {} was found in logfile.", - crate::gamelog::GAMELOG_MIN_VER.to_string(), + crate::MIN_VER.to_string(), ver.to_string() ), Self::RonSpannedError(err) => write!(f, "{}", err), diff --git a/src/gamelog/file.rs b/gamelog/src/file.rs similarity index 97% rename from src/gamelog/file.rs rename to gamelog/src/file.rs index 5264a26..3bda9da 100644 --- a/src/gamelog/file.rs +++ b/gamelog/src/file.rs @@ -49,7 +49,7 @@ impl LogFile { fn is_compatible(&self) -> bool { self.clone() .get_min_ver() - .cmp_precedence(&super::GAMELOG_MIN_VER) + .cmp_precedence(&super::MIN_VER) .is_lt() } diff --git a/src/gamelog/mod.rs b/gamelog/src/lib.rs similarity index 58% rename from src/gamelog/mod.rs rename to gamelog/src/lib.rs index 58d1ec9..fc2a82e 100644 --- a/src/gamelog/mod.rs +++ b/gamelog/src/lib.rs @@ -1,9 +1,11 @@ +mod error; mod file; mod period; mod play; mod terrain; -pub const GAMELOG_MIN_VER: semver::Version = semver::Version::new(0, 2, 0); +#[allow(unused)] +pub const MIN_VER: semver::Version = semver::Version::new(0, 2, 0); pub use file::LogFile; pub use period::*; diff --git a/src/gamelog/period.rs b/gamelog/src/period.rs similarity index 79% rename from src/gamelog/period.rs rename to gamelog/src/period.rs index 6725d13..b062687 100644 --- a/src/gamelog/period.rs +++ b/gamelog/src/period.rs @@ -1,5 +1,8 @@ use serde::Deserialize; +#[deprecated(since = "0.2.0", note = "Migrated to Game")] +type GameRecord = Game; + #[derive(Debug, Deserialize, Clone)] pub struct Game { pub version: semver::Version, @@ -19,4 +22,5 @@ pub enum Quarter { Second, Third, Fourth, + Overtime(u8), } diff --git a/src/gamelog/play.rs b/gamelog/src/play.rs similarity index 100% rename from src/gamelog/play.rs rename to gamelog/src/play.rs diff --git a/src/gamelog/terrain.rs b/gamelog/src/terrain.rs similarity index 52% rename from src/gamelog/terrain.rs rename to gamelog/src/terrain.rs index 3c00de2..dcfe9ab 100644 --- a/src/gamelog/terrain.rs +++ b/gamelog/src/terrain.rs @@ -2,7 +2,10 @@ use serde::Deserialize; #[derive(Debug, Deserialize, Clone)] pub enum TerrainState { + #[deprecated(since = "0.2.0", note = "Replaced in favour of TerrainState::Yards")] + Distance(u8), Yards(u8), GoalLine, Inches, + Unknown, } diff --git a/miller/.gitignore b/miller/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/miller/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/miller/Cargo.lock similarity index 98% rename from Cargo.lock rename to miller/Cargo.lock index 81f6e96..1916530 100644 --- a/Cargo.lock +++ b/miller/Cargo.lock @@ -62,6 +62,15 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +[[package]] +name = "gamelog" +version = "0.3.0" +dependencies = [ + "ron", + "semver", + "serde", +] + [[package]] name = "heck" version = "0.5.0" @@ -73,9 +82,7 @@ name = "miller" version = "0.1.0" dependencies = [ "clap", - "ron", - "semver", - "serde", + "gamelog", ] [[package]] diff --git a/Cargo.toml b/miller/Cargo.toml similarity index 70% rename from Cargo.toml rename to miller/Cargo.toml index 336bc96..c76f02a 100644 --- a/Cargo.toml +++ b/miller/Cargo.toml @@ -5,13 +5,6 @@ edition = "2024" license = "MIT" license-file = "LICENSE" -[dependencies] -ron = "0.9" - -[dependencies.semver] -version = "1.0" -features = ["serde"] - [dependencies.clap] version = "4.5" default-features = false @@ -28,6 +21,5 @@ features = [ "string", ] -[dependencies.serde] -version = "1.0" -features = ["derive"] +[dependencies.gamelog] +path = "./gamelog" diff --git a/src/calculator.rs b/miller/src/calculator.rs similarity index 100% rename from src/calculator.rs rename to miller/src/calculator.rs diff --git a/src/main.rs b/miller/src/main.rs similarity index 97% rename from src/main.rs rename to miller/src/main.rs index 4378b0f..e69f17b 100644 --- a/src/main.rs +++ b/miller/src/main.rs @@ -1,6 +1,4 @@ mod calculator; -mod error; -mod gamelog; use clap::Parser; use core::panic; diff --git a/templates/logfile.ron b/templates/logfile.ron index ffc402d..ffc050e 100644 --- a/templates/logfile.ron +++ b/templates/logfile.ron @@ -4,7 +4,7 @@ [ GameRecord( - version: "0.2.0", + version: "0.3.0", periods: [ Period( start: First,