why you need to compare mid(pattern, loopindex("x"), 1) with "1" ?
To find out if I need to create a coin or not. A 0 in the string is air/nothing while a 1 is a coin.
If you are asking why I'm checking for
"1"
rather than
1
then that's because the information in the "pattern" variable is stored as a "string/text" and not an integer/number. So if you checked for 1 it would never be true.
You could of course change it to int(mid(pattern, loopindex("x"), 1)) with 1 and covert the string to an integer.