Work related posts have been moved.

9 November, 2010

My work and computing related posts are now at

If you have come here from a work-related perspective (computing, semweb, bioinformatics, math). Perhaps you could go there right now and not read the gory personal stuff here.

Use the wordpress rss mechanism to follow categories:

Follow Paul Murray on Quora


Spartacus

6 July, 2015

Ok. I have four numbers. We are discussing this from the POV of the defender because the question we are asking is “if I take 2 hits, which die should I take them off”?

chanceOfThisToInv is the probability that in the current situation, the attacker will score zero hits on me.

chanceOfInvToThis is the probability that in the reverse of this situation (I scored no hits so now it’s the attacker’s go) I will score zero hits in return on my attacker.

chanceOfThisToWinGivenNotLoop is the probability that *if* I do not score no hits, then I will go on to win. To calculate it, we work out for each possible number of hits what our best move is, and then for that move take the inverse of the possibility of winning (because that’s the situation our attcker will then be in), and multiply it by the probability of scoring that number of hits.

We then divide the total by the total chance of not scoring no hits.

chanceOfInvToLoseGivenNotLoop is calculated correspondingly.

Now, what’s my win probability?

To figure that out, I will have to sumultaneously figure out winProb and invLoseProb, I think, because they depend on one another.

First, let’s shrink the size of those variable names

ti = this to inv
it = inv to this
rw = raw win pobability, ignoring the loop
ril = raw invers lose probability, ignoring the loop.

wp = win probaibility
ilp = inverse lose probability

wp = (1-ti) rw + ti ilp
ilp = (1-it) ril + it wp

Ahh crapsicks. I hate these. Actually, no I dont, it’s just been a while since I did one.

wp = (1-ti) rw + ti [ (1-it) ril + it wp ] 
wp = (1-ti) rw + ti (1-it) ril + ti it wp
wp -  ti it wp = (1-ti) rw + ti (1-it) ril
wp  = [ (1-ti) rw + ti (1-it) ril ] / (1 - ti it)

ilp = (1-it) ril + it [ (1-ti) rw + ti ilp ]
ilp = (1-it) ril + it (1-ti) rw + it ti ilp 
ilp - it ti ilp  = (1-it) ril + it (1-ti) rw
ilp = [ (1-it) ril + it (1-ti) rw ] / ( 1 - it ti) 

So.

wp  = [ (1-ti) rw + ti (1-it) ril ] / (1 - ti it)
ilp = [ (1-it) ril + it (1-ti) rw ] / ( 1 - it ti) 

Hmm, some common terms there. Rearranging:

wp  = [ ti (1-it) ril +    (1-ti) rw ] / (1 - it ti)
ilp = [    (1-it) ril + it (1-ti) rw ] / ( 1 - it ti) 

Damn! Look at all those multiplications of ril by (1-it)! Recall that we divided by 1-it to get to where we are. Maybe we can just use what we already have? I’ll call them ‘simple win’ and ‘simple inverse lose’

wp  = [ ti sil +    sw ] /  (1 - it ti)
ilp = [    sil + it sw ] / ( 1 - it ti) 

Weird! Can it really be that simple?

On a 1, I lose; on a 2-3, I win; on a 4-0 I pass the dice to you. .1, .2, .7
On a 1-5, you lose. On a 6, you win. On a 7-0, you pass the dice to me. .5, .1, .4

wp  = [ .7 .5 +    .2 ] /  (1 - .28) = .55 / .72 = .763
ilp = [    .5 + .4 .2 ] / ( 1 - .28) = .58 / .72 = .806

The numbers are different because they are in the form of expressing my chance of winning given who is currently holding the dice.

Now, let’s describe the game from the inverse POV.

On a 1-5, I lose. On a 6, I win. On a 7-0, I pass the dice to yoy. .5, .1, .4
On a 1, You lose; on a 2-3, You win; on a 4-0 you pass the dice to me. .1, .2, .7

wp  = [ .4 .1 +    .1 ] /  (1 - .28) = .14 / .72 = 
ilp = [    .1 + .7 .1 ] / ( 1 - .28) = .17 / .72 =

