Announcement

Collapse
No announcement yet.

combat program

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • combat program

    Here is a Java program which calculates overall % of winning, and amount of expected damage. It takes 4 arguments (attackers hp, att fp, def hp, def fp) and generates 2 concise tables across all attacker values 1..5, vet/non-vet and all defender values 1..3/with mods (0-4 +50%, 0-1 +100%, 0-2 +200%).
    It uses the method outlined in http://apolyton.net/forums/showthrea...=&threadid=988

    To use the table you must be able to calculate your effective df and effective af.

    Enjoy
    -freshman

    It can easily be converted into a C or VB program.
    Rename file Combat.txt to Combat.java
    To compile, javac Combat.java
    To run try "java Combat 1 1 1 1"
    Here is a sample when run with "java Combat 1 1 1 1"

    _______at:08_at:12_at:16_at:24_at:32_at:36_at:40_a t:48_at:60
    df=008_0.290 0.869 0.979 0.999 1.000 1.000 1.000 1.000 1.000
    df=012_0.027 0.356 0.798 0.984 0.998 0.999 1.000 1.000 1.000
    df=016_0.003 0.078 0.391 0.906 0.986 0.994 0.997 0.999 1.000
    df=018_0.001 0.037 0.229 0.824 0.970 0.987 0.994 0.999 1.000
    df=024_0.000 0.005 0.043 0.427 0.836 0.917 0.957 0.988 0.998
    df=027_0.000 0.002 0.019 0.255 0.710 0.840 0.913 0.973 0.995
    df=032_0.000 0.000 0.005 0.102 0.445 0.644 0.782 0.922 0.982
    df=036_0.000 0.000 0.002 0.049 0.269 0.451 0.630 0.848 0.961
    df=040_0.000 0.000 0.001 0.024 0.157 0.290 0.456 0.741 0.924
    df=048_0.000 0.000 0.000 0.006 0.053 0.111 0.202 0.463 0.793
    df=054_0.000 0.000 0.000 0.003 0.024 0.054 0.105 0.283 0.644
    df=072_0.000 0.000 0.000 0.000 0.003 0.007 0.016 0.057 0.211
    df=080_0.000 0.000 0.000 0.000 0.001 0.003 0.007 0.028 0.119
    df=081_0.000 0.000 0.000 0.000 0.001 0.003 0.007 0.026 0.111
    df=096_0.000 0.000 0.000 0.000 0.000 0.001 0.002 0.008 0.038
    df=108_0.000 0.000 0.000 0.000 0.000 0.000 0.001 0.003 0.017
    df=120_0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.001 0.008
    df=121_0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.001 0.007
    df=144_0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.002
    df=162_0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.001
    -------Expected damage after win-------------
    _______at:08_at:12_at:16_at:24_at:32_at:36_at:40_a t:48_at:60
    df=008_6.919 5.149 3.763 2.300 1.636 1.428 1.268 1.034 0.811
    df=012_7.584 6.785 5.543 3.598 2.535 2.198 1.938 1.566 1.215
    df=016_7.794 7.392 6.713 4.865 3.515 3.047 2.678 2.147 1.650
    df=018_7.852 7.536 7.041 5.416 4.009 3.488 3.069 2.456 1.879
    df=024_7.955 7.767 7.512 6.638 5.351 4.767 4.251 3.432 2.614
    df=027_7.986 7.831 7.628 6.988 5.894 5.329 4.806 3.928 3.003
    df=032_8.022 7.902 7.754 7.326 6.599 6.105 5.616 4.717 3.664
    df=036_8.042 7.941 7.820 7.486 6.961 6.585 6.145 5.285 4.187
    df=040_8.058 7.971 7.868 7.597 7.195 6.919 6.575 5.782 4.687
    df=048_8.081 8.013 7.934 7.740 7.473 7.303 7.098 6.559 5.567
    df=054_8.093 8.035 7.968 7.808 7.599 7.469 7.318 6.933 6.105
    df=072_8.117 8.076 8.031 7.927 7.803 7.730 7.650 7.460 7.080
    df=080_8.124 8.087 8.048 7.959 7.854 7.794 7.728 7.577 7.284
    df=081_8.125 8.089 8.050 7.963 7.859 7.801 7.737 7.589 7.304
    df=096_8.134 8.105 8.073 8.004 7.924 7.880 7.832 7.725 7.530
    df=108_8.140 8.114 8.086 8.027 7.960 7.923 7.883 7.797 7.643
    df=120_8.144 8.121 8.097 8.045 7.987 7.955 7.922 7.849 7.723
    df=121_8.144 8.122 8.098 8.046 7.989 7.957 7.925 7.853 7.728
    df=144_8.151 8.132 8.112 8.070 8.025 8.000 7.975 7.920 7.828
    df=162_8.154 8.138 8.120 8.084 8.045 8.024 8.003 7.957 7.880


    Here's the tables when "java Combat 1 1 2 1" is run (Units vs. Settlers for instance)
    _______at:08_at:12_at:16_at:24_at:32_at:36_at:40_a t:48_at:60
    df=008_0.005 0.304 0.717 0.967 0.995 0.998 0.999 1.000 1.000
    df=012_0.000 0.010 0.195 0.759 0.946 0.974 0.987 0.996 0.999
    df=016_0.000 0.000 0.014 0.389 0.779 0.875 0.930 0.977 0.995
    df=018_0.000 0.000 0.003 0.228 0.650 0.786 0.871 0.954 0.989
    df=024_0.000 0.000 0.000 0.018 0.246 0.420 0.579 0.798 0.937
    df=027_0.000 0.000 0.000 0.004 0.115 0.252 0.408 0.673 0.883
    df=032_0.000 0.000 0.000 0.000 0.021 0.077 0.177 0.435 0.743
    df=036_0.000 0.000 0.000 0.000 0.004 0.022 0.071 0.264 0.598
    df=040_0.000 0.000 0.000 0.000 0.001 0.005 0.022 0.139 0.445
    df=048_0.000 0.000 0.000 0.000 0.000 0.000 0.002 0.024 0.189
    df=054_0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.005 0.077
    df=072_0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.002
    df=080_0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
    -------Expected damage after win-------------
    _______at:08_at:12_at:16_at:24_at:32_at:36_at:40_a t:48_at:60
    df=008_8.042 7.197 6.197 4.400 3.239 2.842 2.528 2.067 1.621
    df=012_8.316 7.985 7.411 6.042 4.759 4.235 3.791 3.106 2.425
    df=016_8.404 8.237 7.955 7.026 5.960 5.443 4.965 4.151 3.265
    df=018_8.428 8.296 8.092 7.345 6.411 5.932 5.470 4.642 3.687
    df=024_8.472 8.392 8.286 7.923 7.309 6.964 6.604 5.875 4.874
    df=027_8.485 8.419 8.334 8.070 7.587 7.297 6.989 6.343 5.390
    df=032_8.501 8.449 8.387 8.210 7.906 7.687 7.449 6.932 6.105
    df=036_8.510 8.466 8.414 8.276 8.059 7.900 7.705 7.273 6.555
    df=040_8.517 8.479 8.435 8.322 8.156 8.042 7.896 7.532 6.912
    df=048_8.527 8.497 8.463 8.381 8.270 8.200 8.116 7.889 7.424
    df=054_8.532 8.506 8.478 8.410 8.322 8.269 8.206 8.047 7.687
    df=072_8.543 8.524 8.505 8.460 8.407 8.377 8.343 8.265 8.108
    df=080_8.546 8.530 8.512 8.474 8.429 8.404 8.376 8.313 8.192
    -freshman

  • #2
    Didn't attach the program?
    Here it is
    Attached Files
    -freshman

    Comment


    • #3
      Good work.Should be useful for scenario makers.

      umm....I think kobayashi allready made one of these..but thank you anyways.
      The only thing that matters to me in a MP game is getting a good ally.Nothing else is as important.......Xin Yu

      Comment


      • #4
        Concise table

        Hey - I just modified my program to spit out a REALLY useful table. Sure, its nice to know what probability of success you have with 1 guy. Its nice to know how much damage you'll do if you loose the one guy. Its nice to know how much damage you'll sustain even if you win.

        But what is REALLY nice to know is how many units you'll need to win, (fractional units indicate how much the last one is damaged) and what is the standard deviation; this summarizes all the above info + more in just one concise table.

        So if there is interest, I'll post my new program - otherwise not.

        Here is the table generated for 1/1 vs 1/1 hit-point/firepower units:
        _______attf:08_attf:12_attf:16_attf:24_attf:32_att f:36_attf:40_attf:48_attf:60
        df=008_1.3+0.5 0.6+0.3 0.4+0.2 0.2+0.2 0.2+0.1 0.1+0.1 0.1+0.1 0.1+0.1 0.1+0.1
        df=012_2.4+0.9 1.2+0.5 0.7+0.3 0.4+0.2 0.3+0.2 0.2+0.2 0.2+0.2 0.2+0.1 0.1+0.1
        df=016_3.6+1.3 1.9+0.7 1.1+0.5 0.5+0.3 0.4+0.2 0.3+0.2 0.3+0.2 0.2+0.2 0.2+0.1
        df=018_4.1+1.5 2.3+0.9 1.4+0.6 0.7+0.3 0.4+0.2 0.4+0.2 0.3+0.2 0.2+0.2 0.2+0.1
        df=024_5.8+2.0 3.4+1.2 2.2+0.8 1.1+0.5 0.6+0.3 0.5+0.3 0.5+0.3 0.4+0.2 0.3+0.2
        df=027_6.7+2.3 3.9+1.4 2.6+1.0 1.3+0.6 0.8+0.4 0.6+0.3 0.5+0.3 0.4+0.2 0.3+0.2
        df=032_8.1+2.7 4.8+1.7 3.3+1.2 1.8+0.7 1.1+0.5 0.8+0.4 0.7+0.3 0.5+0.3 0.4+0.2
        df=036_------- 5.5+1.9 3.8+1.3 2.1+0.8 1.3+0.6 1.1+0.5 0.9+0.4 0.6+0.3 0.4+0.3
        df=040_------- 6.3+2.1 4.3+1.5 2.5+0.9 1.6+0.6 1.3+0.5 1.0+0.5 0.7+0.4 0.5+0.3
        df=048_------- 7.7+2.6 5.4+1.8 3.2+1.1 2.1+0.8 1.7+0.7 1.5+0.6 1.0+0.5 0.7+0.3
        df=054_------- ------- 6.2+2.1 3.7+1.3 2.5+0.9 2.1+0.8 1.8+0.7 1.3+0.5 0.8+0.4
        df=072_------- ------- ------- 5.3+1.8 3.6+1.3 3.1+1.1 2.7+1.0 2.1+0.8 1.4+0.6
        df=080_------- ------- ------- 6.0+2.0 4.2+1.5 3.6+1.3 3.1+1.1 2.4+0.9 1.7+0.7
        df=081_------- ------- ------- 6.0+2.1 4.2+1.5 3.6+1.3 3.2+1.1 2.4+0.9 1.7+0.7
        df=096_------- ------- ------- 7.3+2.5 5.2+1.8 4.5+1.6 3.9+1.4 3.1+1.1 2.3+0.9
        df=108_------- ------- ------- 8.4+2.8 6.0+2.0 5.2+1.8 4.5+1.6 3.6+1.3 2.7+1.0
        df=120_------- ------- ------- ------- 6.7+2.3 5.8+2.0 5.1+1.8 4.1+1.4 3.1+1.1
        df=121_------- ------- ------- ------- 6.8+2.3 5.9+2.0 5.2+1.8 4.1+1.5 3.1+1.1
        df=144_------- ------- ------- ------- 8.3+2.8 7.2+2.4 6.4+2.2 5.1+1.8 3.9+1.4
        df=162_------- ------- ------- ------- ------- 8.2+2.7 7.3+2.4 5.9+2.0 4.5+1.6

        The first number indicates the AVERAGE number of attackers you'll need to win, the second number indicates the STANDARD DEVIATION (Error due to randomness) in the AVERAGE.
        So, if you know your normal distribution tables, +/- 1 standard deviation happens 68% of the time, +- 2 standard deviations happens 95% of the time, +-3 standard deviations 99% of the time.

        For example, an attacker non-vet-crusader (40) vs. a defending vet. phalanx on a river (36),
        you'll need between .9-.4 to .9+.4 attackers 68% of the time (ie 34% of the time, 1 crusader will suffice and be damaged 50 to 90 %, and 34% of the other time, 1 crusader will die, the other will be damaged 0 to 30%)
        If the attacker is a vet-crusader, though (60), he will 95% of the time lie in the 0 to 1.0 range of damage (so 1 will nearly always suffice: .4 +- 2*.3).
        -freshman

        Comment

        Working...
        X