_Title " Fish: press m for more, l for less" 'b+ 2021-12-03 Const sw
= 1024, sh
= 700, LHead$
= "<*", LBody$
= ")", LTail$
= "<{", RHead$
= "*>", RBody$
= "(", RTail$
= "}<"
'_FullScreen ' <<<<<<<<<<<<<<< goto full screen once you know instructions for more and less fish
nFish = 20
restart:
growKelp
NewFish i, -1
nFish = nFish * 2
nFish = nFish / 2
For i
= 1 To nFish
' draw fish behind kelp _PrintString (school
(i
).X
, school
(i
).Y
), school
(i
).fish
'draw fish school(i).X = school(i).X + school(i).DX
If school
(i
).X
+ Len(school
(i
).fish
) * 8 < 0 Then NewFish i
, 0 showKelp
For i
= 1 To nFish
' draw fish in from of kelp _PrintString (school
(i
).X
, school
(i
).Y
), school
(i
).fish
'draw fish school(i).X = school(i).X + school(i).DX
If school
(i
).X
+ Len(school
(i
).fish
) * 8 < 0 Then NewFish i
, 0
school
(i
).Colr
= _RGB32(gray
) ' color school(i).LFish = -1
school
(i
).fish
= LHead$
+ String$(Int(Rnd * 5) + -2 * (gray
> 160) + 1, LBody$
) + LTail$
school(i).LFish = 0
school
(i
).fish
= RTail$
+ String$(Int(Rnd * 5) + -2 * (gray
> 160) + 1, RBody$
) + RHead$
If school
(i
).LFish
Then school
(i
).DX
= -18 * Rnd - 3 Else school
(i
).DX
= 18 * Rnd + 3 If school
(i
).LFish
Then school
(i
).DX
= -6 * Rnd - 1 Else school
(i
).DX
= 6 * Rnd + 1
Case 1, 2, 3, 18 '1 branch node If x
- 1 >= 0 Then kelp
(x
- 1, y
) = kelp
(x
, y
+ 1) Case 4, 5, 6, 7, 8, 9, 21 '1 branch node kelp(x, y) = kelp(x, y + 1)
Case 10, 11, 12, 20 '1 branch node If x
+ 1 <= sw
Then kelp
(x
+ 1, y
) = kelp
(x
, y
+ 1) Case 13, 14, 15, 16, 17, 19 '2 branch node If x
- 1 >= 0 Then kelp
(x
- 1, y
) = kelp
(x
, y
+ 1) If x
+ 1 <= sw
Then kelp
(x
+ 1, y
) = kelp
(x
, y
+ 1)