And you can see that .14+.58 is .72 and .17+.55 is also .72.

I feel good. That’s how I’ll calculate it.


Spartacus

5 July, 2015

Ok! I have calculated the base probabilities. Code is here if you dare:

https://github.com/PaulMurrayCbr/Spartacus.git

Next problem is working out how to navigate the tree of possible situations.

A battle situation is a defender attack/defense and a attacker attack/defense. There are 1296 possible situations, which is a pretty manageable number.

Each situation has a probablility of being a *loss* for the defender. The probability is equal to the probability of the loss given each number of possible hits, multiplied by the probability of getting that many hits.

If the number of hits is zero, you havben’t lost. Probability zero (whew!).

If the number of hits is more than your total amount of dice minus two (because you need to retain at least one attack and on defense die), then the loss probability should you get that many hits is 1. You have lost.

If not, then run through each way that you can distribute the hits, and then reverse the attacker/defender situation. Pick the highest loss probability of these sitiations. That’s the move you should make, and your loss probability for that many hits is the 1-p of the reversed situtation.

Now, this sounds staggeringly recursive, but it isn’t because as you calculate these situation probabilities you cache them. So meh. So how do we work out in what order to calculate these situations, such that for every situation we know that the reverse situation has already been done?

Well, one way is to order the situations by total number of dice.

The other way is to write it recursively, use caching as a recursion short-cut, ant let the algorithm do it in whatever sequence it prefers. That’s the easy way and that’s the way I’ll do it.

The remaining problem is: how to exhibit the results? Well, hopefully there will be a general rule eg: “if you have more dice than your opponent, take it off defense, else take it off attack”. Discovering that general rule is the point of the exercise.


Wrong, wrong, wrong.

If the number of hits is zero, then the probability of loss is the 1-p probability of loss for the reverse situation. The problem is that there’s a probability that the reverse situation will also have zero hits, and this creates an infinite recursion if we do it recursively.

Of course, we are crating a Markov Chain. Or network. I’ll have to look into it a trifle more closely.


SPARTACUS!

5 July, 2015

Ok. Here’s the way combat in Spartacus works.

You have from 1 to six speed, attack, and defence die (d6es).

The attacker rolls their attack die and arranges them in order.
The defender rolls their defence die and arranges them in order.

Line them up against each other, one to one, starting with the highest.

If the attack die beats its corresponding defence die, then that’s an hit.
If the defender has fewer defence die than the attacker has attack die, then the tail end is “undefended”, and the defence roll is treated as if it were a 2 (attacker needs 3 or better).

Each hit means you must sacrifice one of your dice. You must retain at least one attack, defence, and speed die. If you are dropped to 2 (or fewer) total dice, then you lose.

What’s your strategy?

Better stated, if you have Aa attack, Ad defence and As speed dice, and your opponent has Ba, Bd and Bs dice, and you have just taken N hits, which dice should you remove? I think it’s safe to say that removing from speed is always best, so the problem reduces down to As and Bs both == 1. That’s 216 cases assuming a maximum of 6 dice.

Why don’t we multiply it by a possible 6 hits? Because I assume that taking more than 1 hit reduces down to taking only one hit at a time, although I could be wrong about this – there may be local maxima. But I doubt it.

So we have two problems. Given Ba and Ad, what is the distribution of how many hits you are likely to take?

Given that distribution, what move gives you the best likelihood that you will win?

I don’t know. But Sunday is laundry day so I intend to find out.


Brus Reckoner – if it ain’t broke …

4 July, 2015

I’ll do this one OOC, I think, ’cause I’m feeling lazy. Full house again – everyone is back, which is good news.

So, we are in a city that has been conquered by some dudes working for Zon Kuthon. By which I mean, an army. We have kinda decided that rather than immdiately assaulting the scary fortress of evil, we should do some of the other encounters. The rationale is that ZK is getting mana off the bad stuff going down, so we should stop it. It’s very similar to the plot mechanism in the final Age of Worms module – take care of enough of the bad things in the city, and it knocks Kyuss from being a rank 1 god to being a mere demigod.

