for ^cell: true_cells do *cell = .Empty;
memory.alloc_slice(^mine_locations, mine_count);
for ^cell: true_cells do *cell = .Empty;
memory.alloc_slice(^mine_locations, mine_count);
while true {
mx, my := random.between(0, width - 1), random.between(0, height - 1);
if get_true_cell(this, mx, my) != .Mine {
set_true_cell(this, mx, my, .Mine);
while true {
mx, my := random.between(0, width - 1), random.between(0, height - 1);
if get_true_cell(this, mx, my) != .Mine {
set_true_cell(this, mx, my, .Mine);
- for ^mine_pos: mine_locations {
- for neighbor: neighbors(this, mine_pos.x, mine_pos.y) {
+ for ^ mine_locations {
+ for neighbor: neighbors(this, it.x, it.y) {
cell := get_true_cell(this, neighbor.x, neighbor.y);
if cell == .Empty do cell = .Number1;
elseif cell&.Is_Number do cell += 1;
cell := get_true_cell(this, neighbor.x, neighbor.y);
if cell == .Empty do cell = .Number1;
elseif cell&.Is_Number do cell += 1;
reveal_cell(this, p.x, p.y);
if get_true_cell(this, p.x, p.y) & .Is_Number do continue;
reveal_cell(this, p.x, p.y);
if get_true_cell(this, p.x, p.y) & .Is_Number do continue;
- for n: neighbors(this, p.x, p.y, include_corners=true) {
- true_cell := get_true_cell(this, n.x, n.y);
- visible_cell := get_visible_cell(this, n.x, n.y);
+ for neighbors(this, p.x, p.y, include_corners=true) {
+ true_cell := get_true_cell(this, it.x, it.y);
+ visible_cell := get_visible_cell(this, it.x, it.y);
- for ^mine: mine_locations {
- reveal_cell(this, mine.x, mine.y);
+ for ^ mine_locations {
+ reveal_cell(this, it.x, it.y);