Minesweeper by tisphie

d=readlines\x0d
d<<"."*17\x0d
16.times{|y|16.times{|x|c=d[y][x].chr\x0d
s=0\x0d
print c=='.'?((-1..1).each{|q|(-1..1).each{|w|s+=d[q+y][w+x].chr=='*'?1:0}};s):c}\x0d
puts}\x0d

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page