changeset 70:142d888af2d1

removed useless proof of concept.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Wed, 22 Oct 2008 06:33:24 +0800
parents 7ee3a8421936
children 9fd33f9d7207
files .hgignore inference.pl
diffstat 2 files changed, 1 insertions(+), 127 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Oct 22 06:25:16 2008 +0800
+++ b/.hgignore	Wed Oct 22 06:33:24 2008 +0800
@@ -7,3 +7,4 @@
 *.html
 *.sh
 *.txt
+ecmanaut-read-only
--- a/inference.pl	Wed Oct 22 06:25:16 2008 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use Ikariam;
-use Data::Dumper;
-
-package main;
-
-our $cities;
-sub Warn
-{
-    my ($city, $msg) = @_;
-    printf("http://%s/index.php?view=city&id=%s (%s) %s \n", 
-        $::server, $city, $cities->{$city}->{name}, $msg);
-}
-
-sub rule_happiness
-{
-    my $id = shift;
-
-    if($cities->{$id}->{happiness} >= 3) {
-        Warn($id, sprintf("is not happy (%s)!", $cities->{$id}->{happiness_text}));
-    }
-}
-
-sub rule_resource
-{
-    my $id = shift;
-
-    # checking goods
-    foreach my $good (qw/wood wine marble crystal/) {
-        if($cities->{$id}->{resources}->{$good} <= 100) {
-            Warn($id, sprintf("Running out %s (%d)!", $good, $cities->{$id}->{resources}->{$good}));
-        }
-    }
-}
-
-sub rule_building
-{
-    my $cityId = shift;
-
-    # 城鎮跟圍牆
-    if($cities->{$cityId}->{construction} != 1) {
-        if($cities->{$cityId}->{buildings}->{wall} < $cities->{$cityId}->{buildings}->{townHall}) {
-            Warn($cityId, sprintf("Wall level (%d) is lower then town hall (%d)!",
-                    $cities->{$cityId}->{buildings}->{wall},
-                    $cities->{$cityId}->{buildings}->{townHall}
-                )) 
-        } else {
-            Warn($cityId, sprintf("is not building."));
-        }
-    }
-}
-
-sub rule_space
-{
-    my $cityId = shift;
-
-    if($cities->{$cityId}->{space}->{total} == $cities->{$cityId}->{space}->{occupied})
-    {
-        Warn($cityId, sprintf("your space is full, upgraded the hall")) 
-        if($cities->{$cityId}->{construction} != 1);
-    }
-    return 0;
-}
-
-sub rule_war
-{
-    my $cityId = shift;
-    if($cities->{$cityId}->{force}->{attacks} > 0)
-    {
-        Warn($cityId, sprintf("YOU ARE ATTACKED!!!!")) if($cities->{$cityId}->{construction} != 1)
-    }
-}
-
-sub rule_engagement
-{
-    my $cityId = shift;
-    if($cities->{$cityId}->{force}->{wars} == 0) {
-        Warn($cityId, sprintf("Let's Attack someone!"));
-    }
-}
-
-# 貪腐
-sub rule_corruption
-{
-    my $id = shift;
-
-    if($cities->{$id}->{corruption} > 0) {
-        Warn($id, sprintf("corruption is %d", $cities->{$id}->{corruption}));
-    }
-}
-
-print Dumper($cities);
-# show cities.
-foreach my $cityId (keys(%$cities)) {
-    printf("%s http://s2.ikariam.tw/index.php?view=city&id=%d\n", $cities->{$cityId}->{name}, $cityId);
-    printf("construction: %s\n", $cities->{$cityId}->{construction});
-    
-    foreach my $thing (qw/resources space force buildings citizens army fleet/) {
-        printf("%s\n", uc($thing));
-        foreach my $i (keys(%{$cities->{$cityId}->{$thing}})) {
-            printf("%s %s, ", $i, $cities->{$cityId}->{$thing}->{$i});
-        }
-        print("\n");
-    }
-    print("\n");
-}
-
-our $i = new Ikariam($::server, $::user, $::pass);
-$i->login;
-$cities = $i->check;
-$i->logout;
-
-# space
-# Checking rules
-foreach my $procedure (qw/rule_war rule_happiness rule_corruption rule_building rule_space rule_resource/) {
-    foreach my $id (keys(%$cities)) {
-        eval(sprintf("%s(%s);", $procedure, $id));
-    }
-}
-
-foreach my $procedure (qw/rule_engagement/) {
-    foreach my $id (keys(%$cities)) {
-        eval(sprintf("%s(%s);", $procedure, $id));
-        last;
-    }
-}