parent
f3e54a4d54
commit
1e231f784a
@ -1,23 +0,0 @@
|
||||
---
|
||||
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
|
@ -1,2 +1,4 @@
|
||||
plugins:
|
||||
- jekyll-katex
|
||||
|
||||
highlihger: rouge
|
||||
|
@ -1,18 +0,0 @@
|
||||
---
|
||||
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