Created
September 25, 2015 17:59
-
-
Save dom111/5b182dd8120905371982 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change settings here - colour assumes Bash-like ANSI supported terminal | |
$colour = 1; | |
$testing = 0; | |
$n=<>; | |
$n+=!($n%2); | |
@l=split//,'??EEEEEEEEEEEEAAAAAAAAAIIIIIIIIIOOOOOOOONNNNNNRRRRRRTTTTTTLLLLSSSSUUUUDDDDGGGBBCCMMPPFFHHVVWWYYKJXQZ'; | |
if($testing){ | |
map{$m=$_-1;$r[$m]=[map'.',1..$n]}1..$n; | |
} | |
else{ | |
map{$m=$_-1;$r[$m]=[map$l[rand 100],1..$n]}1..$n; | |
} | |
$r[$n/2]->[$n/2]=$"; | |
# bonus squares | |
$s=(($n/2)-1)%3+1; | |
for($i=$s;$i<$n-1;$i+=3){ | |
for($j=$s;$j<$n-1;$j+=3){ | |
if($testing){ | |
$r[$i]->[$j]=$r[$i]->[$j]eq$"?$":'#'; | |
} | |
else{ | |
$r[$i]->[$j]=$r[$i]->[$j]eq'?'?'!':lc$r[$i]->[$j]; | |
} | |
if($colour){ | |
$r[$i]->[$j]=$r[$i]->[$j]eq$"?$":"\e[44;93m".$r[$i]->[$j]."\e[0m"; | |
} | |
} | |
} | |
$"=''; | |
print"@$_ | |
"for@r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment