comparison planner.pl @ 285:c864134ebe3e

refined output format
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 04 Dec 2008 03:22:24 +0800
parents 8355ec8514f9
children 523ea51126bc
comparison
equal deleted inserted replaced
284:10f14db31151 285:c864134ebe3e
94 # 減掉 cities[$i+1]->buliding->port 的速度 94 # 減掉 cities[$i+1]->buliding->port 的速度
95 printf("sleep(%d*60);\n", 95 printf("sleep(%d*60);\n",
96 ($cities[$i+1]->{distance} - $cities[$i]->{distance})); 96 ($cities[$i+1]->{distance} - $cities[$i]->{distance}));
97 } 97 }
98 printf("\n# %s %s %dm\n", $cities[$i]->{name}, $cities[$i]->{type}, $cities[$i]->{distance}); 98 printf("\n# %s %s %dm\n", $cities[$i]->{name}, $cities[$i]->{type}, $cities[$i]->{distance});
99 printf("# ActionPoint %d/%d\n", $cities[$i]->{actionPoints}, $cities[$i]->{maxActionPoints});
99 100
100 printf('$ikariam->login;' . "\n"); 101 printf('$ikariam->login;' . "\n");
101 if($cities[$i]->{type} eq "navy") { 102 if($cities[$i]->{type} eq "navy") {
102 printf('$ikariam->changeCity(%d);' . "\n", $cities[$i]->{id}); 103 printf('$ikariam->changeCity(%d);' . "\n", $cities[$i]->{id});
103 printf('$ikariam->blockadeCity(%d, {' . "\n", $targetCity->id); 104 printf('$ikariam->blockadeCity(%d, {' . "\n", $targetCity->id);
104 printf('blockadeDuration => 8*60*60,' . "\n"); 105 printf("\tblockadeDuration => 2*60*60," . "\n");
105 while (my ($k, $v) = each(%{$cities[$i]->{fleet}})) { 106 while (my ($k, $v) = each(%{$cities[$i]->{fleet}})) {
106 if($v > 0) { 107 if($v > 0) {
107 printf("cargo_fleet_%s => %s, # %s \n", $fleet->{$k}, $v, $k); 108 printf("\tcargo_fleet_%s => %s, # %s \n", $fleet->{$k}, $v, $k);
108 } 109 }
109 } 110 }
110 printf('});' . "\n", $cities[$i]->{id}); 111 printf('});' . "\n", $cities[$i]->{id});
111 } else { 112 } else {
112 printf('$ikariam->changeCity(%d);' . "\n", $cities[$i]->{id}); 113 printf('$ikariam->changeCity(%d);' . "\n", $cities[$i]->{id});
113 printf('$ikariam->plunderCity(%d, {' . "\n", $targetCity->id); 114 printf('$ikariam->plunderCity(%d, {' . "\n", $targetCity->id);
114 while (my ($k, $v) = each(%{$cities[$i]->{army}})) { 115 while (my ($k, $v) = each(%{$cities[$i]->{army}})) {
115 if($v > 0) { 116 if($v > 0) {
116 printf("cargo_army_%s => %s, # %s \n", $army->{$k}, $v, $k); 117 printf("\tcargo_army_%s => %s, # %s \n", $army->{$k}, $v, $k);
117 } 118 }
118 } 119 }
119 printf('});' . "\n", $cities[$i]->{id}); 120 printf('});' . "\n", $cities[$i]->{id});
120 } 121 }
121 printf('$ikariam->logout;' . "\n"); 122 printf('$ikariam->logout;' . "\n");