100 doors: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 14,671: | Line 14,671: | ||
</pre> |
</pre> |
||
===Optimised GO Inspired=== |
===Optimized Optimised GO Inspired=== |
||
<syntaxhighlight lang="go">const door_number = 100 |
<syntaxhighlight lang="go">const door_number = 100 |
||
Line 14,685: | Line 14,685: | ||
increment++ |
increment++ |
||
door_nbr += 2 * increment + 1 |
door_nbr += 2 * increment + 1 |
||
print('O') |
|||
} |
|||
} else { |
|||
print('=') |
|||
} |
|||
} |
} |
||
doors.map( fn( it bool) bool { // graphically represent opened doors |
|||
print( if it {( 'O')} else {('=')} ) |
|||
return it |
|||
}) |
|||
println('') |
println('') |
||
} |
} |