Give the bag module its name back
This commit is contained in:
parent
9cd889341f
commit
158b7a8dfd
5 changed files with 8 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use crate::{baggy::Tile, dictionary::Dictionary};
|
use crate::{bag::Tile, dictionary::Dictionary};
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum MoveError {
|
pub enum MoveError {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
use crate::baggy::Tile;
|
use crate::bag::Tile;
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct Word {
|
pub struct Word {
|
||||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -1,7 +1,7 @@
|
||||||
use player::PlayerId;
|
use player::PlayerId;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
mod baggy;
|
mod bag;
|
||||||
mod board;
|
mod board;
|
||||||
mod data;
|
mod data;
|
||||||
mod dictionary;
|
mod dictionary;
|
||||||
|
@ -10,20 +10,20 @@ mod player;
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum GameError {
|
pub enum GameError {
|
||||||
#[error("Not enough tiles in bag")]
|
#[error("Not enough tiles in bag")]
|
||||||
NotEnoughTiles(#[from] baggy::BagError),
|
NotEnoughTiles(#[from] bag::BagError),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Game {
|
pub struct Game {
|
||||||
board: board::Board,
|
board: board::Board,
|
||||||
bag: baggy::Bag,
|
bag: bag::Bag,
|
||||||
players: Vec<player::Player>,
|
players: Vec<player::Player>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Game {
|
impl Game {
|
||||||
pub fn new() -> Game {
|
pub fn new() -> Game {
|
||||||
let bag_data = data::BagData::load_from_json(include_str!("../bag.json")).unwrap();
|
let bag_data = data::BagData::load_from_json(include_str!("../bag.json")).unwrap();
|
||||||
let bag = baggy::Bag::from(bag_data);
|
let bag = bag::Bag::from(bag_data);
|
||||||
let dictionary = dictionary::Dictionary::new();
|
let dictionary = dictionary::Dictionary::new();
|
||||||
Game {
|
Game {
|
||||||
board: board::Board::new(dictionary),
|
board: board::Board::new(dictionary),
|
||||||
|
@ -36,7 +36,7 @@ impl Game {
|
||||||
&self.players
|
&self.players
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn bag(&self) -> &baggy::Bag {
|
pub fn bag(&self) -> &bag::Bag {
|
||||||
&self.bag
|
&self.bag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::baggy::Bag;
|
use crate::bag::Bag;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
pub struct PlayerId(pub u32);
|
pub struct PlayerId(pub u32);
|
||||||
|
|
Loading…
Add table
Reference in a new issue