Code Refactor #4
345
gamelog.ron
345
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
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
0
.gitignore → gamelog/.gitignore
vendored
0
.gitignore → gamelog/.gitignore
vendored
104
gamelog/Cargo.lock
generated
Normal file
104
gamelog/Cargo.lock
generated
Normal file
@@ -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"
|
||||
15
gamelog/Cargo.toml
Normal file
15
gamelog/Cargo.toml
Normal file
@@ -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"]
|
||||
@@ -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),
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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::*;
|
||||
@@ -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),
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
1
miller/.gitignore
vendored
Normal file
1
miller/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
||||
13
Cargo.lock → miller/Cargo.lock
generated
13
Cargo.lock → miller/Cargo.lock
generated
@@ -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]]
|
||||
@@ -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"
|
||||
@@ -1,6 +1,4 @@
|
||||
mod calculator;
|
||||
mod error;
|
||||
mod gamelog;
|
||||
|
||||
use clap::Parser;
|
||||
use core::panic;
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
[
|
||||
GameRecord(
|
||||
version: "0.2.0",
|
||||
version: "0.3.0",
|
||||
periods: [
|
||||
Period(
|
||||
start: First,
|
||||
|
||||
Reference in New Issue
Block a user