fixed warnings and added metadata for publication
This commit is contained in:
parent
9cf5a5b56d
commit
86ca928a3f
3 changed files with 20 additions and 15 deletions
|
@ -2,8 +2,10 @@
|
||||||
name = "golrs"
|
name = "golrs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
description = "a TUI for vizualising a rust implementation of the game of life."
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
authors = ["Matthieu JOLIMAITRE <matthieu@imagevo.fr>"]
|
||||||
|
license = "MIT"
|
||||||
|
repository = "https://github.com/MajorBarnulf/golrs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
termion = "1.5.6"
|
termion = "1.5"
|
||||||
|
|
|
@ -7,3 +7,11 @@ Game Of Life RuSt
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
This is a TUI for vizualising a rust implementation of the game of life
|
This is a TUI for vizualising a rust implementation of the game of life
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
With cargo
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo install glors
|
||||||
|
```
|
||||||
|
|
|
@ -21,15 +21,11 @@ impl Chunk {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_actives(&self) -> impl Iterator<Item = Pos> + '_ {
|
fn get_actives(&self) -> impl Iterator<Item = Pos> + '_ {
|
||||||
self.cells
|
self.cells.iter().enumerate().flat_map(|(x, row)| {
|
||||||
.iter()
|
row.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(x, row)| {
|
.filter_map(move |(y, cell)| cell.is_active().then_some(pos!(x as i32, y as i32)))
|
||||||
row.iter().enumerate().filter_map(move |(y, cell)| {
|
})
|
||||||
cell.is_active().then_some(pos!(x as i32, y as i32))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.flatten()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,10 +104,9 @@ impl World for HashedWorld {
|
||||||
fn actives(&self) -> Vec<Pos> {
|
fn actives(&self) -> Vec<Pos> {
|
||||||
self.chunks
|
self.chunks
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(ChunkPos(chunk_pos), chunk)| {
|
.flat_map(|(ChunkPos(chunk_pos), chunk)| {
|
||||||
chunk.get_actives().map(|pos| chunk_pos.clone() + pos)
|
chunk.get_actives().map(|pos| *chunk_pos + pos)
|
||||||
})
|
})
|
||||||
.flatten()
|
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue