parent
d216f488e6
commit
cf42280e08
@ -0,0 +1,2 @@
|
||||
plugins:
|
||||
- jekyll-katex
|
@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Minesweeper Bomb Generation And Tile Revealing"
|
||||
layout: post
|
||||
---
|
||||
|
||||
When I was creating a little Minesweeper game, I got confused at some points.
|
||||
My bomb generation didn't look quite right, and I for sure didn't quite get the whole cascading tile reveal thing.
|
||||
With a bit of internet research, I found what I was looking for.
|
||||
I'll explain it all in one place for my own and others' purposes.
|
||||
|
||||
### Bomb Generation
|
||||
|
||||
When I started this project I attempted to use a random bomb generator.
|
||||
By this I mean on each square, before it gets generated, give it a one in 15 change of being a bomb.
|
||||
Personally, I'm not sure why this never looked right.
|
||||
Something about the layout of the bombs did not mimic the classic Minesweeper game.
|
||||
|
||||
After looking at some open source Minesweeper examples, I found the following algorithms:
|
||||
|
||||
* `X = R % W`
|
||||
* `Y = R // H`
|
||||
|
||||
Where % is a [modulo] operator
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 335 KiB |
After Width: | Height: | Size: 177 KiB |
After Width: | Height: | Size: 320 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 50 KiB |
@ -0,0 +1,18 @@
|
||||
---
|
||||
title: "Math Test"
|
||||
layout: default
|
||||
---
|
||||
|
||||
<link rel="stylesheet" href="/assets/css/katex.css">
|
||||
|
||||
{% katex display %}
|
||||
\pm\sqrt{a^2 + b^2}
|
||||
{% endkatex %}
|
||||
|
||||
{% katex display %}
|
||||
a^2 + b^2 = c^2
|
||||
{% endkatex %}
|
||||
|
||||
{% katex display %}
|
||||
\textcolor{blue} x = \frac{\textcolor{#47a}{-b\pm\sqrt{b^2-4ac}}}{2a}
|
||||
{% endkatex %}
|
Loading…
Reference in new issue