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 crate::{baggy::Tile, dictionary::Dictionary};
|
||||
use crate::{bag::Tile, dictionary::Dictionary};
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum MoveError {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::fmt::Display;
|
||||
|
||||
use crate::baggy::Tile;
|
||||
use crate::bag::Tile;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Word {
|
||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -1,7 +1,7 @@
|
|||
use player::PlayerId;
|
||||
use thiserror::Error;
|
||||
|
||||
mod baggy;
|
||||
mod bag;
|
||||
mod board;
|
||||
mod data;
|
||||
mod dictionary;
|
||||
|
@ -10,20 +10,20 @@ mod player;
|
|||
#[derive(Debug, Error)]
|
||||
pub enum GameError {
|
||||
#[error("Not enough tiles in bag")]
|
||||
NotEnoughTiles(#[from] baggy::BagError),
|
||||
NotEnoughTiles(#[from] bag::BagError),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Game {
|
||||
board: board::Board,
|
||||
bag: baggy::Bag,
|
||||
bag: bag::Bag,
|
||||
players: Vec<player::Player>,
|
||||
}
|
||||
|
||||
impl Game {
|
||||
pub fn new() -> Game {
|
||||
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();
|
||||
Game {
|
||||
board: board::Board::new(dictionary),
|
||||
|
@ -36,7 +36,7 @@ impl Game {
|
|||
&self.players
|
||||
}
|
||||
|
||||
pub fn bag(&self) -> &baggy::Bag {
|
||||
pub fn bag(&self) -> &bag::Bag {
|
||||
&self.bag
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::baggy::Bag;
|
||||
use crate::bag::Bag;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub struct PlayerId(pub u32);
|
||||
|
|
Loading…
Add table
Reference in a new issue