_Title "Jolly Roger on Fire" 'b+ 2022-01-17
Const xmax
= 500, ymax
= 400
fr! = 240 * i / 100 + 15
p&
(i
+ 100) = _RGB(255, fr!
, 0) p&
(i
+ 200) = _RGB(255, 255, fr!
)xxmax = 500: yymax = 200 'pixels too slow
xstep = xmax / xxmax: ystep = ymax / yymax
Dim f
(xxmax
, yymax
), ff
(xxmax
, yymax
), counts
(xxmax
, yymax
) 'fire array and seed If Point(x
* xstep
, y
* ystep
) = w~&
Then f
(x
, y
) = 300: ff
(x
, y
) = 300
For x
= 1 To xxmax
- 2 'shift fire seed a bit f(x, y + 1) = f(x - 1, y + 1)
f(x, y + 1) = f(x + 1, y + 1)
If ff
(x
, y
) Then f
(x
, y
) = 300 For y
= 0 To yymax
- 2 'fire based literally on 4 pixels below it like cellular automata f(x, y) = max((f(x - 1, y + 1) + f(x, y + 1) + f(x + 1, y + 1) + f(x - 1, y + 2)) / 4 - 5, 0)
Line (x
* xstep
, y
* ystep
)-Step(xstep
, ystep
), p&
(f
(x
, y
)), BF
counts(x, y) = counts(x, y) + 1
If counts
(x
, y
) > 160 Then ff
(x
, y
) = 0 If Rnd < .021 And ((x
- 1 > 0) And y
+ 1 < yymax
) Then ff
(x
- 1, y
+ 1) = 300 If Rnd < .021 And ((x
- 2 > 0) And y
+ 1 < yymax
) Then ff
(x
- 2, y
+ 1) = 300 If Rnd < .021 And ((x
+ 1 < xxmax
) And y
+ 1 < yymax
) Then ff
(x
+ 1, y
+ 1) = 300 If Rnd < .021 And ((x
+ 2 < xxmax
) And y
+ 1 < yymax
) Then ff
(x
+ 2, y
+ 1) = 300 If Rnd < .021 And ((x
+ 1 < xxmax
) And y
- 1 > 0) Then ff
(x
+ 1, y
- 1) = 300