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"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
description = "a TUI for vizualising a rust implementation of the game of life."
|
||||
authors = ["Matthieu JOLIMAITRE <matthieu@imagevo.fr>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/MajorBarnulf/golrs"
|
||||
|
||||
[dependencies]
|
||||
termion = "1.5.6"
|
||||
termion = "1.5"
|
||||
|
|
|
@ -7,3 +7,11 @@ Game Of Life RuSt
|
|||
## Description
|
||||
|
||||
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> + '_ {
|
||||
self.cells
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(x, row)| {
|
||||
row.iter().enumerate().filter_map(move |(y, cell)| {
|
||||
cell.is_active().then_some(pos!(x as i32, y as i32))
|
||||
})
|
||||
})
|
||||
.flatten()
|
||||
self.cells.iter().enumerate().flat_map(|(x, row)| {
|
||||
row.iter()
|
||||
.enumerate()
|
||||
.filter_map(move |(y, cell)| cell.is_active().then_some(pos!(x as i32, y as i32)))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,10 +104,9 @@ impl World for HashedWorld {
|
|||
fn actives(&self) -> Vec<Pos> {
|
||||
self.chunks
|
||||
.iter()
|
||||
.map(|(ChunkPos(chunk_pos), chunk)| {
|
||||
chunk.get_actives().map(|pos| chunk_pos.clone() + pos)
|
||||
.flat_map(|(ChunkPos(chunk_pos), chunk)| {
|
||||
chunk.get_actives().map(|pos| *chunk_pos + pos)
|
||||
})
|
||||
.flatten()
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue