Closed wemyss closed 7 years ago
Possible solutions:
Code solution for 3 (untested)
let tiles = tiles.split_whitespace()
.map(|tile| tile.splitn(2, |c: char| c.is_digit(10)))
.flat_map(|tile| {
let colors = tile[0];
let nums = parse_number_range(tile[1]);
colors.chars().flat_map(|c| nums.map(|num| Tile::new(c, num)))
})
Added feature now in master. Derived from the solution above using a more imperative programming approach due to rust compilation issues
Currently can only parse single number/color tiles e.g.
b11
It would be nice to parse tiles such as
blry7
andy1-9
https://github.com/wemyss/rustikub/blob/c0b066a449fc28968dda62a9aaf401b3eb3846a3/src/game/mod.rs#L22