[−][src]Trait conway::grids::CharGrid
Required methods
fn write_at_position(
&mut self,
col: usize,
row: usize,
ch: char,
visibility: Option<usize>
)
&mut self,
col: usize,
row: usize,
ch: char,
visibility: Option<usize>
)
Write a char ch
to (col
, row
).
Panics
Panics if:
col
orrow
are out of rangechar
is invalid for this type. Useis_valid
to check first.visibility
is invalid. That is, it equalsSome(player_id)
, but there is no suchplayer_id
.
fn is_valid(ch: char) -> bool
Is ch
a valid character?
fn width(&self) -> usize
Width in cells
fn height(&self) -> usize
Height in cells
fn get_run(
&self,
col: usize,
row: usize,
visibility: Option<usize>
) -> (usize, char)
&self,
col: usize,
row: usize,
visibility: Option<usize>
) -> (usize, char)
Given a starting cell at (col, row)
, get the character at that cell, and the number of
contiguous identical cells considering only this cell and the cells to the right of it.
This is intended for exporting to RLE.
The visibility
parameter, if not None
, is used to generate a run as observed by a
particular player.
Returns
(run_length, ch)
Panics
This function will panic if col
, row
, or visibility
(Some(player_id)
) are out of bounds.
Provided methods
fn to_pattern(&self, visibility: Option<usize>) -> Pattern
Returns a Pattern that describes this CharGrid
as viewed by specified player if
visibility.is_some()
, or a fog-less view if visibility.is_none()
.
Implementors
impl CharGrid for BitGrid
[src]
fn width(&self) -> usize
[src]
Width in cells
fn height(&self) -> usize
[src]
Height in cells
fn write_at_position(
&mut self,
col: usize,
row: usize,
ch: char,
_visibility: Option<usize>
)
[src]
&mut self,
col: usize,
row: usize,
ch: char,
_visibility: Option<usize>
)
_visibility is ignored, since BitGrids have no concept of a player.
fn is_valid(ch: char) -> bool
[src]
fn get_run(
&self,
col: usize,
row: usize,
_visibility: Option<usize>
) -> (usize, char)
[src]
&self,
col: usize,
row: usize,
_visibility: Option<usize>
) -> (usize, char)
Given a starting cell at (col, row)
, get the character at that cell, and the number of
contiguous identical cells considering only this cell and the cells to the right of it.
This is intended for exporting to RLE.
The _visibility
argument is unused and should be None
.
Returns
(run_length, ch)
Panics
This function will panic if col
or row
are out of bounds.
fn to_pattern(&self, visibility: Option<usize>) -> Pattern
[src]
impl CharGrid for GenState
[src]
fn width(&self) -> usize
[src]
Width in cells
fn height(&self) -> usize
[src]
Height in cells
fn write_at_position(
&mut self,
col: usize,
row: usize,
ch: char,
visibility: Option<usize>
)
[src]
&mut self,
col: usize,
row: usize,
ch: char,
visibility: Option<usize>
)
fn is_valid(ch: char) -> bool
[src]
fn get_run(
&self,
col: usize,
row: usize,
visibility: Option<usize>
) -> (usize, char)
[src]
&self,
col: usize,
row: usize,
visibility: Option<usize>
) -> (usize, char)
Given a starting cell at (col, row)
, get the character at that cell, and the number of
contiguous identical cells considering only this cell and the cells to the right of it.
This is intended for exporting to RLE.
The visibility
parameter, if not None
, is used to generate a run as observed by a
particular player.
Returns
(run_length, ch)
Panics
This function will panic if col
, row
, or visibility
(Some(player_id)
) are out of bounds.
fn to_pattern(&self, visibility: Option<usize>) -> Pattern
[src]
impl CharGrid for Universe
[src]
fn is_valid(ch: char) -> bool
[src]
fn write_at_position(
&mut self,
_col: usize,
_row: usize,
_ch: char,
_visibility: Option<usize>
)
[src]
&mut self,
_col: usize,
_row: usize,
_ch: char,
_visibility: Option<usize>
)
fn width(&self) -> usize
[src]
Return width in cells.
fn height(&self) -> usize
[src]
Return height in cells.
fn get_run(
&self,
col: usize,
row: usize,
visibility: Option<usize>
) -> (usize, char)
[src]
&self,
col: usize,
row: usize,
visibility: Option<usize>
) -> (usize, char)