A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
21
Task/Forest-fire/J/forest-fire-1.j
Normal file
21
Task/Forest-fire/J/forest-fire-1.j
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
NB. states: 0 empty, 1 tree, _1 fire
|
||||
dims =:10 10
|
||||
|
||||
tessellate=: 0,0,~0,.0,.~ 3 3 >./@,;._3 ]
|
||||
mask=: tessellate dims$1
|
||||
chance=: 1 :'(> ? bind (dims$0)) bind (mask*m)'
|
||||
|
||||
start=: 0.5 chance
|
||||
grow =: 0.01 chance
|
||||
fire =: 0.001 chance
|
||||
|
||||
spread=: [: tessellate 0&>
|
||||
|
||||
step=: grow [`]@.(|@])"0 >.&0 * _1 ^ fire +. spread
|
||||
|
||||
run=:3 :0
|
||||
forest=. start''
|
||||
for.i.y do.
|
||||
smoutput ' #o' {~ forest=. step forest
|
||||
end.
|
||||
)
|
||||
20
Task/Forest-fire/J/forest-fire-2.j
Normal file
20
Task/Forest-fire/J/forest-fire-2.j
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
run 2
|
||||
|
||||
##### #
|
||||
# #
|
||||
### ####
|
||||
# # # #
|
||||
##### #
|
||||
## # #
|
||||
# #
|
||||
o## #
|
||||
|
||||
|
||||
##### #
|
||||
# #
|
||||
### ####
|
||||
# # # #
|
||||
##### #
|
||||
## # #
|
||||
o #
|
||||
o# #
|
||||
Loading…
Add table
Add a link
Reference in a new issue