Differences From Artifact [23ef619abd528e8f]:
- File
test.d
- 2012-07-14 01:07:03 - part of checkin [c357edc016] on branch trunk - Implemented flooding. (user: kinaba) [annotate]
To Artifact [5bf75f7f55fc5b47]:
- File
test.d
- 2012-07-14 01:58:20 - part of checkin [6819168095b] on branch trunk - Correct parsing of Flooding. (user: kinaba) [annotate]
37 37 // vertical sentinel
38 38 char[] sen = new char[width+2];
39 39 sen[] = '#';
40 40 data = sen.dup ~ data ~ sen;
41 41
42 42 // flooding
43 43 water = H-1;
44 - string wfws = input.readln().chomp() ~ " ";
45 - wfws ~= input.readln().chomp() ~ " ";
46 - wfws ~= input.readln().chomp();
47 - string[] wfw = wfws.split();
48 - if(wfw.length==6) {
49 - water = H-1 - wfw[1].to!int();
50 - flooding = wfw[3].to!int();
51 - water_proof = wfw[5].to!int();
44 + while( (line=input.readln()).length ) {
45 + string[] ss = line.split();
46 + if(ss.length==2 && ss[0]=="Water")
47 + water = H-1 - ss[1].to!int();
48 + else if(ss.length==2 && ss[0]=="Flooding")
49 + flooding = ss[1].to!int();
50 + else if(ss.length==2 && ss[0]=="Waterproof")
51 + water_proof = ss[1].to!int();
52 52 }
53 53 }
54 54
55 55 @property const
56 56 {
57 57 int W() { return data[0].length; }
58 58 int H() { return data.length; }