Stupid or unlucky?

Discuss anything related to warbarons.

Re: Stupid or unlucky?

Postby KGB » Thu Sep 09, 2010 1:11 pm

Piranha,

piranha wrote:If I start counting from the 0 side of the array I will end up with strange results. On the first array I will remove [2]->99 and then nothing else.
If I sort the array by the thing that is most rare I would remove 4, 5 and 6 units left but keep the rest which is probably the correct thing to do?

What I mean here is that in some situations the most common result is 1 unit left and then counting down towards 8 units, but in other situations it will be the reverse. Thats why I sorted them in the order so that I always remove the result that is most rare.

After some testing it seems to me that sorting the array and removing the lowest numbers must be the correct way to do it?


No. Don't ever sort and them remove. If you do that you could get an case like in the example I posted where a player put the dragon first following by 4 bats.

Dragon Stack Distribution: 699 576 495 364 1173 0 0 0

In that case you'd remove the 364,495 and end up saying you could get 5 units, 2 units or 1 unit left but never 3 or 4. That makes no logical sense to have gaps. This kind of occurrence will also happen if you had a stack that was something like Archon (7), Bat (1), Gryffon (6). The chance you win on the bat is quite small due to the bats strength being so low. But to say you can never win there and only on the Archon or Gryffon doesn't make much sense.

You literally start with the largest number of units left (the 8 case on both edges) and work down towards the 1 case (you never start at the 1 case and move toward the 8 case) stopping when you reach 10%. Remember we are removing the extremes at the edges, not uncommon results in the middle.

Arrange the numbers like this:

0 0 2 13 26 66 99 142 | 166 154 134 107 67 19 5 0

Because this is how they truly go. In other words the next results from 1 unit left on stack A is 1 unit left on stack B.

KGB
KGB
 
Posts: 3028
Joined: Tue Feb 16, 2010 12:06 am

Re: Stupid or unlucky?

Postby Zajoman » Thu Sep 09, 2010 6:10 pm

I don't see any problem with the results you got when changing the fight order in the stacks.
Zajoman
 
Posts: 107
Joined: Thu Aug 12, 2010 6:56 pm

Re: Stupid or unlucky?

Postby piranha » Thu Sep 09, 2010 6:49 pm

I've changed it to not sort anything but the result is not very good.

Array
(
[0] => 0
[1] => 184
[2] => 154
[3] => 117
[4] => 49
[5] => 10
[6] => 0
[7] => 0
[8] => 0

[0] => 0
[1] => 182
[2] => 166
[3] => 88
[4] => 42
[5] => 8
[6] => 0
[7] => 0
[8] => 0
)

On both arrays I start at 1 and go to 8. On the second array I will remove [3] but keep [4] which makes a gap. If I would start from 8 and go to 1 the same thing will happen sometimes. This can't be a good result either?
User avatar
piranha
Site Admin
 
Posts: 1186
Joined: Fri Feb 12, 2010 9:44 pm

Re: Stupid or unlucky?

Postby piranha » Thu Sep 09, 2010 7:33 pm

I don't know if there is any way to not get gaps. I'll wait to see if you have any ideas.
User avatar
piranha
Site Admin
 
Posts: 1186
Joined: Fri Feb 12, 2010 9:44 pm

Re: Stupid or unlucky?

Postby KGB » Thu Sep 09, 2010 8:47 pm

Piranha,

I meant you start with the most number of units left alive. So that's really position 8 (8 men left). Then work back toward 1 man left and stop at the highest number under 100.

So in array 1 you remove 10, 49. In array 2 you remove 8, 42. That leaves side 1 winning with 1-3 men or side 2 winning with 1-3 men. There are no gaps there and doing it this way will never leave gaps.

KGB
KGB
 
Posts: 3028
Joined: Tue Feb 16, 2010 12:06 am

Re: Stupid or unlucky?

Postby piranha » Fri Sep 10, 2010 7:16 am

But the survival array can go in both directions. Take a look at this for example.

Array
(
[0] => 0
[1] => 1
[2] => 0
[3] => 0
[4] => 0
[5] => 0
[6] => 0
[7] => 0
[8] => 0
)
Array
(
[0] => 0
[1] => 0
[2] => 1
[3] => 7
[4] => 16
[5] => 115
[6] => 393
[7] => 467
[8] => 0
)

This is 2 orc,1 elf vs 7 Griffon.

As you see, if I always start from the most number of units alive I will create gaps when a army is way more powerful and should be allowed to lose just a few units.
[5] => 115 could have been 100
In that case 7 units, 6 units, 4 units, 3 units, 2 units would be okay but not 5 units. In this case I would be required to go from 1->8 units left instead to remove the extreme results which is when the much more powerful army lose more than it should.

I guess I could always start from the side there the survuving numbers are few and then go till I reach 100, but then I'd have to stop if the first number is bigger than 100 or the same problem with the bat in the middle would still happen.

What do you think?
User avatar
piranha
Site Admin
 
Posts: 1186
Joined: Fri Feb 12, 2010 9:44 pm

Re: Stupid or unlucky?

Postby piranha » Fri Sep 10, 2010 12:00 pm

Hm I went on to test some bigger attacks vs armies in cities and realize that I need to cut from both sides.



[1] => 1
[2] => 3
[3] => 9
[4] => 30
[5] => 49
[6] => 76
[7] => 134
[8] => 172
[9] => 194
[10] => 193
[11] => 79
[12] => 57
[13] => 3


In a situation like that its too good for the attacker to kill so there is 1-5 units left, but its to crappy if the defender lives with 12 or 13 units left.
This must be the way to do it. Start cutting on both sides. This is almoast what I did after my sorting. Only problem was leaving gaps.

I spent so freakin much time on this now. I will make the cutting on both sides now but then I have to move on to complete other parts.
User avatar
piranha
Site Admin
 
Posts: 1186
Joined: Fri Feb 12, 2010 9:44 pm

Re: Stupid or unlucky?

Postby piranha » Fri Sep 10, 2010 12:08 pm

Argh I've got it all wrong :(. Didnt understand what you meant with how you alligned the arrays
User avatar
piranha
Site Admin
 
Posts: 1186
Joined: Fri Feb 12, 2010 9:44 pm

Re: Stupid or unlucky?

Postby piranha » Fri Sep 10, 2010 1:21 pm

Finally I got it working. Just need to test a bit more but seems correct now.
User avatar
piranha
Site Admin
 
Posts: 1186
Joined: Fri Feb 12, 2010 9:44 pm

Re: Stupid or unlucky?

Postby KGB » Fri Sep 10, 2010 1:28 pm

Piranha,

Excellent news!

Sorry to hear you spent so much time on it. But in the long run it was worth it because it only has to be done one time. Had i known it was going to take so much time I would have spent more time with my test program and then just handed over the final results.

In the future for things like this the community providing simple programs/code you can incorporate is probably the way to go.

KGB
KGB
 
Posts: 3028
Joined: Tue Feb 16, 2010 12:06 am

PreviousNext

Return to Game discussion

Who is online

Users browsing this forum: No registered users and 6 guests

Not able to open ./cache/data_global.php