#!/usr/bin/perl -w

use 5.034;

# two scenarios: one for beligerant init and one for cease fire  

# goto B;

A:

say "CASE A";

my @init;

$init[0][1] = -10;
$init[0][0] = +4;
$init[1][0] = +10;
$init[1][1] = -8;

my @probs;

my ($probi, $probj);


my ($res, $sum);
for my $i (1..100){
    
    ($probi, $probj) = (rand(), rand());    # to be fair enough, reinstantiate the @probs every 100 runs
    $probs[0][1] = $probi * (1-$probj);
    $probs[0][0] = $probi * $probj;
    $probs[1][0] = (1-$probi) * $probj;
    $probs[1][1] = (1-$probi) * (1-$probj);
    
    for my $j (1..100){
	$res = $init[$i % 2][$j % 2] * $probs[$i % 2][$j % 2];
	if ($res > 0){
	    $sum += $res;
	}elsif ($res < 0){
	    $sum += $res;
	}
    }
}
say "Total result of the conflict is ",$sum/(100*100);
say "";

# it's self evident that in the case @init total positive outcomes are 13 and negative ones are 18
# so there must be a cuasi-Nash equilibrium in [0][0] 

# blah


B:

say "CASE B";

# second scenario: Zelenski says that he lost 100 persons a day, let's simulate that Putin lost 80
# and 3 buldings are destroyed a day, so the costs of the disputed buildings are shared but the 
# persons no.

my $cost_estimated_victim_of_plane_accident = 1_400_000;

my $cost_estimated_ruined_building = 5_000_000;  # roughly estimated, but the medium building if has only one portal, could have 4 apartments
# so, if the height is 8 floors, totalize 32 at a cost, let's say 120,000 € per apartment <= 5 millions. Somehing has to be considered by land. 



my $costZ = 100 * 1_400_000 + 3 * 5_000_000 /2;
my $costP = 80 * 1_400_000 + 3 * 5_000_000 /2;

say "Cost of no cease fire: $costZ, $costP";
say "Cost of cease fire (no atributed): ", 3 * 5_000_000;
say "Net gain per peace day: ", (100+80) * 1_400_000;
say "Attribution of net gain: ",  100/180, " ", 80/180;
say "Projection of net gains in a month: ", (100/180) * 30 * 180 * 1_400_000, " ", (80/180) * 30 * 180 * 1_400_000;
say "Number of buildings that could be financed in a month: ", 180*30*1_400_000/5_000_000;
say "Number of saved lives a month: ", (100+80)*30;
say "";

# cont'd

__END__