Three encounters, which makes it a big game night. First, we got a wandering patrol outside the rather nasty undead factory (DM’s: a great way to run a game is just to kick off with a smallish encounter more or less as soon as people sit down. Puts people in game mode.). Multi-legged dog things and some orc mooks. When I say mooks, I mean 100-odd hp mooks, but mooks. We discovered a sweet-ass combo: a Hold Monster from Will and a coup-de-gras from Brus. The naginata is a *4 weapon, so the coup-de-gras means a minimum DC 106 Fort save or die. There’s really not a lot of things that can make that. Maybe we wasted a 4th level spell on someone who was not actually a cleric (thought he had a holy symbol: “Gakk the cleric!”), but we wasted it on making sure that the magic whistle of bringing the entire city down on us like a ton of bricks was not blown, so probably woth it.

We noticed some sort of hamster-wheel-of-pain arrangement over yonder. Barbed wire and spikes, ordinary folks being forced to drive it. Rather nasty and very Zon Kuthon. We decided that the correct approach was to send in someone invisible with decent Stealth and Disable Device. A chance for the rogue to do his thing, which was really great because the player has had to miss a few games. The wheel went rolling off down the hill – unpleasant for the people in it, and people who got in the way. Some collateral civilian fatalities, I’m afraid. But at least the whole “evil green glowing magic stuff” aspect of it has been nullified.

Then we decided to look into the desecrated church. It was – well – pretty thoroughly desecrated. Flayed people hanging from the ceiling beams, corpses propped up in the pews, eeeevil symbols drawn everywhere. We found some clues that had been left carelessly lying about and then fight. Rats and rat swarms, couple of orcs, and chick with crossbow doing sneak attack and serious negative energy damage. She got the drop on us, which was bad.

It transpired she was a vampire using a weapon that lets you do a supernatural effect through it. So she was able to vampire level-drain at range with meatshields. Really bad. And worse, our cleric is phobic about rats.

Neverthless, two really good things happened. First, she rolled a 1 on her save vs Blindness. This pretty much hosed the encounter for the DM. Second, Will had a bunch of low-level creatures to use Rainbow Pattern on (Rats have an Int score, so rat swarms are subject to mind-affecting. Furthermore, they are not immune to weapon damage. They are still a pretty serious problem for this group, however.). This fascinated five or six of them. From there, Brus mopped up some mooks on the floor, and the more acrobatic took to the rafters to kill them some blinded vampire lady. Will moved the Rainbow Pattern outside so that the rats would follow and allow John to come in and start channelling, but John had started his Wind Walk dematerialisation (he really dislikes rats) and was out of the fight. Doesn’t matter – he did the main thing. Picklick tried sneak-attacking with a vial of alchemists fire, but missed. 10′ range increment, meh. Brus rolled some 1s, but mostly had a great old time on the ground, Bottom also cleaning up his share of mooks. Faugh got his pummelling strike in, but mainly had to chase flying blind vampire lady around the rafters. He has a natural climb speed, apparently.

Playing a bard can be a little frustrating at times – you do your bard song (which, btw, is invaluable: +3 to hit makes all the difference) and sometimes it feels like that’s it. But this session we saw what could be done with the bard’s spells. Particularly given that we don’t have an AoE blaster, taking half the combatants out of the fight made a big difference. Some cheese that gives Will a Fireball equivalent might be worthwhile (is there a Greater Sound Burst?).

Anyway. We got some clues – apparently ZK and Limen have some sort of “deal” going. The main issue at the moment is resource management. Some of the undead are light-sensitive, which means this town will become way unfriendly as soon as it gets dark. My character is using a vicious weapon and just chews through HP like crazy – we only have just so much heals.

We saw a side door on the cathederal of badness. We will un-desecrate the church by burning it down (quickest way to go about it, really), and then I’m not sure that there’s anything else needs doing before heading off for the main event. We are down on resources, but not seriously depleted yet AFAIK.


