some bugs with json fixed
[aymargeddon/current.git] / src / debug.pl
1 #!/usr/local/bin/perl -w
2 ##########################################################################
3 #
4 #   Copyright (c) 2003-2012 Aymargeddon Development Team
5 #
6 #   This file is part of "Last days of Aymargeddon" - a massive multi player
7 #   onine game of strategy      
8 #   
9 #        This program is free software: you can redistribute it and/or modify
10 #        it under the terms of the GNU Affero General Public License as
11 #        published by the Free Software Foundation, either version 3 of the
12 #        License, or (at your option) any later version.
13 #    
14 #        This program is distributed in the hope that it will be useful,
15 #        but WITHOUT ANY WARRANTY; without even the implied warranty of
16 #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 #
18 #    See the GNU Affero General Public License for more details.
19 #    
20 #    You should have received a copy of the GNU Affero General Public License
21 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 #    
23 ###########################################################################
24 #
25
26 #
27 #
28 # creates the world to destroy
29 #
30 # usage: ./create.pl [number of eartlings]
31 #
32 #
33
34 # TODO: use FROGS/DataBase.pm instead of DBI.pm
35
36 use strict;
37
38 use DBI;
39 use Data::Dumper;
40 use POSIX qw(floor ceil);
41 use Term::ReadLine;
42
43 use FROGS::HexTorus;
44
45 my $n = 16;
46 my $map = new HexTorus($n);
47 my $out = "\n";
48 for my $y (0..($n - 1)){
49   for my $x ( 0 .. ($n*2-1)){
50
51     my $d =
52       $map->distance(Location->new(5,0),
53                            Location->new($x,$y));
54     $d = "0$d" if $d < 10;
55     $out .= "$d ";
56   }
57   $out .= "\n" . (' ' x ($y +1));
58 }
59 $out .= "\n";
60
61 print $out;