func main()
{
for (int y = 0; y < 10; y++)
{
string line = "";
for (int x = 0; x < 60; x++)
{
double swell = sin(x * 0.26) * 2.6;
swell += sin(x * 0.05 + 1.0);
int surface = (int)(4.5 + swell);
if (y < surface) { line += " "; }
elif (y == surface) { line += "~"; }
else { line += "#"; }
}
println(line);
}
}
It prints the sea.
The type goes first, strings have +=, and
sin is already there without an import.
~~
~~~ ~~~##~~~
~~###~~~ ~########~
~~########~ ~##########~~ ~
~ ~###########~~ ~~#############~~ ~~#
#~~ ~~##############~~ ~~#################~~~~~###
###~~~ ~~~##################~~~~~###########################
######~#####################################################
############################################################