The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => General UQM Discussion => Topic started by: Squisherxxx on February 28, 2007, 05:29:27 pm

Title: Orz Marine Code
Post by: Squisherxxx on February 28, 2007, 05:29:27 pm
Okay so I wanted to know exactly how the marines work, and figure out how valuable they are.

So I decided to look at the code, and from what I can determine, it works like this:

For each iteration, a random value from 0 - 255 is generated. 
If this number is less than 16, the marine dies.
If it is between 16 and 143 inclusive, the ship loses one crew.

This would mean that each marine deals an average of 8 damage.

Can someone substantiate or refute this?

Title: Re: Orz Marine Code
Post by: Valaggar on February 28, 2007, 07:04:34 pm
You are right. This has been also said by meep-eep:
It is also absolutely false.  ;)  The way the "marine code" works is (basically) that at various points in the game, it picks a random number between 0 and 4294967295, inclusive.  If that number happens to be of a value below 144, the marine kills one member of the crew, and if it is below 16, the marine dies.
Not quite. The random value is cast to a BYTE, thereby only taking the lowest 8 bits, giving a value between 0 and 255 (inclusive).
So each time the chance is 1/2 for an intruder to kill an enemy, 1/16 to die, and 7/16 to do nothing.

So 8 times out of 9 the marine kills a crew member, and 1 time out of 9 it is killed. So a marine, on average, kills 8 crewmen before dying. Just as you said.

Title: Re: Orz Marine Code
Post by: Kazagistar on March 01, 2007, 12:59:32 am
I can substantiate this with real math (ignore if you are allergic :P)
A(n) = chance of a marine being alive at turn n = ((15/16) ^ n)
K = chance of a marine killing a marine killing a enemy = (1/2)
Enemies killed = SUM as n goes 1 -> infinity of (1/2) * (15/16) ^ n
= (1/2) * (SUM as n goes 1 -> infinity of  (15/16) ^ n)
= (1/2) * (1 / (1 - (15/16) ) )
= (1/2) * (16)
= 8
For once, the guestimate got it right! Usualy, the estimate people make about this sort of thing is way off.

Title: Re: Orz Marine Code
Post by: Zeep-Eeep on March 02, 2007, 09:53:59 pm
Those little guys are tough. I love launching clouds of them at
slower ships.