[Freeciv-Dev] Re: (PR#10722) Not enough grasslands/plains
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10722 >
Here it is then:
[code]
#!/usr/bin/perl -w
if (@ARGV) {
$savegame = $ARGV[0];
}
else {
$savegame = 'civgame-4000m.sav';
}
open(SAVE, $savegame) or die "$savegame not found.\nUsage: $0 [ savegame
(gunzipped) ]\n";
while (<SAVE>) {
if (/^t\d+="([\s\w]+)"/) {
$line = $1;
@terrains = split //, $line;
foreach $terrain (@terrains) {
$count{$terrain}++;
$map++
}
}
}
$land = $map - $count{" "};
foreach $terrain (sort keys %count) {
unless ($terrain eq " ") {
$percent = 100*$count{$terrain}/$land;
print $terrain, " = ";
printf "%2.1f", $percent;
print "%\n";
$total += $percent;
}
}
print "sum = $total% \n";
print "land tiles = $land \n";
print "total tiles = $map \n";
[/code]
----Original Message Follows----
From: "Marcelo Burda" <mburda@xxxxxxxxx>
Reply-To: rt@xxxxxxxxxxx
To: miky40@xxxxxxxxxxx
Subject: Re: (PR#10722) Not enough grasslands/plains
Date: Mon, 8 Nov 2004 23:06:38 -0800
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10722 >
Le lundi 08 novembre 2004 à 20:42 -0800, Mike Jing a écrit :
> I simply used a perl script to count the number of different terrain
> tiles from save games and calculate the percentages.
>
> Mike Jing
>
i think Mateusz want you to post this script !
Marcelo
- [Freeciv-Dev] Re: (PR#10722) Not enough glasslands/plains, Marcelo Burda, 2004/11/06
- [Freeciv-Dev] Re: (PR#10722) Not enough glasslands/plains, Mateusz Stefek, 2004/11/06
- [Freeciv-Dev] Re: (PR#10722) Not enough glasslands/plains, Marcelo Burda, 2004/11/07
- [Freeciv-Dev] (PR#10722) Not enough glasslands/plains, Marcelo Burda, 2004/11/07
- [Freeciv-Dev] (PR#10722) Not enough glasslands/plains, Marcelo Burda, 2004/11/07
- [Freeciv-Dev] (PR#10722) Not enough grasslands/plains, Mateusz Stefek, 2004/11/08
- [Freeciv-Dev] (PR#10722) Not enough grasslands/plains, Mateusz Stefek, 2004/11/08
- [Freeciv-Dev] Re: (PR#10722) Not enough grasslands/plains, Marcelo Burda, 2004/11/08
- [Freeciv-Dev] (PR#10722) Not enough grasslands/plains, Mike Jing, 2004/11/08
- [Freeciv-Dev] Re: (PR#10722) Not enough grasslands/plains, Marcelo Burda, 2004/11/09
- [Freeciv-Dev] Re: (PR#10722) Not enough grasslands/plains,
Mike Jing <=
- [Freeciv-Dev] (PR#10722) Not enough grasslands/plains, Mike Jing, 2004/11/09
|
|