Mercurial > eagle-eye
comparison inference.pl @ 39:65e847de5187
refined the defending rules
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Thu, 16 Oct 2008 21:43:20 +0800 |
parents | 91e387b51aa0 |
children | 5849b6fdc76c |
comparison
equal
deleted
inserted
replaced
38:0863b32e1a05 | 39:65e847de5187 |
---|---|
43 sub rule_building | 43 sub rule_building |
44 { | 44 { |
45 my $cityId = shift; | 45 my $cityId = shift; |
46 | 46 |
47 # 城鎮跟圍牆 | 47 # 城鎮跟圍牆 |
48 if($cities->{$cityId}->{buildings}->{wall} < $cities->{$cityId}->{buildings}->{townHall}) { | 48 if($cities->{$cityId}->{construction} != 1) { |
49 Warn($cityId, sprintf("Wall level (%d) is lower then town hall (%d)!", | 49 if($cities->{$cityId}->{buildings}->{wall} < $cities->{$cityId}->{buildings}->{townHall}) { |
50 $cities->{$cityId}->{buildings}->{wall}, | 50 Warn($cityId, sprintf("Wall level (%d) is lower then town hall (%d)!", |
51 $cities->{$cityId}->{buildings}->{townHall} | 51 $cities->{$cityId}->{buildings}->{wall}, |
52 )) | 52 $cities->{$cityId}->{buildings}->{townHall} |
53 if($cities->{$cityId}->{construction} != 1); | 53 )) |
54 } else { | |
55 Warn($cityId, sprintf("is not building.")); | |
56 } | |
54 } | 57 } |
55 } | 58 } |
56 | 59 |
57 sub rule_space | 60 sub rule_space |
58 { | 61 { |
115 foreach my $id (keys(%$cities)) { | 118 foreach my $id (keys(%$cities)) { |
116 eval(sprintf("%s(%s);", $procedure, $id)); | 119 eval(sprintf("%s(%s);", $procedure, $id)); |
117 } | 120 } |
118 } | 121 } |
119 | 122 |
120 foreach my $procedure (qw/rule_war rule_engagement/) { | 123 foreach my $procedure (qw/rule_engagement/) { |
121 foreach my $id (keys(%$cities)) { | 124 foreach my $id (keys(%$cities)) { |
122 eval(sprintf("%s(%s);", $procedure, $id)); | 125 eval(sprintf("%s(%s);", $procedure, $id)); |
123 last; | 126 last; |
124 } | 127 } |
125 } | 128 } |