#!/usr/bin/perl -w $gold_ph = 8; $stone_ph = 5; $wood_ph = 6; $limit = 1000; $current_gold = 250; $current_stone = 250; $current_wood = 250; $i = 1; $x = 0; while($x == 0) { if(((($current_gold <= $limit) && ($current_stone <= $limit) && ($current_wood <= $limit)))) { $i++; if($current_gold < $limit) { $current_gold = $current_gold + $gold_ph; } if($current_stone < $limit) { $current_stone = $current_stone + $stone_ph; } if($current_wood < $limit) { $current_wood = $current_wood + $wood_ph; } print "hour : $i\n"; print "gold : $current_gold\n"; print "stone : $current_stone\n"; print "wood : $current_wood\n\n"; } #if(($current_gold >= $limit) && ($current_stone >= $limit) && ($current_wood >= $limit)) else { $x = 1; } }