Skip to content

Commit

Permalink
Update Old Chou's Solver (#182)
Browse files Browse the repository at this point in the history
1. Solver and UI update

Co-authored-by: Michael Fuller <[email protected]>
  • Loading branch information
mgatelabs and Michael Fuller authored May 7, 2022
1 parent 59826cb commit df38c0f
Show file tree
Hide file tree
Showing 5 changed files with 327 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class OldChouTreasureButtonComponent implements OnInit {

let mode = '';

switch (value) {
switch (value.classification) {
case ChouTreasureTypes.BOMB:
this.label = 'BOMB';
mode = 'barrel';
Expand Down Expand Up @@ -88,7 +88,6 @@ export class OldChouTreasureButtonComponent implements OnInit {
ngOnInit(): void {}

buttonPressed() {
console.log('C1');
this.cellClicked.emit(this.y * 5 + this.x);
}
}
73 changes: 71 additions & 2 deletions src/app/old-chou-treasure/old-chou-treasure.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,76 @@ <h3>Old Chou's Treasure Solver</h3>
of Minesweeper. The only real difference is each spot can only have 1 or 2
bombs nearby and it only looks at spots in the “up”, “right”, “down” and
"left" position. So, in game dig out one of the corners and see what happens
and make this map match. So, if you get Cabbage, click that spot until it’s
cabbage. The goal is to find the Treasure, which is hidden between 4 bombs.
and make this map match. So, if you get Cabbage, click that spot until it
displays a cabbage icon. The goal is to find the Treasure, which is hidden
between 4 bombs or on the edge surrounded by bombs.
</blockquote>

<h3>Icon Description</h3>

<div class="row">
<div class="card" style="width: 18rem">
<img src="../../assets/chou/unknown.png" class="card-img-top" alt="..." />
<div class="card-body">
<h5 class="card-title">Unknown Tile</h5>
<p class="card-text">This tile is a mystery.</p>
</div>
</div>

<div class="card" style="width: 18rem">
<img src="../../assets/chou/empty.png" class="card-img-top" alt="..." />
<div class="card-body">
<h5 class="card-title">Empty Tile</h5>
<p class="card-text">
This tile has no bombs on the <abbr title="North">N</abbr>,
<abbr title="East">E</abbr>, <abbr title="South">S</abbr>,
<abbr title="West">W</abbr> edges.
</p>
</div>
</div>

<div class="card" style="width: 18rem">
<img src="../../assets/chou/cabbage.png" class="card-img-top" alt="..." />
<div class="card-body">
<h5 class="card-title">Cabbage Tile</h5>
<p class="card-text">
This tile has a total of one bomb on either the
<abbr title="North">N</abbr>, <abbr title="East">E</abbr>,
<abbr title="South">S</abbr>, <abbr title="West">W</abbr> edges.
</p>
</div>
</div>

<div class="card" style="width: 18rem">
<img src="../../assets/chou/iron.png" class="card-img-top" alt="..." />
<div class="card-body">
<h5 class="card-title">Iron Tile</h5>
<p class="card-text">
This tile has a total of two bombs on either the
<abbr title="North">N</abbr>, <abbr title="East">E</abbr>,
<abbr title="South">S</abbr>, <abbr title="West">W</abbr> edges.
</p>
</div>
</div>

<div class="card" style="width: 18rem">
<img
src="../../assets/chou/question.png"
class="card-img-top"
alt="..."
/>
<div class="card-body">
<h5 class="card-title">Question Tile</h5>
<p class="card-text">The program is unsure what is under this tile.</p>
</div>
</div>

<div class="card" style="width: 18rem">
<img src="../../assets/chou/safe.png" class="card-img-top" alt="..." />
<div class="card-body">
<h5 class="card-title">Safe Tile</h5>
<p class="card-text">The program is sure this tile is safe to dig.</p>
</div>
</div>
</div>
</div>
7 changes: 7 additions & 0 deletions src/app/shared/chou-treasure-grid-item.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { ChouTreasureGridItem } from './chou-treasure-grid-item';

describe('ChouTreasureGridItem', () => {
it('should create an instance', () => {
expect(new ChouTreasureGridItem()).toBeTruthy();
});
});
22 changes: 22 additions & 0 deletions src/app/shared/chou-treasure-grid-item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ChouTreasureTypes } from './chou-treasure-types';

export class ChouTreasureGridItem {
public edgeBombs: number = 0;
public edgeUnknown: number = 0;
public safe: boolean = false;
public solved: boolean = false;
public user: boolean = false;

constructor(
public x: number = 0,
public y: number = 0,
public classification: ChouTreasureTypes = ChouTreasureTypes.UNKNOWN
) {}

public reset() {
this.edgeBombs = 0;
this.edgeUnknown = 0;
this.safe = false;
this.solved = false;
}
}
Loading

0 comments on commit df38c0f

Please sign in to comment.