Minesweeper

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

For each squares without mine (shown by '.'), tell the number of mines (shown by '*') in adjacent squares. The test cases always have 16x16 squares and 40 mines.

This problem is set by leonid & shinh to enjoy a "speed golfing" event. We are planning to solve this problem within 2 hours in Ruby. We'll use (2hrs) suffixes (e.g., "shinh (2hrs)") as our name during the mini event. Please join us with the (2hrs) suffix if you have time. Of course, solutions with other languages will be welcomed, although I'm not sure if there are other competitors.

We'll finish this speed golfing at 9pm in PDT. After this time, this problem bec
omes a usual 2 week problem. Please check this link for the deadline of the speed golfing in your timezone: http://www.timeanddate.com/worldclock/fixedtime.html?&day=30&month=07&year=2012&hour=21&min=00&sec=0&p1=224

This problem is inspired by a problem in Perl Golf history book (http://terje2.frox25.no-ip.org/). The solutions in this book may not work for this problem due to size difference, but you may be able to use them as a big hint.

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

.....***..*.....
...*.*....**....
..*...........*.
..*......*...*..
....*.**.......*
................
.......*..*.....
.*....*........*
.....*..**......
.......*.*......
.....*...*......
.....*..........
.......*........
.....**.*.......
.....*.*..*..*..
.....*.*........

Sample output:

00113***12*31000
012*3*4212**1111
02*32110123222*1
02*312222*101*32
0112*2**2110112*
0001123321110011
1110012*11*10011
1*1012*33321001*
11101*33**200011
0000223*5*300000
00002*313*200000
00002*3121100000
0000234*21000000
00002**4*2111110
00003*6*32*11*10
00002*4*21111110

Sample input:_

.*.*.*........*.
**.***........**
*...............
.........*......
................
................
..............**
..............*.
............*.**
...............*
**........*.....
.*...*..........
**..............
................
**......***...**
.**.....*.*..**.

Sample output:

3*4*5*20000002*3
**4***20000002**
*322321011100122
110000001*100000
0000000011100000
0000000000000122
00000000000002**
00000000000114*5
000000000001*3**
221000000112123*
**20111001*10011
5*301*1001110000
**20111000000000
4420000123210122
**310002***213**
3**10002*5*21**3

Sample input:_

*..*.*...*.....*
..............*.
*.........*.....
....*....*...*..
...........***..
.*.........*.*..
............****
............*.*.
............***.
................
..........*.*...
.....*..........
*.....*.........
......**....*...
.........**.....
*.*..........*.*

Sample output:

*11*2*101*10012*
22112110122101*2
*101110012*11221
1101*1001*334*20
11111100113***30
1*100000002*7*52
111000000013****
000000000003*8*4
000000000002***2
0000000001133421
0000111001*2*100
11001*2101121100
*10013*310011100
110002**2222*100
121101222**22221
*2*1000012211*2*

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1leonid640.07922012/08/01 09:03:260B / ?B / ?B
2clock(leonid,kinaba)680.09962012/07/31 15:41:030B / 25B / 40B
3yvl700.05332012/07/31 13:53:000B / 31B / 37B
4shinh (leonid,kinaba)700.06742012/07/31 15:33:290B / 34B / 33B
5leonid (kinaba)710.06912012/07/31 13:09:210B / 29B / 40B
6leonid (2hrs)730.06572012/07/31 11:53:530B / 30B / 41B
7clock(2hrs)740.07332012/07/31 11:57:370B / 24B / 47B
8kinaba (2hrs)740.08322012/07/31 12:53:260B / 30B / 43B
9shinh (2hrs)750.05032012/07/31 12:50:140B / 33B / 40B
10irori(2hrs)850.06802012/07/31 12:45:451B / 33B / 48B
11_1580.05222012/07/31 13:48:376B / ?B / ?B
12tisphie1580.05292012/07/31 13:49:166B / ?B / ?B
13kinaba2400.05262012/07/31 11:22:420B / 82B / 68B

Perl _

RankUserSizeTimeDateStatistics
1nai450.06212012/08/11 12:15:050B / 23B / 20B
2tails460.03702012/08/03 23:31:301B / 20B / 22B
3teebee470.03862012/08/03 12:11:591B / 21B / 22B
4shinh540.19022012/08/01 16:18:330B / 26B / 22B

Python _

RankUserSizeTimeDateStatistics
1leonid1130.08482012/08/14 07:43:500B / 55B / 50B
2hallvabo1160.10102012/08/10 08:53:500B / 58B / 47B
3clock1170.07182012/08/09 06:15:230B / 63B / 43B
4twobit1240.17922012/08/01 21:42:500B / 55B / 65B
5leonid (2hrs)1250.09382012/07/31 12:23:080B / 57B / 58B
6Puzzlet Chung1400.06022012/08/02 03:50:100B / 79B / 54B
7Puzzlet Chung (2hrs)1520.09332012/07/31 12:57:140B / 90B / 54B
8comfuture (2hrs)1770.05852012/07/31 12:21:500B / ?B / ?B
9comfuture1900.07252012/07/31 11:50:541B / ?B / ?B
10sublee5490.07032012/07/31 11:36:5021B / 179B / 70B
11sublee (2hrs)5530.11242012/07/31 12:13:3619B / ?B / ?B
12leonid1110.06942012/08/14 11:10:470B / 54B / 49B

Arc _

RankUserSizeTimeDateStatistics
1youz1013.13822012/07/31 17:01:230B / 63B / 30B
2youz (2hrs)1294.13492012/07/31 12:57:380B / 62B / 48B

JavaScript _

RankUserSizeTimeDateStatistics
10mg1340.12842012/08/09 17:38:210B / 66B / 66B
2matyr (2hrs)1350.06862012/07/31 12:02:450B / 64B / 67B

Lua _

RankUserSizeTimeDateStatistics
1clock1310.03562012/08/09 18:33:520B / 75B / 49B
2twobit1320.03602012/08/09 18:35:490B / 75B / 51B

J _

RankUserSizeTimeDateStatistics
1I., S.520.09572012/08/01 22:58:080B / 14B / 36B
2I., S.510.07362013/11/06 00:18:180B / 12B / 37B

K _

RankUserSizeTimeDateStatistics
1teebee550.04102012/08/06 15:57:410B / 16B / 37B
2twobit600.03532012/08/08 06:05:390B / 16B / 42B
3av960.03992012/08/13 11:00:172B / 21B / 69B

C _

RankUserSizeTimeDateStatistics
1nu950.03192012/08/01 00:39:010B / 48B / 47B
2shinh1020.03402012/08/01 15:45:230B / 50B / 52B
3nu(orz)1030.03552012/07/31 13:06:368B / 47B / 48B
40mg1050.03252012/08/13 19:47:170B / 53B / 52B
5ush (2hrs)1080.03212012/07/31 12:49:418B / 49B / 51B
6inaniwa(2hrs)1110.04142012/07/31 12:34:309B / 48B / 54B
7ush1300.03682012/07/31 12:32:598B / 59B / 63B
8Y.OHNO(2hrs)1670.03192012/08/13 19:11:110B / 81B / 86B
9inaniwa1810.05832012/07/31 11:20:100B / 86B / 95B
10peria3760.03982012/07/31 16:01:0616B / ?B / ?B

Haskell _

RankUserSizeTimeDateStatistics
1henkma1020.04392012/08/04 05:10:450B / 56B / 44B
2rst761030.03902012/08/07 22:24:300B / 51B / 50B
3notogawa1040.04992012/08/07 21:51:050B / 54B / 48B
4rst76(2hrs)1090.05662012/07/31 12:55:200B / 55B / 49B
5Lost_dog1580.03522012/08/01 22:18:570B / 68B / 85B

sed _

RankUserSizeTimeDateStatistics
1tails1660.06652012/08/04 23:51:080B / 46B / 109B

GolfScript _

RankUserSizeTimeDateStatistics
1tails410.36482012/08/01 20:58:430B / 9B / 32B
2clock461.47822012/08/12 16:56:150B / 14B / 32B

Vim _

RankUserSizeTimeDateStatistics
1clock730.46582012/07/31 17:35:395B / 43B / 21B
2clock(2hrs)830.73502012/07/31 12:23:017B / 41B / 28B

Language Ranking_

RankLangUserSizeScore
1GolfScripttails4110000
2Perlnai459111
3JI., S.518039
4Kteebee557454
5Rubyleonid646406
6Vimclock735616
7Cnu954315
8Arcyouz1014059
9Haskellhenkma1024019
10Pythonleonid1113693
11Luaclock1313129
12JavaScript0mg1343059
13sedtails1662469

return top