mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 23:26:40 -08:00
init
working on draw methods
This commit is contained in:
15
90_Tower/rust/src/util.rs
Normal file
15
90_Tower/rust/src/util.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use crate::disk::Disk;
|
||||
|
||||
pub fn generate_disks(amount: u8) -> Vec<Disk> {
|
||||
if amount > 7 {
|
||||
println!("CANNOT HAVE MORE THAN 7 DISKS!");
|
||||
}
|
||||
|
||||
let mut disks = Vec::new();
|
||||
|
||||
for i in (1..=amount).rev() {
|
||||
disks.push(Disk::new(i * 2 + 1));
|
||||
}
|
||||
|
||||
disks
|
||||
}
|
||||
Reference in New Issue
Block a user