Show-case of a simple numerical task in Julia 1.0.
Biting: Rabbits bite at DX or combat skill minus any hit location penalties. A Rabbit's bite does damage equal to Basic Swing-2. This damage is Cutting when the opponent is smaller than or equal. R/gurps: The Generic Universal RolePlaying System, or GURPS, is a tabletop role-playing game system designed to allow for play in any game setting Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts.
Problem: Find optimal values of Strength, Dexterity and Health for a duel in GURPS RPG system given point value for each character statistic and penalty/reward for % of duels won.
Solution: Monte-Carlo simulation where Strength, Dexterity and Health are assigned at random (with randomness determined by a parameter) and given number of duels is conducted to calculate % of duels won.
What does the script do?
First have a look at output of
duelExample.jl
it will give you a taste of how one duel actually looks like:Then run the simulation itself and see how it finds the best distribution of stats for the gun fight:Run
You will need Julia 1.0. Refer to Julia Webpage for the binaries or use your package manager of choice. There are no dependancies.It will conduct a simulated gun fight according to simplified GURPS 4ed rules 1000 times for each iteration and each iteration it will randomly change the stats of the first of dueling characters. It will accept the change only if it yielded better results (measured by % of wins and the total cost of the character's stats). The sim is ruled by the following params, which you can tweak by editing the
main.jl
script.GURPS Rules Needed For This Simulation
GURPS 4ed rules used for this simulation:
- Character has 4 basic stats:
Intelligence
,Dexterity
,Health
,Strength
. In this sim we use onlyDex
,Health
andStrength
, Intelligence plays no role in gun combat - Character can also have skills, in GURPS there is much more rules for it but for this simulation we need only
Pistols
. Value of the skill added to the value of its base stat (Dexterity
in this case) is the threshold for the test. - The test that determines if you managed to hit a target is a sum of rolling 3 D6 dice. If you roll at or below the threshold (see previous point) you passed the test.
- But not so fast! If you shoot at someone, in GURPS they can dodge. Dodge is also determined a 3x D6 test but is based on the following formula:
Gurps How To Figure Bite Dmg Download
- Who goes first in the duel? The one with higher
basicSpeed
. See the snippet above for how it is calculated from the base stats. - What happens when your opponent shot at you, passed the test and you failed to dodge? You receive damage! To determine how much, you roll number of D6 dice specific to your weapon.
- Your number of starting
Hit Points
(and also maxHit Points
you can have) equals yourStrength
. - When you get to at or below
1/3
of your baseHit Points
your character gets a special state:reeling
. When you are reeling yourdodge
is halved. - When you get below 0
Hit Points
you need to start rolling a tests against yourHealth
if you can still fight. Again this is a sum of 3x D6 and needs to be at or below yourHealth
. Once failed you areDisabled
and the duel is over.