diff --git a/INFOS/EQDIAG/degen1.fig b/INFOS/EQDIAG/degen1.fig new file mode 100644 index 0000000..dcae809 --- /dev/null +++ b/INFOS/EQDIAG/degen1.fig @@ -0,0 +1,238 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Metric +A4 +100.00 +Single +0 +1200 2 +5 1 0 1 0 2 50 -1 -1 0.000 0 0 0 0 -916.875 7183.125 0 7200 -225 7785 -900 8100 +5 1 0 1 0 2 50 -1 -1 0.000 0 0 0 0 -847.500 7252.500 1800 7200 1350 8730 -900 9900 +5 1 0 1 0 2 50 -1 -1 0.000 0 0 0 0 -714.375 7385.625 2700 7200 2250 9090 -900 10800 +1 3 0 3 13 2 30 -1 20 0.000 1 0.0000 -7200 8100 127 127 -7200 8100 -7110 8190 +1 3 0 3 13 2 30 -1 20 0.000 1 0.0000 -12600 8100 127 127 -12600 8100 -12510 8190 +2 1 0 2 1 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + -7200 4500 -4050 4500 +2 1 0 2 1 7 70 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 0 4500 0 450 +2 1 0 3 1 7 72 -1 -1 0.000 0 0 -1 0 0 2 + 0 1800 2700 4500 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -4500 4500 -4500 900 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + -7200 4500 -7200 450 +2 1 0 3 1 7 74 -1 -1 0.000 0 0 -1 0 0 2 + 0 4500 2700 3150 +2 1 0 2 4 1 70 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 0 4500 3150 4500 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -7200 4500 -7425 4500 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -7200 3825 -7425 3825 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -7200 3150 -7425 3150 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -7200 2475 -7425 2475 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -7200 1800 -7425 1800 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -7200 1125 -7425 1125 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 0 4500 -225 4500 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 0 3825 -225 3825 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 0 2475 -225 2475 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 0 1800 -225 1800 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 0 1125 -225 1125 +2 3 0 0 1 1 76 -1 30 0.000 0 0 -1 0 0 8 + 0 900 0 1800 1800 3600 2700 3150 2700 900 2160 720 + 1170 1080 0 900 +2 1 0 2 1 7 70 -1 -1 0.000 0 0 -1 0 0 2 + 2700 4500 2700 900 +2 1 0 3 4 1 52 -1 -1 0.000 0 0 -1 0 0 2 + -7200 3825 -4500 3825 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -4500 4725 -4500 4500 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -6525 4725 -6525 4500 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -7200 4725 -7200 4500 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 0 4725 0 4500 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 1800 4725 1800 4500 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 2700 4725 2700 4500 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + -11901 1916 -11420 1916 -11420 2474 -11901 2474 -11901 1916 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + -10558 3259 -10077 3259 -10077 3816 -10558 3816 -10558 3259 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + -11167 3791 -10685 3791 -10685 4347 -11167 4347 -11167 3791 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + -12509 2448 -12027 2448 -12027 3006 -12509 3006 -12509 2448 +2 1 0 2 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -11281 4476 -9930 4476 +2 1 0 2 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -9930 3125 -9930 4476 +2 1 0 2 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -11281 3125 -11281 4476 +2 1 0 2 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -12632 4476 -11281 4476 +2 1 0 2 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -12632 3125 -11281 3125 +2 1 0 2 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -11281 1775 -11281 3125 +2 1 0 2 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -11281 3125 -9930 3125 +2 1 0 2 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -9930 1775 -9930 3125 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 0 3150 -225 3150 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 2925 3150 2700 3150 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -4275 3825 -4500 3825 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -11281 4476 -9930 4476 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -12632 4476 -11281 4476 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -11281 3125 -11281 4476 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -9930 3125 -9930 4476 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -11281 3125 -9930 3125 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -9930 1775 -9930 3125 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -11281 1775 -11281 3125 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -12632 3125 -11281 3125 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -12632 3125 -12632 4476 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -12632 1775 -12632 3125 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -12632 1775 -11281 1775 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -11281 1775 -9930 1775 +2 1 0 3 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + -13471 954 -12641 1784 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -7200 6885 -7200 6615 +2 1 0 2 1 1 50 -1 -1 0.000 0 0 -1 0 0 2 + -4500 6885 -4500 6615 +2 1 0 3 4 1 52 -1 -1 0.000 0 0 -1 0 0 2 + 0 6750 2700 6750 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 0 6885 0 6615 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 1800 6885 1800 6615 +2 1 0 2 4 1 50 -1 -1 0.000 0 0 -1 0 0 2 + 2700 6885 2700 6615 +2 1 0 1 0 2 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 90.00 120.00 + -7200 7200 -7200 7875 +2 1 0 1 0 2 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 90.00 120.00 + -4500 7200 -4500 7875 +2 1 0 1 0 2 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 90.00 120.00 + -855 8100 -4275 8100 +2 1 0 1 0 2 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 90.00 120.00 + -900 9900 -4275 9900 +2 1 0 1 0 2 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 90.00 120.00 + -900 10800 -4275 10800 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + -11167 2459 -10685 2459 -10685 3015 -11167 3015 -11167 2459 +2 3 0 0 4 4 56 -1 30 0.000 0 0 -1 0 0 8 + -7200 900 -7200 3825 -4500 3825 -4500 1800 -4500 900 -5580 1080 + -6120 540 -7200 900 +2 1 0 3 4 1 54 -1 -1 0.000 0 0 -1 0 0 2 + -7200 4500 -4500 3825 +2 1 0 4 4 1 40 -1 -1 0.000 0 0 -1 0 0 3 + -7200 8100 -4500 8100 -4500 10800 +2 2 0 1 0 2 99 -1 -1 0.000 0 0 -1 0 0 5 + -7200 8100 -4500 8100 -4500 10800 -7200 10800 -7200 8100 +2 2 0 3 13 2 100 -1 20 0.000 0 0 -1 0 0 5 + -4590 9855 -4410 9855 -4410 10890 -4590 10890 -4590 9855 +2 1 0 4 1 1 38 -1 -1 0.000 0 0 -1 0 0 4 + -7200 8100 -7200 9945 -4500 9945 -4500 10800 +2 1 1 4 4 1 38 -1 -1 10.000 0 0 -1 0 0 2 + -4500 9945 -4500 10845 +2 1 0 3 1 1 52 -1 -1 0.000 0 0 -1 0 0 2 + -7200 6750 -4500 6750 +2 2 0 3 13 2 32 -1 20 0.000 0 0 -1 0 0 5 + -12645 9990 -12465 9990 -12465 10845 -12645 10845 -12645 9990 +4 0 1 50 -1 3 30 0.0000 4 450 1485 -3960 4680 prob(r)\001 +4 0 4 70 -1 3 30 0.0000 4 450 1620 3240 4680 prob(B)\001 +4 0 4 50 -1 0 30 0.0000 4 435 2985 -7470 180 payoff player I\001 +4 0 1 70 -1 0 30 0.0000 4 435 3150 -180 180 payoff player II\001 +4 0 1 74 -1 3 30 0.0000 4 225 195 2340 3645 r\001 +4 0 1 72 -1 3 30 0.0000 4 345 135 675 3060 l\001 +4 0 4 52 -1 3 30 0.0000 4 330 300 -7155 4230 T\001 +4 1 4 70 -1 16 25 0.0000 4 285 240 0 5220 0\001 +4 1 1 50 -1 16 25 0.0000 4 285 240 -4500 5220 1\001 +4 1 1 50 -1 16 25 0.0000 4 285 240 -7200 5220 0\001 +4 0 1 994 0 16 35 0.0000 4 405 330 -11798 3745 0\001 +4 0 4 993 0 16 35 0.0000 4 405 330 -11087 2932 1\001 +4 0 1 992 0 16 35 0.0000 4 405 330 -10447 3745 2\001 +4 0 1 991 0 16 35 0.0000 4 405 330 -11798 2394 4\001 +4 0 4 990 0 16 35 0.0000 4 405 330 -12438 2932 1\001 +4 0 4 988 0 16 35 0.0000 4 405 330 -12438 4283 0\001 +4 0 1 986 0 16 35 0.0000 4 405 330 -10447 2394 0\001 +4 0 4 984 0 16 35 0.0000 4 405 330 -11087 4283 1\001 +4 0 1 996 0 0 34 0.0000 4 375 390 -13063 1133 II\001 +4 0 4 989 0 0 34 0.0000 4 375 195 -13522 1714 I\001 +4 0 4 983 0 3 35 0.0000 4 390 360 -13145 2663 T\001 +4 0 4 995 0 3 35 0.0000 4 390 390 -13209 4014 B\001 +4 0 1 987 0 3 35 0.0000 4 420 165 -12038 1617 l\001 +4 0 1 985 0 3 35 0.0000 4 270 225 -10718 1617 r\001 +4 1 1 50 -1 0 25 0.0000 4 285 540 -6525 5220 1/4\001 +4 1 4 70 -1 0 25 0.0000 4 285 540 1800 5220 2/3\001 +4 1 4 70 -1 0 25 0.0000 4 285 210 2700 5220 1\001 +4 1 4 70 -1 16 25 0.0000 4 285 240 -7650 2610 3\001 +4 1 4 70 -1 16 25 0.0000 4 285 240 -7650 1260 5\001 +4 1 4 70 -1 16 25 0.0000 4 285 240 -7650 3960 1\001 +4 1 4 70 -1 16 25 0.0000 4 285 240 -7650 3285 2\001 +4 1 4 70 -1 16 25 0.0000 4 285 240 -7650 1935 4\001 +4 1 4 70 -1 16 25 0.0000 4 285 240 -7650 4635 0\001 +4 1 1 70 -1 16 25 0.0000 4 285 240 -450 2610 3\001 +4 1 1 70 -1 16 25 0.0000 4 285 240 -450 1260 5\001 +4 1 1 70 -1 16 25 0.0000 4 285 240 -450 3960 1\001 +4 1 1 70 -1 16 25 0.0000 4 285 240 -450 3285 2\001 +4 1 1 70 -1 16 25 0.0000 4 285 240 -450 1935 4\001 +4 1 1 70 -1 16 25 0.0000 4 285 240 -450 4635 0\001 +4 1 1 70 -1 16 25 0.0000 4 285 240 3150 3285 2\001 +4 1 4 70 -1 16 25 0.0000 4 285 240 -4050 3960 1\001 +4 0 1 81 -1 3 30 0.0000 4 345 675 -4230 6885 l=0\001 +4 0 4 80 -1 3 30 0.0000 4 330 870 -1170 6885 B=0\001 +4 0 1 81 -1 3 30 0.0000 4 330 735 -8190 6885 r=0\001 +4 0 4 80 -1 3 30 0.0000 4 330 840 2970 6885 T=0\001 +4 0 4 54 -1 3 30 0.0000 4 330 330 -7875 10980 B\001 +4 0 1 74 -1 3 30 0.0000 4 225 195 -4545 11475 r\001 +4 0 1 72 -1 3 30 0.0000 4 345 135 -7245 11475 l\001 +4 0 4 52 -1 3 30 0.0000 4 330 300 -7875 8280 T\001 +4 0 1 72 -1 3 30 0.0000 4 345 135 720 6615 l\001 +4 0 1 74 -1 3 30 0.0000 4 225 195 2205 6615 r\001 +4 1 1 54 -1 0 20 0.0000 4 300 3150 1350 6075 best responses player II\001 +4 1 4 54 -1 0 20 0.0000 4 300 3045 -5850 6075 best responses player I\001 +4 0 4 52 -1 3 30 0.0000 4 330 300 -12060 8280 T\001 +4 0 1 72 -1 3 30 0.0000 4 345 135 -11520 8280 l\001 +4 0 13 52 -1 3 30 0.0000 4 450 3480 -12645 7245 Nash equilibria :\001 +4 0 4 54 -1 3 30 0.0000 4 330 330 -5040 4365 B\001 +4 0 4 54 -1 3 25 0.0000 4 390 3045 -12240 10710 prob(B) in [2/3,1]\001 +4 0 1 74 -1 3 30 0.0000 4 225 195 -8910 10710 r\001 +4 0 4 54 -1 3 30 0.0000 4 330 330 -4635 6525 B\001 +4 0 4 52 -1 3 30 0.0000 4 330 300 -6525 6525 T\001 diff --git a/INFOS/EQDIAG/degen1.png b/INFOS/EQDIAG/degen1.png new file mode 100644 index 0000000..1f64c61 Binary files /dev/null and b/INFOS/EQDIAG/degen1.png differ diff --git a/INFOS/convex-why.pdf b/INFOS/convex-why.pdf new file mode 100644 index 0000000..666d3c3 Binary files /dev/null and b/INFOS/convex-why.pdf differ diff --git a/INFOS/eqdiagrams.md b/INFOS/eqdiagrams.md index 7de8ba9..c12ad9c 100644 --- a/INFOS/eqdiagrams.md +++ b/INFOS/eqdiagrams.md @@ -231,3 +231,64 @@ and not the other possibilities which are seen on the left. At a later stage, the fineness of the grid should be adjustable, e.g. to multiples of 0.5 or 0.1. +## Degenerate games + +The following picture shows a _degenerate_ game. + +![](./EQDIAG/degen1.png) + +In two-player games, a game is degenerate if some player has +a mixed strategy which assigns positive probability to exactly _k_ +pure strategies, against which the other player has _more +than k_ pure best responses. + +Hence, a 2x2 game is degenerate if and only if there is a +pure strategy that has 2 best responses, like strategy _l_ +in the above game. (This holds because the only case where +the definition of degeneracy can apply is when _k_=1). + +A degenerate game can have an infinite number of Nash +equilibria. However, these will always be part of sets of +``interchangeable'' equilibria where it suffices to specify +the extreme points. In the above example, the two +best-response curves intersect in an interval where player II +play r for sure, and the two best responses T and B of +player I can now be mixed so that r stays a best response, +i.e. whenever prob(B) >= 2/3. + +This is a whole _interval_ of NE. +In the diagram this is indicated by a green rectangle. +It is displayed so that the two intersecting best response +curves are drawn with first (at lowest visual depth) the +green equilibrium rectangle, then (second-lowest depth) the +blue best response curve, then (highest, most visible depth) +for the interval where the two curves intersect the red +best-reponse curve as a DOTTED LINE. +(This is fine-tuning, but the green rectangle should be +shown for sure.) + +The intersection of the two best-response curves can result +in a single interval, and the two curves can even intersect +_completely_ in which case we get the union of two NE line +segments. + +### "Very" degenerate game: all strategies are best responses + +As an even further complication, two strategies can +_simultaneously_ be best responses, where they define the +same line segment in the goalpost diagram. In that case +the best response "curve" (normally the Z-like line with a +connecting orthogonal cross segment) is in fact the WHOLE +SQUARE (because that player can always play everything), +and the intersection is simply the other person's best +response curve. Which in turn may also be the whole square. +In other words, this case arises if the two strategies have +identical payoffs for the player, and then the two strategies may be arbitrarily +substituted for each other, or played in an arbitrary mixture. +(On the other hand, the two strategies may still have different effects +on the other player, and therefore one cannot just ignore one of them.) +This is the case, for example, when all payoffs are zero. +It may be confusing to display the equilibria for this came +and therefore be advisable not use this as the default game, +but rather, for example, one of the standard games such as +Battle of the Sexes. diff --git a/INFOS/largergames.md b/INFOS/largergames.md new file mode 100644 index 0000000..c8cff90 --- /dev/null +++ b/INFOS/largergames.md @@ -0,0 +1,9 @@ +## Larger games + +The following is an upper envelope diagram of a 4x2 game: + +![](./EQDIAG/42upper.png) + +which is the following game: + + diff --git a/INFOS/ongit.md b/INFOS/ongit.md index 3022eea..45e5ceb 100644 --- a/INFOS/ongit.md +++ b/INFOS/ongit.md @@ -1,8 +1,157 @@ -## Commits and Pull Requests +# Using git with jsgte -Follow the guidelines at +This is on introductory stuff everyone must know. + +Our repository on github: +https://github.com/gambitproject/jsgte + +## Basics: Unix command line, recording in markdown + +### Unix command line basics + +We assume you can use the command line in Unix (Linux or +MacOS). + +Basic operations to get started: +Open terminal, get familiar with the most basic Unix commands + + cd + ls + mv + cp + +start an editor you are familiar with (e.g. gedit on Linux), +use TAB-completion, and have the prompt display your current +working directory which can also be displayed with `pwd`. + +### Markdown files + +The minimal markup syntax ("markdown") is used in these +documentation files with the ending .md such as this one. + +Please record any useful experiences you have into such a +markdown file and add it to the INFOS/ directory. + +## Behaviour of the main webpage and creating the branch `gh-pages` + +The main file is in + + ./html/index.html + +which loads as a webpage and its JS functionality as a file +on your local computer, for example. + +However, on github this page will be displayed as code. + +In order to display its behaviour on github, a special +branch called + + gh-pages + +has to be created, which has the URL +http://gambitproject.github.io/jsgte/ + +To update this when changes happen to master use + + `ghp-import -p html` + +This moves the directory `html`, which contains +`index.html`, to the root of the branch `gh-pages`. +For more details see + +https://help.github.com/categories/github-pages-basics/ + +On Linux you can install ghp-import via + + `pip install ghp-import` + +## Git + +### Documentation about git + +Short intro to git (very useful and essential): http://gitref.org/ + + +Long intro to git: https://git-scm.com/book/en/v2 + +### Cloning the repository + +I prefer to use the ssh (secure shell) based interaction +with the remote which makes most authentication automatic. + +Clone the repository from github + + git clone git@github.com:gambitproject/jsgte.git + +which will create the directory `jsgte` in your current +directory. + +### Branches + +create your own branch with + + git branch my-test-branch + +and work on it with + + git checkout my-test-branch + +The list of all branches is visible with + + git branch -a + +### Basic git operation + +Make sure you know which branch you work on, listed with + + git branch + +Modify your program and files. Information about them is +listed with + + git status + +The basic cycle is then + + git add file + git commit + +and to include a message directly with the commit with + + git commit -m "my commit message" + +Note that all your work is local on your computer. + +### Synchronization with the remote repository on github + +(More details on how to push a newly created branch. +Creating it on github first seems the simplest.) + +Be careful not to commit on the master branch! +See the guidelines of the JQUERY foundation at http://contribute.jquery.org/commits-and-pull-requests/ -git commit with message +### Testing other remote work + +Example: Harkirat has created a branch named +`load-functionality` and wants me to test it. + +I first create such a branch locally, and switch to it, with + + git checkout -b load-functionality + +I then try to get the corresponding information from +Harkirat's repository with + + git pull git@github.com:hkirat/jsgte.git load-functionality + +and in response it asks me "please tell me who you are", +presumably so Harkirat knows who copied from his directory. +I do this with some configuration that was lost (including +on my editor `vim`) when I started over by cloning the +repository after some mess-up. So do this first (with your +own configuration data of course :-) : -git commit -m "my commit message" file + git config --global user.email "bvonstengel@gmail.com" + git config --global user.name "Bernhard von Stengel" + git config --global core.editor vim diff --git a/INFOS/onsoftwaredevelopment.md b/INFOS/onsoftwaredevelopment.md new file mode 100644 index 0000000..48d6da4 --- /dev/null +++ b/INFOS/onsoftwaredevelopment.md @@ -0,0 +1,7 @@ +# Minor resources on software development + +https://theagileist.wordpress.com/2015/11/02/the-nature-of-software-development/ + +review, says sensible things such as: + +set a time and money budget, produce the most valuable features first; keep the product ready to ship at all time - and stop when the clock runs out. diff --git a/fileformats/ConversionProgramsFinalReport.pdf b/fileformats/ConversionProgramsFinalReport.pdf new file mode 100644 index 0000000..26c0557 Binary files /dev/null and b/fileformats/ConversionProgramsFinalReport.pdf differ diff --git a/fileformats/IMAGES/3players.fig b/fileformats/IMAGES/3players.fig new file mode 100644 index 0000000..4eb510f --- /dev/null +++ b/fileformats/IMAGES/3players.fig @@ -0,0 +1,165 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Metric +A4 +100.00 +Single +0 +1200 2 +6 8100 6390 18180 6930 +4 2 13 992 0 16 40 0.0000 4 480 375 10935 6885 3\001 +4 2 13 994 0 16 40 0.0000 4 480 375 8550 6885 0\001 +4 2 13 992 0 16 40 0.0000 4 465 375 18135 6885 2\001 +4 2 13 994 0 16 40 0.0000 4 465 375 15750 6885 1\001 +-6 +6 8100 3960 18180 4590 +4 2 13 991 0 16 40 0.0000 4 465 375 8550 4493 4\001 +4 2 13 986 0 16 40 0.0000 4 480 375 10935 4500 0\001 +4 2 13 991 0 16 40 0.0000 4 465 375 15750 4493 1\001 +4 2 13 986 0 16 40 0.0000 4 465 375 18135 4500 2\001 +-6 +6 7380 4590 17370 5310 +4 1 1 991 0 16 40 0.0000 4 465 375 7582 5198 4\001 +4 1 1 986 0 16 40 0.0000 4 480 375 9967 5205 0\001 +4 2 4 983 0 3 62 0.0000 4 690 630 13140 5286 T\001 +4 1 1 991 0 16 40 0.0000 4 465 375 14782 5198 2\001 +4 1 1 986 0 16 40 0.0000 4 480 375 17167 5205 0\001 +-6 +6 7380 6930 17370 7740 +4 1 1 992 0 16 40 0.0000 4 465 375 9967 7590 2\001 +4 1 1 994 0 16 40 0.0000 4 480 375 7582 7590 0\001 +4 2 4 995 0 3 62 0.0000 4 690 690 13185 7686 B\001 +4 1 1 992 0 16 40 0.0000 4 465 375 17167 7590 2\001 +4 1 1 994 0 16 40 0.0000 4 465 375 14782 7590 4\001 +-6 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 4725 2205 6335 3815 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 3799 8752 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 11152 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 3799 6352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 3799 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 3799 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 6352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 8599 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 6199 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 8599 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 8599 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 6199 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 8599 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11925 2205 13535 3815 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 3799 15952 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 3799 18352 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 3799 13552 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 3799 15952 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 18352 3799 18352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 3799 15952 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 18352 3799 18352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 6199 15952 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 6199 18352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 6199 13552 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 6199 15952 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 8599 15952 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 18352 6199 18352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 8599 18352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 6199 15952 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 6199 18352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 6199 15952 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 8599 15952 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 18352 6199 18352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 8599 18352 8599 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 8955 7740 9540 7740 9540 8415 8955 8415 8955 7740 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 6615 5355 7200 5355 7200 6030 6615 6030 6615 5355 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 13770 7740 14355 7740 14355 8415 13770 8415 13770 7740 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 16155 5310 16740 5310 16740 5985 16155 5985 16155 5310 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 7290 4635 7875 4635 7875 5310 7290 5310 7290 4635 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 9675 7020 10260 7020 10260 7695 9675 7695 9675 7020 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 14490 6975 15075 6975 15075 7650 14490 7650 14490 6975 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 14490 4635 15075 4635 15075 5310 14490 5310 14490 4635 +2 2 0 2 13 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 8055 3915 8640 3915 8640 4590 8055 4590 8055 3915 +2 2 0 2 13 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 10440 6300 11025 6300 11025 6975 10440 6975 10440 6300 +2 2 0 2 13 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 17640 3915 18225 3915 18225 4590 17640 4590 17640 3915 +2 2 0 2 13 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 15255 6300 15840 6300 15840 6975 15255 6975 15255 6300 +4 2 4 989 0 0 60 0.0000 4 675 330 5085 3690 I\001 +4 2 4 983 0 3 62 0.0000 4 690 630 5940 5376 T\001 +4 2 4 995 0 3 62 0.0000 4 690 690 5985 7776 B\001 +4 1 1 987 0 3 62 0.0000 4 735 285 7650 3519 l\001 +4 1 1 985 0 3 62 0.0000 4 495 405 9900 3519 r\001 +4 0 1 996 0 0 60 0.0000 4 675 660 5535 2565 II\001 +4 0 4 984 0 16 40 0.0000 4 480 375 9096 8300 3\001 +4 0 4 990 0 16 40 0.0000 4 465 375 6696 5900 1\001 +4 0 4 988 0 16 40 0.0000 4 480 375 6696 8300 0\001 +4 0 4 993 0 16 40 0.0000 4 480 375 9096 5895 0\001 +4 2 4 989 0 0 60 0.0000 4 675 330 12285 3690 I\001 +4 1 1 987 0 3 62 0.0000 4 735 285 14850 3519 l\001 +4 1 1 985 0 3 62 0.0000 4 495 405 17100 3519 r\001 +4 0 1 996 0 0 60 0.0000 4 675 660 12735 2565 II\001 +4 0 4 984 0 16 40 0.0000 4 480 375 16296 8300 3\001 +4 0 4 990 0 16 40 0.0000 4 465 375 13896 5900 1\001 +4 0 4 988 0 16 40 0.0000 4 465 375 13896 8300 5\001 +4 0 4 993 0 16 40 0.0000 4 465 375 16296 5895 4\001 +4 0 13 996 0 0 60 0.0000 4 690 1275 6480 1530 III:\001 +4 1 13 995 0 3 62 0.0000 4 690 630 8820 1530 L\001 +4 0 13 996 0 0 60 0.0000 4 690 1275 13680 1530 III:\001 +4 1 13 995 0 3 62 0.0000 4 690 690 15930 1530 R\001 diff --git a/fileformats/IMAGES/3players.pdf b/fileformats/IMAGES/3players.pdf new file mode 100644 index 0000000..37e212f Binary files /dev/null and b/fileformats/IMAGES/3players.pdf differ diff --git a/fileformats/IMAGES/3players.png b/fileformats/IMAGES/3players.png new file mode 100644 index 0000000..d6122ec Binary files /dev/null and b/fileformats/IMAGES/3players.png differ diff --git a/fileformats/IMAGES/TBcorners.png b/fileformats/IMAGES/TBcorners.png new file mode 100644 index 0000000..e9fe617 Binary files /dev/null and b/fileformats/IMAGES/TBcorners.png differ diff --git a/fileformats/IMAGES/battle.fig b/fileformats/IMAGES/battle.fig new file mode 100644 index 0000000..2590c24 --- /dev/null +++ b/fileformats/IMAGES/battle.fig @@ -0,0 +1,75 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Metric +A4 +100.00 +Single +0 +1200 2 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 3799 8752 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 11152 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 3799 6352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 3799 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 6352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 8599 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 6199 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 8599 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 3799 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 8599 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 6199 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 8599 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 4725 2205 6335 3815 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 8955 7425 9810 7425 9810 8415 8955 8415 8955 7425 +2 1 0 1 2 7 51 -1 -1 0.000 0 0 -1 0 0 2 + 6345 8595 11115 3825 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 7695 3960 8550 3960 8550 4950 7695 4950 7695 3960 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 6525 5040 7380 5040 7380 6030 6525 6030 6525 5040 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 10080 6345 10935 6345 10935 7335 10080 7335 10080 6345 +4 0 4 988 0 16 62 0.0000 4 765 585 6696 8300 0\001 +4 0 4 984 0 16 62 0.0000 4 765 585 9096 8300 3\001 +4 0 4 993 0 16 62 0.0000 4 765 585 9096 5895 0\001 +4 2 4 989 0 0 60 0.0000 4 675 330 5085 3690 I\001 +4 2 4 983 0 3 62 0.0000 4 690 630 5940 5376 T\001 +4 2 4 995 0 3 62 0.0000 4 690 690 5985 7776 B\001 +4 0 4 990 0 16 62 0.0000 4 735 585 6696 5900 1\001 +4 2 1 991 0 16 62 0.0000 4 735 585 8415 4808 4\001 +4 2 1 994 0 16 62 0.0000 4 765 585 8415 7200 0\001 +4 2 1 992 0 16 62 0.0000 4 735 585 10800 7200 2\001 +4 2 1 986 0 16 62 0.0000 4 765 585 10800 4815 0\001 +4 1 1 987 0 3 62 0.0000 4 735 285 7650 3519 l\001 +4 1 1 985 0 3 62 0.0000 4 495 405 9900 3519 r\001 +4 0 1 996 0 0 60 0.0000 4 675 660 5535 2565 II\001 diff --git a/fileformats/IMAGES/battle.png b/fileformats/IMAGES/battle.png new file mode 100644 index 0000000..e3833a6 Binary files /dev/null and b/fileformats/IMAGES/battle.png differ diff --git a/fileformats/IMAGES/battleAB.fig b/fileformats/IMAGES/battleAB.fig new file mode 100644 index 0000000..355be10 --- /dev/null +++ b/fileformats/IMAGES/battleAB.fig @@ -0,0 +1,75 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Metric +A4 +100.00 +Single +0 +1200 2 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 3799 8752 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 11152 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 3799 6352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 3799 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 6352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 8599 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 6199 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 8599 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 3799 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 8599 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 6199 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 8599 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 4725 2205 6335 3815 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 8955 7425 9810 7425 9810 8415 8955 8415 8955 7425 +2 1 0 1 2 7 51 -1 -1 0.000 0 0 -1 0 0 2 + 6345 8595 11115 3825 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 7695 3960 8550 3960 8550 4950 7695 4950 7695 3960 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 6525 5040 7380 5040 7380 6030 6525 6030 6525 5040 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 10080 6345 10935 6345 10935 7335 10080 7335 10080 6345 +4 0 4 988 0 16 62 0.0000 4 765 585 6696 8300 0\001 +4 0 4 984 0 16 62 0.0000 4 765 585 9096 8300 3\001 +4 0 4 993 0 16 62 0.0000 4 765 585 9096 5895 0\001 +4 2 4 989 0 0 60 0.0000 4 705 2205 5085 3690 Alice\001 +4 2 4 983 0 3 62 0.0000 4 690 630 5940 5376 T\001 +4 2 4 995 0 3 62 0.0000 4 690 690 5985 7776 B\001 +4 0 4 990 0 16 62 0.0000 4 735 585 6696 5900 1\001 +4 2 1 991 0 16 62 0.0000 4 735 585 8415 4808 4\001 +4 2 1 994 0 16 62 0.0000 4 765 585 8415 7200 0\001 +4 2 1 992 0 16 62 0.0000 4 735 585 10800 7200 2\001 +4 2 1 986 0 16 62 0.0000 4 765 585 10800 4815 0\001 +4 1 1 987 0 3 62 0.0000 4 735 285 7650 3519 l\001 +4 1 1 985 0 3 62 0.0000 4 495 405 9900 3519 r\001 +4 0 1 996 0 0 60 0.0000 4 705 3765 5535 2565 Bernhard\001 diff --git a/fileformats/IMAGES/battleAB.png b/fileformats/IMAGES/battleAB.png new file mode 100644 index 0000000..30b4914 Binary files /dev/null and b/fileformats/IMAGES/battleAB.png differ diff --git a/fileformats/IMAGES/battleTB.fig b/fileformats/IMAGES/battleTB.fig new file mode 100644 index 0000000..cdb0017 --- /dev/null +++ b/fileformats/IMAGES/battleTB.fig @@ -0,0 +1,82 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Metric +A4 +100.00 +Single +0 +1200 2 +1 3 0 1 2 7 51 -1 -1 0.000 1 0.0000 6345 3780 270 270 6345 3780 6345 4050 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 3799 8752 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 11152 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 3799 6352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 3799 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 6352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 8599 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 6199 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 8599 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 3799 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 8599 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 6199 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 8599 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 4725 2205 6335 3815 +2 1 0 1 2 7 51 -1 -1 0.000 0 0 -1 0 0 2 + 6345 8595 11115 3825 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 6525 5040 7920 5040 7920 6030 6525 6030 6525 5040 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 7155 3960 8550 3960 8550 4950 7155 4950 7155 3960 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 8955 7425 10305 7425 10305 8415 8955 8415 8955 7425 +2 1 0 1 2 7 51 -1 -1 0.000 0 0 -1 0 0 2 + 6345 6187 8730 3780 +2 1 0 1 2 7 51 -1 -1 0.000 0 0 -1 0 0 2 + 8775 8595 11115 6232 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 9612 6345 11007 6345 11007 7335 9612 7335 9612 6345 +2 1 0 1 2 7 51 -1 -1 0.000 0 0 -1 0 0 2 + 5085 3015 5552 2555 +4 2 4 983 0 3 62 0.0000 4 900 1680 5940 5376 Top\001 +4 2 1 991 0 16 62 0.0000 4 765 1170 8415 4808 40\001 +4 2 4 995 0 3 62 0.0000 4 705 3120 5985 7776 Bottom\001 +4 0 1 996 0 0 60 0.0000 4 705 3765 5535 2565 Bernhard\001 +4 1 1 985 0 3 62 0.0000 4 930 2085 9990 3519 right\001 +4 1 1 987 0 3 62 0.0000 4 930 1380 7605 3519 left\001 +4 2 1 992 0 16 62 0.0000 4 765 1170 10869 7200 20\001 +4 2 1 986 0 16 62 0.0000 4 765 585 10844 4815 0\001 +4 0 4 990 0 16 62 0.0000 4 765 1170 6639 5900 10\001 +4 0 4 988 0 16 62 0.0000 4 765 585 6646 8300 0\001 +4 2 1 994 0 16 62 0.0000 4 765 585 8484 7200 0\001 +4 0 4 993 0 16 62 0.0000 4 765 585 9046 5895 0\001 +4 2 4 989 0 0 60 0.0000 4 705 2205 5085 3690 Alice\001 +4 0 4 984 0 16 62 0.0000 4 765 1170 9090 8280 30\001 diff --git a/fileformats/IMAGES/battleTB.png b/fileformats/IMAGES/battleTB.png new file mode 100644 index 0000000..f6d40a5 Binary files /dev/null and b/fileformats/IMAGES/battleTB.png differ diff --git a/fileformats/IMAGES/corners.png b/fileformats/IMAGES/corners.png new file mode 100644 index 0000000..c76be4d Binary files /dev/null and b/fileformats/IMAGES/corners.png differ diff --git a/fileformats/IMAGES/longnames3pl.fig b/fileformats/IMAGES/longnames3pl.fig new file mode 100644 index 0000000..148fed1 --- /dev/null +++ b/fileformats/IMAGES/longnames3pl.fig @@ -0,0 +1,165 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Metric +A4 +100.00 +Single +0 +1200 2 +6 8100 6390 18180 6930 +4 2 13 992 0 16 40 0.0000 4 480 375 10935 6885 3\001 +4 2 13 994 0 16 40 0.0000 4 480 375 8550 6885 0\001 +4 2 13 992 0 16 40 0.0000 4 465 375 18135 6885 2\001 +4 2 13 994 0 16 40 0.0000 4 465 375 15750 6885 1\001 +-6 +6 8100 3960 18180 4590 +4 2 13 991 0 16 40 0.0000 4 465 375 8550 4493 4\001 +4 2 13 986 0 16 40 0.0000 4 480 375 10935 4500 0\001 +4 2 13 991 0 16 40 0.0000 4 465 375 15750 4493 1\001 +4 2 13 986 0 16 40 0.0000 4 465 375 18135 4500 2\001 +-6 +6 7380 4590 17370 5310 +4 1 1 991 0 16 40 0.0000 4 465 375 7582 5198 4\001 +4 1 1 986 0 16 40 0.0000 4 480 375 9967 5205 0\001 +4 2 4 983 0 3 62 0.0000 4 690 630 13140 5286 T\001 +4 1 1 991 0 16 40 0.0000 4 465 375 14782 5198 2\001 +4 1 1 986 0 16 40 0.0000 4 480 375 17167 5205 0\001 +-6 +6 7380 6930 17370 7740 +4 1 1 992 0 16 40 0.0000 4 465 375 9967 7590 2\001 +4 1 1 994 0 16 40 0.0000 4 480 375 7582 7590 0\001 +4 2 4 995 0 3 62 0.0000 4 690 690 13185 7686 B\001 +4 1 1 992 0 16 40 0.0000 4 465 375 17167 7590 2\001 +4 1 1 994 0 16 40 0.0000 4 465 375 14782 7590 4\001 +-6 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 4725 2205 6335 3815 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 3799 8752 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 11152 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 3799 6352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 3799 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 3799 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 3799 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 6352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 8599 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 6199 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 8599 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 6199 8752 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 11152 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 6199 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 6352 8599 8752 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11152 6199 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 8752 8599 11152 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 11925 2205 13535 3815 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 3799 15952 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 3799 18352 3799 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 3799 13552 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 3799 15952 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 18352 3799 18352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 3799 15952 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 18352 3799 18352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 6199 15952 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 6199 18352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 6199 13552 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 6199 15952 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 8599 15952 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 18352 6199 18352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 8599 18352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 6199 15952 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 6199 18352 6199 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 6199 15952 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 13552 8599 15952 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 18352 6199 18352 8599 +2 1 0 4 0 0 997 0 -1 5.000 0 0 -1 0 0 2 + 15952 8599 18352 8599 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 8955 7740 9540 7740 9540 8415 8955 8415 8955 7740 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 6615 5355 7200 5355 7200 6030 6615 6030 6615 5355 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 13770 7740 14355 7740 14355 8415 13770 8415 13770 7740 +2 2 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 16155 5310 16740 5310 16740 5985 16155 5985 16155 5310 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 7290 4635 7875 4635 7875 5310 7290 5310 7290 4635 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 9675 7020 10260 7020 10260 7695 9675 7695 9675 7020 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 14490 6975 15075 6975 15075 7650 14490 7650 14490 6975 +2 2 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 14490 4635 15075 4635 15075 5310 14490 5310 14490 4635 +2 2 0 2 13 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 8055 3915 8640 3915 8640 4590 8055 4590 8055 3915 +2 2 0 2 13 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 10440 6300 11025 6300 11025 6975 10440 6975 10440 6300 +2 2 0 2 13 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 17640 3915 18225 3915 18225 4590 17640 4590 17640 3915 +2 2 0 2 13 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 15255 6300 15840 6300 15840 6975 15255 6975 15255 6300 +4 2 4 989 0 0 60 0.0000 4 705 2205 5085 3690 Alice\001 +4 2 4 983 0 3 62 0.0000 4 690 630 5940 5376 T\001 +4 2 4 995 0 3 62 0.0000 4 690 690 5985 7776 B\001 +4 1 1 987 0 3 62 0.0000 4 735 285 7650 3519 l\001 +4 1 1 985 0 3 62 0.0000 4 495 405 9900 3519 r\001 +4 0 1 996 0 0 60 0.0000 4 705 3765 5535 2565 Bernhard\001 +4 0 4 984 0 16 40 0.0000 4 480 375 9096 8300 3\001 +4 0 4 990 0 16 40 0.0000 4 465 375 6696 5900 1\001 +4 0 4 988 0 16 40 0.0000 4 480 375 6696 8300 0\001 +4 0 4 993 0 16 40 0.0000 4 480 375 9096 5895 0\001 +4 2 4 989 0 0 60 0.0000 4 705 2205 12285 3690 Alice\001 +4 1 1 987 0 3 62 0.0000 4 735 285 14850 3519 l\001 +4 1 1 985 0 3 62 0.0000 4 495 405 17100 3519 r\001 +4 0 1 996 0 0 60 0.0000 4 705 3765 12735 2565 Bernhard\001 +4 0 4 984 0 16 40 0.0000 4 480 375 16296 8300 3\001 +4 0 4 990 0 16 40 0.0000 4 465 375 13896 5900 1\001 +4 0 4 988 0 16 40 0.0000 4 465 375 13896 8300 5\001 +4 0 4 993 0 16 40 0.0000 4 465 375 16296 5895 4\001 +4 1 13 995 0 3 62 0.0000 4 690 630 8820 1530 L\001 +4 1 13 995 0 3 62 0.0000 4 690 690 15930 1530 R\001 +4 2 13 996 0 0 60 0.0000 4 705 3270 8235 1530 Charlie:\001 +4 2 13 996 0 0 60 0.0000 4 705 3270 15255 1530 Charlie:\001 diff --git a/fileformats/IMAGES/longnames3pl.pdf b/fileformats/IMAGES/longnames3pl.pdf new file mode 100644 index 0000000..c89b05f Binary files /dev/null and b/fileformats/IMAGES/longnames3pl.pdf differ diff --git a/fileformats/IMAGES/new.xml b/fileformats/IMAGES/new.xml new file mode 100644 index 0000000..0ede539 --- /dev/null +++ b/fileformats/IMAGES/new.xml @@ -0,0 +1,52 @@ + + + + #FF0000 + #0000FF + Times + 1 + 7 + 25 + 75 + + + Alice + Bob + + + + + + + 2 + -2 + + + 1 + -1 + + + + -1 + 1 + + + + + + -2 + 2 + + + 1 + -1 + + + + -1 + 1 + + + + + \ No newline at end of file diff --git a/fileformats/IMAGES/poker.xml b/fileformats/IMAGES/poker.xml new file mode 100644 index 0000000..d5fb47d --- /dev/null +++ b/fileformats/IMAGES/poker.xml @@ -0,0 +1,52 @@ + + + + #FF0000 + #0000FF + Times + 1 + 7 + 25 + 75 + + + Alice + Bob + + + + + + + 2 + -2 + + + 1 + -1 + + + + -1 + 1 + + + + + + -2 + 2 + + + 1 + -1 + + + + -1 + 1 + + + + + diff --git a/fileformats/IMAGES/rank1-6x6.xml b/fileformats/IMAGES/rank1-6x6.xml new file mode 100644 index 0000000..1c724f5 --- /dev/null +++ b/fileformats/IMAGES/rank1-6x6.xml @@ -0,0 +1,31 @@ + + + + #FF0000 + #0000FF + Times + 1 + 5 + 5 + + + 1 + 2 + + + { "A" "B" "C" "D" "E" "F" } + { "g" "h" "i" "j" "k" "l" } + 1 0 0 0 0 0 +6 9 0 0 0 0 +18 54 81 0 0 0 +54 162 486 729 0 0 +162 486 1458 4374 6561 0 +486 1458 4374 13122 39366 59049 + 1 6 18 54 162 486 +0 9 54 162 486 1458 +0 0 81 486 1458 4374 +0 0 0 729 4374 13122 +0 0 0 0 6561 39366 +0 0 0 0 0 59049 + + \ No newline at end of file diff --git a/fileformats/strategic.md b/fileformats/strategic.md index a9a0cb0..aa12e02 100644 --- a/fileformats/strategic.md +++ b/fileformats/strategic.md @@ -19,9 +19,10 @@ form* instead, and we should do so too. Hence, the shorthand SF suggests itself. One of the problems is that SF is also a possible -abbreviation for the *sequence form* that is derived from -the *extensive form* (a game tree) and is a strategic -description of the same size as the game tree. +abbreviation for the *sequence form* which is another, +different strategic description, which is derived from +the *extensive form* (a game tree). Unlike the strategic +form, the sequence form has the same size as the game tree. The sequence form is very useful for solving game trees of large (and even medium) size and we will use it. @@ -29,19 +30,26 @@ So it seems that we have convenient abbreviations EF, NF, SF for extensive form, normal form, and sequence form. However, we should not re-introduce "normal form" for this purpose only. In addition, the sequence form is not well -known. +known, nor is the abbreviation "SF" for "sequence form". I suggest the following alternatives (for discussion): * EF for extensive form -* SF or STF for strategic form (also known as normal form) -* QF or SQF for the seQuence form +* SF (or possibly STF) for strategic form (also known as normal form) +* QF (or possibly SQF) for the seQuence form + +Further common abbreviations: + +* NE for Nash equilibrium +* SPNE for subgame perfect Nash equilibrium. ## Definition The SF (strategic form) is specified by a set of -N *players*, each of which has a set of *strategies*, and -*payoffs* defined for each player as follows. +N *players*, each of which has a nonempty set of +*strategies*, and *payoffs* defined for each player as +follows. +N is a positive integer. A *strategy profile* is an N-tuple of strategies, one for each player. The SF specifies a payoff to each player for each strategy @@ -51,10 +59,189 @@ In our computational setting, the sets of players and their strategies are all finite, payoffs are rational numbers (in the theory, real numbers). +The strategic form can be considered either as + +* a primitive, that is, a given game structure on its own, or +* *derived* from an EF (extensive form) game. + +EF games are often converted to SF in order to study +concepts like NE (Nash equilibrium), or to compute a NE. + +### Names of strategies and players + In order to display a SF game, players and strategies should have *names*. +In JS, these names could be used to index the N-dimensional +array that defines the SF. +However, the order of these names should not prescribe the +order in which they appear. +We will therefore *number* the strategies as nonnegative +integers (starting from 0), and keep their names separately. + +Players should also have names. +We number players with 1, 2, 3 and so on. +Player 0 is the special *chance player* in an EF game. + +## Two-player games + +The following is an example of a two-player game, a version +of the "Battle of the Sexes" or BoS. + +![](./IMAGES/battle.png) + +Player 1 (named I) chooses a row, and player 2 (named II) +chooses a column. +The strategies of player 1 are named T and B. +The strategies of player 2 are named l and r. +Each cell contains two payoffs, one for player 1 and one for +player 2. +The name of player 1, his strategies, and payoffs, are shown +in red (for "row player"). +The name of player 2, her strategies, and payoffs, are shown +in blue. +(For two players we often use the two genders "he" and "she".) + +This is the standard display of a two-player game. + +### Displaying two-player games + +We want to create displays that *look perfect* so that +people use them in their presentations. + +We will also allow some customizations (e.g., fonts and +colors), but the default should already look very nice. + +The next picture, although a bit crowded, shows the +following features which make the display at least not +messed up when there are long names for players and +strategies. + +![](./IMAGES/battleTB.png) + +All cells are *square*. + +*Player names* are shown next to a diagonal line of fixed +length, about 3/4 of the length of a cell diagonal. +(The length of this diagonal line should be configurable; +not everyone wants to have this line.) +The name of the row player is displayed *right-adjusted*. +The name of the column player is displayed +*left-adjusted*, and sufficiently *above* the names for +the column strategies. + +In each cell, the payoffs are *left-adjusted* for player 1, +and *right-adjusted* for player 2. +The purpose is to make them look nice in the usual situation +when most payoffs are small integers. +We do *not* make the payoffs to player 1 right-adjusted +because if only a single payoff is rather wide, such as a +fraction like 5/12, then the others would be in a weird +position. + +The *strategy names* are *right-adjusted* for player 1, and +*centered* for player 2. + +It is (optionally) possible to put a *box* around each +payoff that is a *best response*, i.e. gives maximal payoff, +to the given strategy of the other player. +(This information can be automatically derived. They +identify pure-strategy NE as those cells where all payoffs +are surrounded by boxes.) +These boxes should not run into each other, i.e. payoffs be +sufficiently apart, when the payoffs are wide. + +The next picture is taken from the `xfig` program which has +been used to generate these pictures. +It displays (with small squares) the adjustment (left, +right, or centered) of the respective text. + +Moreover, the lower left corner of each payoff to player 1 and the +upper right corner of each payoff to player 2 should sit on +the off-diagonal (from the lower left corner to the upper +right corner) of each cell. The same applies to the +best-response boxes. + +![](./IMAGES/TBcorners.png) + +When drawing these, a specific problem is that the upper +right corner of a textbox cannot normally be described, but +has to be COMPUTED from the current font size (which should +give the height in pints). We should provide for this, and +not assume a fixed font size. + +This picture shows also, with a green circle, the +*top left corner* of the main rectangle of the strategic +form, where also the diagonal line starts. +This point should have graphic coordinates (0,0) against +which all drawing commands of lines should be computed. + +The *grid* of cells should be drawn with as a *closed +rectangle* around the entire strategic form (which, in +theory, could have its own width). +The next picture shows what goes wrong when the grid is just +drawn with independet parallel horizontal and vertical lines +- the corner will show a little dent (left) which does not +occur when drawing a rectangle (right). + +![](./IMAGES/corners.png) + +Suggestion: draw the outer retangle separate, with its own +line width, and the separating parallel inner lines +independently (which may possibly have a different line +width, default same as outer rectangle). + +### Fonts + +There should be a standard font *size* that makes single-digit +payoffs look nice and balanced (see above pictures). +A simple remedy to adjust overcrowded cells is to only +change the *cell size* but leave the font size alone. + +As *typefaces* I have chosen above, and think it looks good: + +* Helvetica (sans serif) for payoffs +* Roman (serif) for player names +* Roman bold italic (alternative: italic) for strategy + names. + +Making these at some time choosable is a future feature. + +## More than two players + +2 players: + +* player 1 - rows +* player 2 - columns + +3 players: +as many PANELS has player 3 has strategies + +* player 1 - rows +* player 2 - columns +* player 3 - panels + +The panels should normally be displayed horizontally. + +Strategy names, per default: + +* player 1 - upper case +* player 2 - lower case +* player 3 - upper case + +standard strategy names: + +* player 1 - two strategies: T,B; three strategies: T,M,B; + four more strategies: A,B,C,D etc. +* player 2 - two strategies: l,r; three strategies: l,c,r + four more strategies: a,b,c,d etc. +* player 3 - if panels displayed horizontally: + two strategies: L,R; three strategies: L,C,R + if panels displayed vertically, or perhaps already + generally, for any number of strategies: + P,Q,R,S,T... (which conflicts least with the above). +(not complete) The strategic form is a table that lists STRATEGIES for each player (rows for player 1, columns for player 2) and the diff --git a/html/2by2.html b/html/2by2.html index cdee2d3..bfc2c44 100644 --- a/html/2by2.html +++ b/html/2by2.html @@ -5,97 +5,360 @@ 2 by 2 games - - - - + + + - - + + - - - + + + - - - + + +
\
\\\\
\\\\
- + + + + + + diff --git a/html/2by2_svg.html b/html/2by2_svg.html new file mode 100644 index 0000000..00a8388 --- /dev/null +++ b/html/2by2_svg.html @@ -0,0 +1,407 @@ + + + + + + 2 by 2 games + + + + + + + + + + + + + + + + + + + + + + + + + +
\
\\
\\
+ + + + + + Player1 payoff + Player2 S2 prob + S1 + S2 + 0 + 1 + + + + + S1 + + + S2 + + + 9 + + 8 + + 7 + + 6 + + 5 + + 4 + + 3 + + 2 + + 1 + + 9 + + 8 + + 7 + + 6 + + 5 + + 4 + + 3 + + 2 + + 1 + + + + 1 + + + + + + + + + + + + + + Player2 payoff + Player1 S2 prob + 0 + 1 + S1 + S2 + + + + + S1 + + + S2 + + + 9 + + 8 + + 7 + + 6 + + 5 + + 4 + + 3 + + 2 + + 1 + 9 + + 8 + + 7 + + 6 + + 5 + + 4 + + 3 + + 2 + + 1 + + + + 1 + + + + + + + + + + + diff --git a/html/css/2by2.css b/html/css/2by2.css index 86dba40..eaacbb3 100644 --- a/html/css/2by2.css +++ b/html/css/2by2.css @@ -1,5 +1,5 @@ .player1{ - color:red + color:green } .player2{ @@ -10,3 +10,8 @@ input{ width: 50px; text-align: center; } + +canvas{ + #padding: 30px; + margin: 50px; +} diff --git a/html/css/font.css b/html/css/font.css index dfe9888..8faac22 100755 --- a/html/css/font.css +++ b/html/css/font.css @@ -59,3 +59,9 @@ .icon-cog:before { content: "\e900"; } +.icon-save:before { + content: "\f15b"; +} +.icon-load:before { + content: "\f15b "; +} \ No newline at end of file diff --git a/html/index.html b/html/index.html index 7566841..3cea9d4 100644 --- a/html/index.html +++ b/html/index.html @@ -25,6 +25,8 @@
@@ -88,8 +90,11 @@ +
+ + @@ -103,5 +108,7 @@ + + diff --git a/html/js/guiutils/Block.js b/html/js/guiutils/Block.js new file mode 100644 index 0000000..49bd136 --- /dev/null +++ b/html/js/guiutils/Block.js @@ -0,0 +1,30 @@ +GTE.TREE = (function(parentModule) { + "use strict"; + + /** + * Creates a new Block . + * @class + */ + function Block(moves, x, y) { + this.shape = null; + this.moves = moves; + this.x1 = x; + this.y1 = y; + } + + MultiAction.prototype.draw = function() { + var width = parseInt(GTE.STORAGE.settingsRectSize); + this.shape = GTE.canvas.rect(width, GTE.STORAGE.settingsCircleSize) + .fill({ + color: '#9d9d9d' + }) + .addClass('circle'); + this.shape.translate(this.x1*width, + this.y1 * width); + }; + + // Add class to parent module + parentModule.Block = Block; + + return parentModule; +}(GTE.TREE)); // Add to GTE.TREE sub-module diff --git a/html/js/guiutils/Tools.js b/html/js/guiutils/Tools.js index 760e868..7f4b651 100644 --- a/html/js/guiutils/Tools.js +++ b/html/js/guiutils/Tools.js @@ -7,6 +7,7 @@ GTE.UI = (function (parentModule) { */ function Tools() { this.activePlayer = -1; + this.isetToolsRan = false; } /** @@ -14,8 +15,9 @@ GTE.UI = (function (parentModule) { * It creates a new Tree and draws it */ Tools.prototype.newTree = function() { - this.resetPlayers(); + this.resetPlayers(1); this.activePlayer = -1; + this.isetToolsRan = false; var root = new GTE.TREE.Node(null); var child1 = new GTE.TREE.Node(root); var child2 = new GTE.TREE.Node(root); @@ -32,6 +34,47 @@ GTE.UI = (function (parentModule) { this.switchMode(GTE.MODES.ADD); }; + /** + * Function used to create new tree according + * to the xml data received. + */ + Tools.prototype.loadTree = function(xml) { + var importer = new GTE.TREE.XmlImporter(xml); + importer.parseXmlToJson(); + importer.loadTree(); + }; + + /** + * Builds the sub-tree for the variable @node + */ + Tools.prototype.createRecursiveTree = function(node, father) { + var currentNode = GTE.tree.addChildNodeTo( father, GTE.tree.players[node.jAttr.player] ); + for( var i = 0 ; i < node.jIndex.length ; i++) { + if(node.jIndex[i][0] == "node") { + this.createRecursiveTree(node.node[node.jIndex[i][1]], currentNode); + } + if(node.jIndex[i][0] == "outcome") { + GTE.tree.addChildNodeTo(currentNode, GTE.tree.players[node.outcome[node.jIndex[i][1]].jAttr.player]); + } + } + }; + + /** + * Function to create nodes of the laoded tree + */ + Tools.prototype.createTree = function(node, root) { + // var root = new GTE.TREE.Node(null, node.jAttr.player); + for( var i = 0 ; i < node.jIndex.length ; i++) { + if(node.jIndex[i][0] == "node") { + this.createRecursiveTree(node.node[node.jIndex[i][1]], root); + } + if(node.jIndex[i][0] == "outcome") { + GTE.tree.addChildNodeTo(root, GTE.tree.players[node.outcome[node.jIndex[i][1]].jAttr.player]); + } + } + return root; + }; + /** * Function that switches mode to the one specified by the button pressed * @param {Button} button Button pressed that will activate mode @@ -119,10 +162,10 @@ GTE.UI = (function (parentModule) { /** * Function that adds a player button to the toolbar */ - Tools.prototype.addPlayer = function () { + Tools.prototype.addPlayer = function (colour, id, name) { if (GTE.tree.numberOfPlayers() < GTE.CONSTANTS.MAX_PLAYERS) { // Create a new player - var player = GTE.tree.newPlayer(); + var player = GTE.tree.newPlayer(colour, id, name); if (player !== null) { if (player.id == GTE.CONSTANTS.MIN_PLAYERS + 1) { document.getElementById("button-player-less").className = @@ -239,18 +282,74 @@ GTE.UI = (function (parentModule) { }; /** - * Removes all players from the toolbar + * Resets the length of the players to @length in the toolbar. */ - Tools.prototype.resetPlayers = function () { + Tools.prototype.resetPlayers = function (length) { var buttons = document.getElementsByClassName("button-player"); - while(buttons.length > 2) { + while(buttons.length > length + 1) { this.removePlayerButton(buttons[buttons.length-1]); } }; - Tools.prototype.changePlayerColour = function (playerId, colour) { - var playerButton = document.getElementById("button-player-" + playerId); - playerButton.style.color = colour; + /** + * Adds new players to the according to color and name arrays + */ + Tools.prototype.setPlayers = function (colour,name) { + for(var i=1; i<=name.length; i++) + { + this.addPlayer(colour[i-1].jValue.trim(), i, name[i-1].jValue.trim()); + } + }; + + /** + * Sets display properties of the tree + */ + Tools.prototype.setDisplayProperties = function (display) { + GTE.STORAGE.settingsLineThickness = display.strokeWidth[0].jValue.trim(); + GTE.STORAGE.settingsCircleSize = display.nodeDiameter[0].jValue.trim(); + GTE.STORAGE.settingsDistLevels = display.levelDistance[0].jValue.trim(); + }; + + /** + * Sets isets for the loaded tree + */ + Tools.prototype.setIsets = function (nodejs, node) { + + // var nodes = GTE.tree.getAllNodes(true); + // for (var i = 0; i < nodes.length; i++) { + // GTE.tree.createSingletonISet(nodes[i]); + // } + GTE.tree.createSingletonISet(node); + + if(nodejs.jIndex != undefined) { + for( var i = 0 ; i < nodejs.jIndex.length ; i++) { + if(nodejs.jIndex[i][0] == "node") { + this.setIsets(nodejs.node[nodejs.jIndex[i][1]], node.children[i]); + } + if(nodejs.jIndex[i][0] == "outcome") { + this.setIsets(nodejs.outcome[nodejs.jIndex[i][1]], node.children[i]); + } + } + } + }; + + Tools.prototype.mergeIsets = function (nodejs, node, listOfIsets) { + if(node.iset != listOfIsets[nodejs.jAttr.iset] && nodejs.jAttr.iset != undefined){ +// GTE.MODE = GTE.MODES.MERGE; + node.changeISet(listOfisets[nodejs.jAttr.iset]); + GTE.tree.draw(); +// GTE.tree.merge(node.iset, GTE.tree.isets[nodejs.jAttr.iset]); + } + if(nodejs.jIndex != undefined) { + for( var i = 0 ; i < nodejs.jIndex.length ; i++) { + if(nodejs.jIndex[i][0] == "node") { + this.mergeIsets(nodejs.node[nodejs.jIndex[i][1]], node.children[i], listOfIsets); + } + if(nodejs.jIndex[i][0] == "outcome") { + // this.mergeIsets(nodejs.outcome[nodejs.jIndex[i][1]], node.children[i]); + } + } + } }; // Add class to parent module diff --git a/html/js/main.js b/html/js/main.js index 84abc8e..28c447f 100644 --- a/html/js/main.js +++ b/html/js/main.js @@ -78,6 +78,32 @@ GTE.tools.newTree(); return false; }); + document.getElementById("button-load").addEventListener("click", function(){ + var xmlFiles = document.getElementById("xmlFile"); + xmlFiles.onchange = function(e) { + var file = xmlFiles.files[0]; + var reader = new FileReader(); + reader.onloadend = function(evt) { + if (evt.target.readyState == FileReader.DONE) { + GTE.tools.loadTree(evt.target.result); + }; + }; + + var blob = file.slice(0, file.size - 1); + reader.readAsBinaryString(blob); + }; + if (xmlFiles) { + xmlFiles.click(); + } + return false; + }); + + document.getElementById("button-save").addEventListener("click", function(){ + var exporter = new GTE.TREE.XmlExporter(); + exporter.exportTree(); + saveData(exporter.toString(),"tree.xml"); + return false; + }); document.getElementById("button-add").addEventListener("click", function(){ GTE.tools.switchMode(GTE.MODES.ADD); @@ -200,4 +226,19 @@ settings.style.left = left + 'px'; } -}()); + var saveData = (function () { + var a = document.createElement("a"); + document.body.appendChild(a); + a.style = "display: none"; + return function (data, fileName) { + var curData = data, + blob = new Blob([curData], {type: "text/plain"}), + url = window.URL.createObjectURL(blob); + a.href = url; + a.download = fileName; + a.click(); + window.URL.revokeObjectURL(url); + }; + }()); + +}()); \ No newline at end of file diff --git a/html/js/thirdparty/xml2json.js b/html/js/thirdparty/xml2json.js new file mode 100644 index 0000000..0c717bd --- /dev/null +++ b/html/js/thirdparty/xml2json.js @@ -0,0 +1,349 @@ +/* +Author: Surya Nyayapati +http://www.nyayapati.com/surya + +The MIT License (MIT) +Copyright (c) <2012> + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +(function (window, undefined) { + var X2J = { + VERSION: '1.1', + //convert xml to x2j object + //Rule: Get ordered list of javascript object for xml + parseXml: function (xml, xpathExpression) { + var isObjectEmpty = function (obj) { + for (var name in obj) { + return false; + } + return true; + }; + //TODO:if there is name conflict, change name and during output change it back + + //jNode = [{jName, jValue}] || [{jIndex, jNode,jName}] + //jIndex = [{jName, counter}] + //jName = "node_name" + //jValue = "node_value" + //counter = 0..n (i.e. index for jNode) + var GetChildNode = function (domElement) { + var obj = {}; + obj['jName'] = domElement.nodeName; + obj['jAttr'] = GetAttributes(domElement.attributes); + + for (var i = 0; i < domElement.childNodes.length; i++) { + var node1 = domElement.childNodes[i]; + if (node1.nodeType === TEXT_NODE) { + if (node1.textContent.trim() !== "") { + obj['jValue'] = node1.textContent; + } + } + else + { + var tmp = {}; + var childNode = GetChildNode(node1); + for (var key in childNode) { + if (key !== 'jIndex' && key !== 'jValue') { + tmp[key] = childNode[key]; + } + } + + if(!childNode['jIndex']) + { + tmp = childNode; + if (!tmp.hasOwnProperty('jValue')) { + tmp['jValue'] = ''; + } + } + + if (obj['jIndex'] === undefined) { + obj['jIndex'] = []; + } + + if (obj.hasOwnProperty(node1.nodeName)) { + obj['jIndex'].push([node1.nodeName, obj[node1.nodeName].length]); + if (childNode['jIndex'] !== undefined) { + tmp['jIndex'] = childNode['jIndex']; + } + obj[node1.nodeName].push(tmp); + } + else { + obj[node1.nodeName] = []; + obj['jIndex'].push([node1.nodeName, obj[node1.nodeName].length]); + if (childNode['jIndex'] !== undefined) { + tmp['jIndex'] = childNode['jIndex']; + } + obj[node1.nodeName].push(tmp); + } + } + } + + return obj; + }; + + //Rule: attributes are unique list of name value pair inside a node. + //Summary: This will return an object with jIndex property as an array and all the attributes as name value properties. + //The number of attributes in a node will be equal to jIndex length. each element inside jIndex will be same as attribute name. + var GetAttributes = function (attrs) { + var obj = {}; + obj['jIndex'] = []; + if(!attrs) return obj; + + for (var i = 0; i < attrs.length; i++) { + obj[attrs[i].name] = attrs[i].value; + obj['jIndex'].push(attrs[i].name); + } + return obj; + }; + + if (!xml) { + return; + } + if (!xpathExpression) { + xpathExpression = '/'; + } + //var xmlStr = (new XMLSerializer()).serializeToString(xml); + var xmlDocument = null; + if(typeof(xml) ==='string') + { + var parser = new DOMParser(); + xmlDocument = parser.parseFromString(xml, "text/xml"); + } + else + { + xmlDocument = xml; + } + + //var xmlDoc = parser.parseFromString(xmlStr, "text/xml"); + //var nodes = xmlDoc.evaluate("/", xmlDoc, null, XPathResult.ANY_TYPE, null); + var xPathResult1 = xmlDocument.evaluate(xpathExpression, xmlDocument, null, XPathResult.ANY_TYPE, null); + if (xPathResult1.resultType === UNORDERED_NODE_ITERATOR_TYPE + || xPathResult1.resultType === ORDERED_NODE_ITERATOR_TYPE) {//if result is a node-set then UNORDERED_NODE_ITERATOR_TYPE is always the resulting type + + var dom_node1 = xPathResult1.iterateNext(); //returns node https://developer.mozilla.org/en/DOM/Node + var domArr = []; + while (dom_node1) { + domArr.push(GetChildNode(dom_node1)); + dom_node1 = xPathResult1.iterateNext(); + } + //if (domArr.length == 1) { + // return domArr[0]; + //} + return domArr; + + } else { + console.log(xPathResult1); + } + }, + printJNode: function (jNode, callback) { + if (jNode === undefined) { + return; + } + var _printNode = function (jNode, level) { + if (jNode.jIndex !== undefined) { + for (var j = 0; j < jNode.jIndex.length; j++) { + var node = jNode[jNode.jIndex[j][0]][jNode.jIndex[j][1]]; + if (node.jIndex !== undefined) { + callback(jNode.jIndex[j][0], node.jIndex, node.jAttr, level); + _printNode(node, level + 1); //go deeper + } else { + callback(node.jName, node.jValue, node.jAttr, level); + } + } + } else { + callback(jNode.jName, jNode.jValue, jNode.jAttr, level); + } + }; + _printNode(jNode, 0); + }, + printJAttribute: function (jAttr) { + var strArr = []; + if (jAttr.jIndex) { + for (var i = 0; i < jAttr.jIndex.length; i++) { + strArr.push(jAttr.jIndex[i] + "=" + jAttr[jAttr.jIndex[i]]); + } + } + return strArr.join(', '); + }, + ///Safe way to get value, Use when not sure if a name is present. if not present return default_value. + getValue: function (jNode, name, index, default_value) {//if index undefined then 0 + //console.log(jNode, name, index,default_value); + if (jNode === undefined || jNode === null) { + return default_value; + } + if (index === undefined || typeof(index) != 'number') { + index = 0; + } + + if (index >= 0) {//if index is present + if (jNode.length !== undefined && jNode.length == index + 1) {//if array + if (jNode[index].jName !== undefined && jNode[index].jName == name) { + //console.log('getValue 0'); + return jNode[index].jValue; //tested + } + } + else if (jNode[name] !== undefined) {//if not array but name obj is array then return indexOf + var node = jNode[name][index]; + if (node !== undefined) { + if (node.jValue !== undefined) { + //console.log('getValue 1'); + return node.jValue; + } else { + //console.log('getValue 2'); + return node; + } + } + } + else if (jNode.jName !== undefined && jNode.jName == name) { + //console.log('getValue 3'); + return jNode.jValue; + } + else if (jNode.length === undefined && jNode[name]) { //if not array and name exists + //console.log('getValue 4'); + return jNode[name]; //tested + } + + return default_value; + } + + throw new RangeError("index must be positive!"); + + }, + search: function (jNode, name, options) { + //options is object with keys like 'max_deep', ... + //same as getValue, but returns array of obj(jName,jValue/jIndex,jAttr,[jNode]??) + }, + getAttr: function (jNode, name) { + var isObjectEmpty = function (obj) { + for (var name in obj) { + return false; + } + return true; + }; + + if (!jNode || !jNode.jAttr || isObjectEmpty(jNode.jAttr)) { + return; + } + return jNode.jAttr[name]; + }, + getJson: function (jNode) { + return JSON.stringify(jNode); + }, + getXml: function (jNode) { + var spaces = function (no) { + if (no === 0) { + return ''; + } + var space = ' '; + for (var i = 0; i < no; i++) { + space += ' '; + } + return space; + }; + var _printAttribute = function (jNode) { + if (!jNode) { + return; + } + var arr = []; + for (var i = 0; i < jNode.jAttr.jIndex.length; i++) { + arr.push(' ' + jNode.jAttr.jIndex[i] + '="' + jNode.jAttr[jNode.jAttr.jIndex[i]] + '"'); + } + return arr.join(''); + } + var _printNode = function (jNode, level) { + if (!jNode) { + return; + } + var xml = ''; + if (jNode.jIndex) { + for (var j = 0; j < jNode.jIndex.length; j++) { + var node = jNode[jNode.jIndex[j][0]][jNode.jIndex[j][1]]; + if (node.jIndex) { + xml += spaces(level) + '<' + jNode.jIndex[j][0] + _printAttribute(node) + '>\n' + _printNode(node, level + 1) + spaces(level) + '\n'; + } else { + xml += spaces(level) + '<' + jNode.jIndex[j][0] + _printAttribute(node) + '>' + node.jValue + '\n'; + } + } + } else { + xml += spaces(level) + '<' + jNode.jName + _printAttribute(jNode) + '>' + jNode.jValue + '\n'; + } + return xml; + }; + if (jNode.length) { + var xmlArr = []; + for (var i = 0; i < jNode.length; i++) { + xmlArr.push(_printNode(jNode[i], 0)) + } + return xmlArr; + } else { + return _printNode(jNode, 0); + } + } + }; + + window.X2J = X2J; + + ////////////////////////////////////////////////////////// + //////////////////////Constants/////////////////////// + ////////////////////////////////////////////////////////// + + var ANY_TYPE = 0, //A result set containing whatever type naturally results from evaluation of the expression. Note that if the result is a node-set then UNORDERED_NODE_ITERATOR_TYPE is always the resulting type. + NUMBER_TYPE = 1, //A result containing a single number. This is useful for example, in an XPath expression using the count() function. + STRING_TYPE = 2, //A result containing a single string. + BOOLEAN_TYPE = 3, //A result containing a single boolean value. This is useful for example, in an XPath expression using the not() function. + UNORDERED_NODE_ITERATOR_TYPE = 4, //A result node-set containing all the nodes matching the expression. The nodes may not necessarily be in the same order that they appear in the document. + ORDERED_NODE_ITERATOR_TYPE = 5, //A result node-set containing all the nodes matching the expression. The nodes in the result set are in the same order that they appear in the document. + UNORDERED_NODE_SNAPSHOT_TYPE = 6, //A result node-set containing snapshots of all the nodes matching the expression. The nodes may not necessarily be in the same order that they appear in the document. + ORDERED_NODE_SNAPSHOT_TYPE = 7, //A result node-set containing snapshots of all the nodes matching the expression. The nodes in the result set are in the same order that they appear in the document. + ANY_UNORDERED_NODE_TYPE = 8, //A result node-set containing any single node that matches the expression. The node is not necessarily the first node in the document that matches the expression. + FIRST_ORDERED_NODE_TYPE = 9; //A result node-set containing the first node in the document that matches the expression. + + var XPathDict = { + 0: "ANY_TYPE", + 1: "NUMBER_TYPE", + 2: "STRING_TYPE", + 3: "BOOLEAN_TYPE", + 4: "UNORDERED_NODE_ITERATOR_TYPE", + 5: "ORDERED_NODE_ITERATOR_TYPE", + 6: "UNORDERED_NODE_SNAPSHOT_TYPE", + 7: "ORDERED_NODE_SNAPSHOT_TYPE", + 8: "ANY_UNORDERED_NODE_TYPE", + 9: "FIRST_ORDERED_NODE_TYPE" + }; + + var ELEMENT_NODE = 1, + ATTRIBUTE_NODE = 2, + TEXT_NODE = 3, + DATA_SECTION_NODE = 4, + ENTITY_REFERENCE_NODE = 5, + ENTITY_NODE = 6, + PROCESSING_INSTRUCTION_NODE = 7, + COMMENT_NODE = 8, + DOCUMENT_NODE = 9, + DOCUMENT_TYPE_NODE = 10, + DOCUMENT_FRAGMENT_NODE = 11, + NOTATION_NODE = 12 + + var ElementDict = { 1: "ELEMENT_NODE", + 2: "ATTRIBUTE_NODE", + 3: "TEXT_NODE", + 4: "DATA_SECTION_NODE", + 5: "ENTITY_REFERENCE_NODE", + 6: "ENTITY_NODE", + 7: "PROCESSING_INSTRUCTION_NODE", + 8: "COMMENT_NODE", + 9: "DOCUMENT_NODE", + 10: "DOCUMENT_TYPE_NODE", + 11: "DOCUMENT_FRAGMENT_NODE", + 12: "NOTATION_NODE" + }; +} (window)); \ No newline at end of file diff --git a/html/js/tree/Move.js b/html/js/tree/Move.js index d7b7d84..fe84bcc 100644 --- a/html/js/tree/Move.js +++ b/html/js/tree/Move.js @@ -11,6 +11,7 @@ GTE.TREE = (function (parentModule) { this.name = name; this.atISet = atISet; this.line = {}; + this.editable = null; } /** @@ -126,7 +127,7 @@ GTE.TREE = (function (parentModule) { var contentEditable = new GTE.UI.Widgets.ContentEditable( middleX, middleY, growingDirectionOfText, this.name, "move") .colour(parent.player.colour); - + this.editable = contentEditable; // ChanceMove inherits from Move so in order not to having to rewrite this // whole function, create a function with all that needs to be modified // by ChanceMove @@ -156,6 +157,15 @@ GTE.TREE = (function (parentModule) { }); }; + /** + * Changes the text of the editable label + * @param {String} text New Move's text + */ + Move.prototype.changeText = function(text) { + this.editable.setText(text); + this.changeName(text); + }; + /** * Get current move position within the set of moves * @return {Number} index This move's index in the array of moves diff --git a/html/js/tree/Player.js b/html/js/tree/Player.js index 9d52843..1c02004 100644 --- a/html/js/tree/Player.js +++ b/html/js/tree/Player.js @@ -8,9 +8,12 @@ GTE.TREE = (function (parentModule) { * @param {Number} id Player's id. * @param {String} colour Player's hex colour. */ - function Player(id, colour) { + function Player(id, colour, name) { this.id = id; - if (this.id === Player.CHANCE) { + if(name != null) { + this.name = name; + } + else if (this.id === Player.CHANCE) { this.name = GTE.PLAYERS.DEFAULT_CHANCE_NAME; } else { this.name = "" + this.id; diff --git a/html/js/tree/Tree.js b/html/js/tree/Tree.js index 4d4ecff..f3b3a68 100644 --- a/html/js/tree/Tree.js +++ b/html/js/tree/Tree.js @@ -569,8 +569,8 @@ GTE.TREE = (function (parentModule) { * @param {Node} parentNode Node that will get a new child * @return {Node} newNode Node that has been added */ - Tree.prototype.addChildNodeTo = function (parentNode) { - var newNode = new GTE.TREE.Node(parentNode); + Tree.prototype.addChildNodeTo = function (parentNode, player, reachedBy, iset) { + var newNode = new GTE.TREE.Node(parentNode, player, reachedBy, iset); this.positionsUpdated = false; return newNode; }; @@ -849,18 +849,19 @@ GTE.TREE = (function (parentModule) { * get this player's colour from the list of colours * @return {Player} player Created player */ - Tree.prototype.newPlayer = function (colour) { + Tree.prototype.newPlayer = function (colour, id, name) { // Player ID is incremental var id; - if (this.players.length >= 1) { - id = this.players[this.players.length-1].id+1; - } else { - id = GTE.TREE.Player.CHANCE; + if(id == null) { + if (this.players.length >= 1) { + id = this.players[this.players.length-1].id+1; + } else { + id = GTE.TREE.Player.CHANCE; + } } - colour = colour || GTE.tools.getColour(this.players.length); // Create the new player - var player = new GTE.TREE.Player(id, colour); + var player = new GTE.TREE.Player(id, colour, name); // Add the player to the list of players and return it return this.addPlayer(player); }; @@ -997,7 +998,7 @@ GTE.TREE = (function (parentModule) { if (node === undefined) { node = this.root; } - if (node.children.length !== 0 && node.player === null) { + if (node.children.length !== 0 && (node.player === null || node.player === undefined)) { return false; } for (var i = 0; i < node.children.length; i++) { diff --git a/html/js/xmlExporter/XmlExporter.js b/html/js/xmlExporter/XmlExporter.js new file mode 100644 index 0000000..66c4356 --- /dev/null +++ b/html/js/xmlExporter/XmlExporter.js @@ -0,0 +1,228 @@ +GTE.TREE = (function (parentModule) { + "use strict"; + + /** + * Creates a new xml Exporter + * @class + */ + function XmlExporter() { + this.tree = ""; + }; + + /** + * Exports the tree to xml format + */ + XmlExporter.prototype.exportTree = function() { + this.exportGTE(); + }; + + /** + * Exports the GTE section of the xml tree + */ + XmlExporter.prototype.exportGTE = function() { + this.startProperty("gte", {version : "0.1"}, 0); + this.exportDisplayProperties(); + this.exportPlayers(); + this.exportExtensiveForm(); + this.endProperty("gte", 0); + }; + + /** + * Function that adds properties in + * xml format. + * @param {property_name} Name of the property to be exported + * @param {parameters} Parameters to be associated with the property + * @param {tab} The amount of tab space to be left in the beginning. + */ + XmlExporter.prototype.startProperty = function(property_name, parameters, tab) { + var append = this.assignTab(tab); + append += "<"+property_name; + for(var parameter in parameters) { + if(parameters[parameter] != undefined) { + append += (" "+parameter); + append += "=\""; + append += parameters[parameter]; + append += "\""; + } + } + append += ">\n"; + this.tree += append; + }; + + /** + * Function that adds an ending tag + * to a particular property + * @param {property_name} Name of the proprety to be exported + * @param {tab} The amount of tab space associated with the closing tag + */ + XmlExporter.prototype.endProperty = function(property_name, tab) { + var append = this.assignTab(tab); + append += "\n"; + this.tree += append; + }; + + /** + * Function that adds material between the + * starting and ending tag + * @param {property_name} The content of the body to be added + * @param {tab} The amount of tab space to be left in the beginning + */ + XmlExporter.prototype.addBody = function(property_name, tab) { + var append = this.assignTab(tab); + append += property_name+"\n"; + this.tree += append; + }; + + /** + * Function that assigns tab space + * to the beginning of a tag + */ + XmlExporter.prototype.assignTab = function(tab) { + var string = ""; + for(var i = 0; i