On Gay marriage and the SCOTUS

29 June, 2015

This is a post I made on AVfM on the recent gay marriage decision in the USA, in reply to “keep your dirty government fingers out of my marriage!” fools. I think it sums up my opinions.


Family members have legal status. Should we do away with the notion that – in the eyes of the law – one’s brothers, sisters, parents and children have a status that strangers do not? That they should not be able to see us when we are in hospital on our deatbeds? That if we die intestate, there should be no presumption that our estate descends to them? Should the day come – God forbid – that someone must decide whether or not to turn the respirator off, should this decision not be in the hands of someone we love, and who we believe loves us? Doing this makes the government, or our employers, or the hospital, the only “family” we have. It’s the opposite of what most libertarians and suchlike would want.

Family means something, and it should mean something in law.

Marriage is a declaration to the world at large, and therefore yes – to the state: “We two are family now. This other person is closer to me than my brothers and sisters, and is first in line in my life.” By its very nature, it is not a private act. That’s why it is done in front of witnesses. Its public-ness is the entire point of it, it’s the difference between a marriage, specifically, and just sleeping with someone you like.

Gay people, pleading equal protection (rightly in the eyes of the SCOTUS) have won the right for their partnerships to be legally recognised in this way. It’s not “tyranny” or anything like it: if anything, it’s the reverse – someone who can rightfully stand between oneself and the uncaring mechanisms of state and medical industry when we are incapacitated. It’s an issue particularly poignant for people who, so often, are rejected by their own natural families. The state now recognises that, for gay people, the person they love and care about more than any other person in the world has some sort of legal status in their life.


Brus Reckoner – The Beginning of the End

22 June, 2015

At last Coin tells us how his machine works, how it will bring an end to this entire plane of doors. The dimensional anchor will be attached to a spool of unbreakable cable. We will take that anchor all the way to Limen’s sanctum and ground it there. Then, Coin’s machine will haul it back into the tesseract. Simpler said than done, of course – the forces involved are immense. But that, in essence, is how his machine works.

But we still need a MacGuffin or two. A certain clutch of Soul Gems. And for that, we need some help. A paladin named Quicksilver.

According to the angels, Quicksilver is dead. But the angels were misled by Li-men. Instead, he seems to be on one of the planes. A hop, skip, and a jump and we are there.

We arrive at a hillock overlooking what seems to be a conquered city. Brus uses his new spell – Find Quarry. Quicksilver is in that evil-looking tower over there on the other side of the city (of course). His “mode of movement”, according to the spell, is hanging by his ankles and swinging gently.

Find Quarry – You sense whether a well-known creature you can clearly visualize is within a 20-mile radius of your current location, as well as the distance and direction to the creature in relation to you. You also discern whether the creature is moving, and its direction, speed, and mode of movement. The radius you can sense increases by 5 miles for every two caster levels you have above 10th (to a maximum of a 45-mile radius at 20th level).

And this evil-looking tower is not just any old evil-looking tower. A quick flick through the K (religion) recognises it as being dedicated to Zon-Kuthon. Quicksilver, one can guess, is having an unpleasant time of it.

How to get across the city? Around? Through? Under, via that conveniently-placed sewer outlet? Well, we are packing Wind Walk now. We are informed, however, that approaching the tower under cover of that spell is infeasible due to divine interference – a strong Deus ex Machina field surrounds it, and we will need to do at least some of the encounters our DM has lovingly prepared.

Smoke rises from a small cluster of buildings. We elect to alight there and take a squiz.


We head into one of the small, squat buildings with thick clouds of smoke coming from the chimney. The odour of rotting death and charred flesh is all but overpowering. Inside, three chained up somethings – humanoid shaped, at least, probably undead – are positioned to be overlooking a room full of charred skeletons. Brus attempts an intimidate: “surrender, or get killed!”. Yeah, it’s basic: but that’s what intimidate boils down to, anyway.

