Update to 2021 edition

This commit is contained in:
timotree3 2023-01-19 20:55:47 -05:00
parent 2b866ac227
commit b8a82294d1
9 changed files with 16 additions and 16 deletions

View file

@ -2,6 +2,7 @@
name = "rust_hanabi" name = "rust_hanabi"
version = "0.1.0" version = "0.1.0"
authors = ["Jeff Wu <wuthefwasthat@gmail.com>"] authors = ["Jeff Wu <wuthefwasthat@gmail.com>"]
edition = "2021"
[dependencies] [dependencies]
rand = "0.3.0" rand = "0.3.0"

View file

@ -6,7 +6,7 @@ use std::hash::Hash;
use std::ops::{Index, IndexMut}; use std::ops::{Index, IndexMut};
use std::slice; use std::slice;
use game::*; use crate::game::*;
// trait representing information about a card // trait representing information about a card
pub trait CardInfo { pub trait CardInfo {

View file

@ -236,7 +236,7 @@ fn get_results_table() -> String {
} }
fn concat_twolines(body: Vec<TwoLines>) -> String { fn concat_twolines(body: Vec<TwoLines>) -> String {
body.into_iter().fold(String::default(), |output, (a, b)| { body.into_iter().fold(String::default(), |output, (a, b)| {
(output + &a + "\n" + &b + "\n") output + &a + "\n" + &b + "\n"
}) })
} }
let header = make_twolines(&player_nums, (space.clone(), dashes), &|n_players| { let header = make_twolines(&player_nums, (space.clone(), dashes), &|n_players| {

View file

@ -1,10 +1,9 @@
use crossbeam;
use fnv::FnvHashMap; use fnv::FnvHashMap;
use rand::{self, Rng, SeedableRng}; use rand::{self, Rng, SeedableRng};
use std::fmt; use std::fmt;
use game::*; use crate::game::*;
use strategy::*; use crate::strategy::*;
fn new_deck(seed: u32) -> Cards { fn new_deck(seed: u32) -> Cards {
let mut deck: Cards = Cards::new(); let mut deck: Cards = Cards::new();

View file

@ -2,8 +2,8 @@ use fnv::{FnvHashMap, FnvHashSet};
use std::cell::RefCell; use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
use game::*; use crate::game::*;
use strategy::*; use crate::strategy::*;
// strategy that explicitly cheats by using Rc/RefCell // strategy that explicitly cheats by using Rc/RefCell
// serves as a reference point for other strategies // serves as a reference point for other strategies

View file

@ -1,6 +1,6 @@
use game::*; use crate::game::*;
use crate::strategy::*;
use rand::{self, Rng}; use rand::{self, Rng};
use strategy::*;
// dummy, terrible strategy, as an example // dummy, terrible strategy, as an example
#[derive(Clone)] #[derive(Clone)]

View file

@ -1,5 +1,5 @@
use game::*; use crate::game::*;
use helpers::*; use crate::helpers::*;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ModulusInformation { pub struct ModulusInformation {

View file

@ -2,10 +2,10 @@ use float_ord::*;
use fnv::{FnvHashMap, FnvHashSet}; use fnv::{FnvHashMap, FnvHashSet};
use std::cmp::Ordering; use std::cmp::Ordering;
use game::*; use crate::game::*;
use helpers::*; use crate::helpers::*;
use strategies::hat_helpers::*; use crate::strategies::hat_helpers::*;
use strategy::*; use crate::strategy::*;
// TODO: use random extra information - i.e. when casting up and down, // TODO: use random extra information - i.e. when casting up and down,
// we sometimes have 2 choices of value to choose // we sometimes have 2 choices of value to choose

View file

@ -1,4 +1,4 @@
use game::*; use crate::game::*;
// Traits to implement for any valid Hanabi strategy // Traits to implement for any valid Hanabi strategy