The – things – declare that they have seen things worse then death, and begin making gaze attacks. It’s on. Brus hits one, Faugh hits one, Picklick is outside, and John is just hanging back. Bottom comes in and commences trying to untie one. Brus goes “hmm, ok” and teams up with Faugh. Good tactics. Will calls out “We are supposed to be helping them!”, Brus replies, “We are!”.

More gaze attacks. The front door swings open a little, and the creatures shrink back from the light. Hmm – interesting. One goes down, then another – not before one of its gaze attacks finally hits home. In one of those bursts of unfairness of which the universe is so fond, Will is the victim. He feels a chill, a sapping of his life force. (One negative level to Will.)

Bottom frees the last one of its chains, and attempts to drag it away. It fights and resists with all its might. Brus, deciding that it would be educational to see what happens to these things in full sunlight, joins in, and he and Bottom drag it into the street outside. It’s screams grow louder and louder, more and more desprate until – bodily dragged into the full light of day – its flesh begins to smoke and fall apart, and it disintegrates into dust.


A few minutes inside the building tell the tale. These undead were once men, chained up and forced to watch as person after person was burned alive in front of them, the horror driving them mad. These buildings are factories to create new troops for Zon-Kuthon.

The party confer briefly. The fight may come down to John’s channelling and his Asimaar Daylight ability. In any case – they agree that they seriously need to be out of here before nightfall.

Bottom has a moment. It has been difficult for a Lawful Good monk travelling with this gang of frankly murderous worshippers of the Outer Gods. But what he saw in that building was a whole new level of evil. It put things in a little perspective. The tower lies ahead, and there’s plenty of city between here and there.

What a shame we aren’t using sanity point rules! Oh well :) . Just the one fight because we spent a fair bit of time sorting out level 12 gear and purchases. Unfortunately, Brus’ weapon has a book value of 71k which completely blows out the value of his gear. I have sent some mail to our mailing list to try to sort it out. Ultimately, there is going to have to be some handwaving going on even if we do cut back his more expensive items (he is rocking a belt +6, which in all fairness is crazy at 12th level).

We are having a bye next week. More madness after that.


For @AndreVltchek

21 June, 2015

For @AndreVltchek, in response to In the USA – “I Cannot Write!”.

“During those two weeks I met some of the greatest thinkers living in the United States: Michael Parenti, and John Cobb. Some time ago I worked with Michael on two books, one his and one mine, but this was our first face-to-face encounter. I discussed Christianity with John Cobb, trying to define what is encoded in it that allows the most horrid atrocities to be committed in the name of the Cross. It was deep, philosophical discussion, and we will convert it into a book, soon.”

What do we know about Jehovah, god of the earliest parts of the bible?

Well, he is slow to anger, but his anger is very terrible. When he becomes angry, he shakes the pillars of the earth. He punishes people by making the earth open up and swallow them. Smoke issues from his nostrils. His eyes are a flame of fire, and his mouth is a consuming fire. The radiance of his immediate presence is so great that no man can look directly upon him and live. He led his people across the desert with a pillar of smoke by day and fire by night. Moses received the law by ascending a mountain that smoked and shook.

He kills almost indiscriminately – human lives are nothing to him. His anger against all humanity is so great that he can only be placated by sacrifice. And not just any sacrifice, but one that is pure and unblemished. Innocent. The key to the redemption of man is a human sacrifice, and not just of any human, but of a sinlessly perfect one. But people still anger him even so, so he will cast them into a lake of fire that wil burn and burn forever. His rage is bottomless, limitless. For his enemies (anyone that does not prostrate themselves to him) no vengeance, no matter how extravagant, is enough.

According to the bible, all of humanity is descended from a tribe of people from the region of Mt Ararat. I would wager a considerable amount that 10,000 years ago or so, those mountains were active volcanoes.

What is encoded in christianity that permits atrocities? Only the most fearsome, violent and unpredictable phenomenon in all nature, one that must be placated, pleased, flattered by any means necessary, at any cost, and not always with much success. Jehovah is a volcano god – he is as as frightening and cruel as every other volcano god like him.


Follow

Get every new post delivered to your Inbox.

Join 46 other followers