Header tag

Thursday, 31 August 2017

Playing Games by Rolling Dice

This is a very short study of how to vary board games by changing the way you use the rolls of two dice. When playing board games with my children, we've found that just adding the dice totals together doesn't always produce the most useful result. Classically (for example in Monopoly), players use the sum of two dice to determine how many spaces to move their counter.  This leads to a very simple distribution of results (die 1 is shown vertically, die 2 is shown horizontally; the sums complete the table). 

Sum 1 2 3 4 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9
4 5 6 7 8 9 10
5 6 7 8 9 10 11
6 7 8 9 10 11 12

Average (mean):  7
Average (mode): 7

Now, for an alternative distribution, we can take the maximum value of the two dice (whichever is the higher of the two).  This only gives a range of 1-6, but it's skewed towards the higher end of the distribution (since there are 11 ways of scoring 6, and only one way of scoring 1).


Max 1 2 3 4 5 6
1 1 2 3 4 5 6
2 2 2 3 4 5 6
3 3 3 3 4 5 6
4 4 4 4 4 5 6
5 5 5 5 5 5 6
6 6 6 6 6 6 6


Mean 4.472222222
Mode 6

Conversely, if we take the minimum of the two values, then we have a distribution which is skewed to the lower end (there are 11 ways of scoring 1, and only one way of scoring 6).

Min 1 2 3 4 5 6
1 1 1 1 1 1 1
2 1 2 2 2 2 2
3 1 2 3 3 3 3
4 1 2 3 4 4 4
5 1 2 3 4 5 5
6 1 2 3 4 5 6


MEAN 2.527778
MODE 1

Comparison

The straight sum gives an average of 7, with a symmetrical split
Taking the maximum (i.e. whichever of the two dice is the largest) gives a mode of 6, and a mean of 4.47.
Taking the minimum gives a mode of 1, and a mean of 2.52.

We found this useful in our games, where we introduce a special feature which allows you to either move your pieces forwards by one roll, or one of your opponents' pieces backwards by one roll.  It's not desirable to move pieces back further than forwards (there's the potential for people to make no forward progress, and extend the game excessively), so the skewed distribution of maximum or minimum is working well for us.

Extension

The distribution of totals for one die gives a mean average of 3.5
For two die, the mean is 7.
For three, I suspect the mean is 10.5, and in a future blog, I'll look at this in more detail, along with other ways of producing interesting distributions with just two dice.





Tuesday, 4 July 2017

2017 New Year's Resolutions, Reviewed

At the start of 2017, I made four New Year's Resolutions.  We're now half way through 2017, so this seems like a good point to review my progress on each of them.

1.  To give more than I receive
On the surface,I think this one has been easier than the others. It's been an exciting challenge, and throughout the year I (and we as a family) have  given away all sorts of items - but we've still received many things too.  I had my 40th birthday in February and was astonished by the generosity of my friends, which made giving more than receiving a real challenge.  I was also very pleased by my friends who made charitable donations on my behalf, and a survival shelter (UNHCR) and drinking water for 10 people (Oxfam) were donated for me.   This is giving and receiving simultaneously - I love it.


However, this has also been very challenging:  who am I giving to, and is it really giving?

Matthew 5:46-47
If you love those who love you, what reward will you get? Are not even the tax collectors doing that? And if you greet only your own people, what are you doing more than others? Do not even pagans do that? 

So, it's great to be able to post items on Facebook ("Free to good home...") but it's also self-filtering, since I'll only be giving to my friends ("those who love me") - so is that really rewarding? And it's hardly giving in secret if it's plastered all over social media.  And that's something else: it's difficult to say, "Oh yes, I'm doing really well at giving," without sounding like I'm boasting about it.  So I'll reiterate that it's been challenging to give to strangers, and to give without expecting reward, and I'll mention this verse, which has been a source of encouragement to me.

Proverbs 19:17
Whoever is generous to the poor lends to the LORD, and he will repay him for his deed.

And we will continue to make regular donations to our local Salvation Army shops. 

2.  To spend less time on trivial matters

Trivial matters are things that serve absolutely no practical purpose. Except that sometimes a bit of no practical purpose is a good thing.  Sometimes, after a busy day at work and having put the children to bed, trivial matters are a welcome break.  So no, I haven't completely cut out social media, TV, DVDs and the like, but I'm spending far less time on Facebook, almost zero time on Twitter and I am being more selective about what I watch on television.  And deleting the Facebook app from my phone was a good move - I'm no longer interrupted by the latest event being promoted by someone I follow, or by "Somebody else commented on the post you commented on a couple of days ago."  I am gently nudging myself to do something else while watching TV in the evenings... like writing articles for this blog, for example.


It's also made me think about what's actually trivial.  Building a Lego model with my children:  trivial or important?

3. To produce more than I consume 


No.  I am producing more than last year, and I am consuming less (and of better quality), but I don't think I'll ever tip the balance. After all, I have only one mouth but two ears.  However, there are a number of things I've 'produced' this year (and this is just a selection I can recall off the top of my head):

- A board game to play with two of my children (we titled it "Back to Base", and it's a huge three-player game played on a triangular board, currently on its fourth version)


- Pieces to play "Back to Base" (we each need five pieces, and they've become more elaborate over the months).  This has become almost a repair-not-replace, as I've kitbashed a number of figures from other games (for example, a figure of Christophe from Frozen - as found in a charity shop - became an astronaut with a camera).

- More blog posts than last year - that's easy to measure (this will be number 13 this year, compared to 14 for the whole of last year), and now I'm aiming to improve my quality as well as quantity.

- Various VHS to DVD conversions for friends (family weddings, for example)


A couple of pieces of music (in draft)
And I am consuming 
less - yes.  Less TV, for sure.  I'm reading instead - and mostly non-fiction.

4.  Repair, not replace

This hasn't been on my mind as much as the others (I had to look it up to remember what it was); I've repaired various toys for my children, and made various fixes around the house, but I haven't consciously repaired anything I'd otherwise have thrown away.

With one exception:  one of my pairs of jeans developed a small hole, and so I decided to patch it up.  It was only a small hole that wasn't immediately obvious, so only needed sewing back together and a small patch. I completed the repair with a small patch on the inside to hold my sewing together.  I then realised that the jeans were actually too small, so they went in the charity shop bag.  Repaired, not replaced, and then given away: two for the price of one! :-)


I will provide another update around Christmas time (when I shall be able to work on my giving!).

Thursday, 22 June 2017

The General Election (Inferences from Quantitative Data)

The Election

The UK has just had a general election: all the government representatives who sit in the House of Commons have all been selected by regional votes.  The UK is split into 650 areas, called constituencies, each of which has an elected Member of Parliament (MP). Each MP has been elected by voting in their constituency, and the candidate with the highest number of votes represents that constituency in the House of Commons.


There are two main political parties in the UK - the Conservative party (pursuing centre-right capitalist policies, and represented by a blue colour), and the Labour party (which pursues more socialist policies, and represented by as red colour).  I'll skip the political history, and move directly to the data:  the Conservative party achieved 318 MPs in the election; the Labour party achieved 262; the rest were spread between smaller parties. With 650 MPs in total, the Conservative party did not achieve a majority and have had to reach out to one of the smaller parties to reach the majority they require to obtain a working majority.

Anyway:  as the results for most of the constituencies had been announced, the news reporters started their job of interviewing famous politicians of the past and present.  They asked questions about what this meant for each political party; what this said about the political feeling in the country and so on.

And the Conservative politicians put a brave face on the loss of so many seats.  And the Labour politicians contained their delight at gaining so many seats and preventing a Conservative majority.

The pressing issue of the day is Brexit (the UK's departure from the European Union).  Some politicians said, "This tells us that the electorate don't want a 'hard' Brexit [i.e. to cut all ties completely with the EU], and that they want a softer approach." - views that they held personally, and which they thought they could infer from the election result.  O
thers said, "This shows a vote against austerity,"; "This vote shows dissatisfaction with immigration." and so on.

The problem is:  the question on election day is not, "Which of these policies do you like/dislike?" The question is, "Which of these people do you want to represent you in government?"   Anything beyond that is guesswork and supposition - whether that's educated, informed, biased, or speculative.


Website Data

There's a danger in reading too much into quantitative data, and especially bringing your own bias (intentionally or unintentionally) to bear on it.  Imagine on a website that 50% of people who reach your checkout don't complete their purchase.  Can you say why?

- They found out how much you charge for shipping, and balked at it.
- They discovered that you do a three-for-two deal and went back to find another item, which they found much later (or not at all)
- They got called away from their computer and didn't get chance to complete the purchase
- Their mobile phone battery ran out
- They had trouble entering their credit card number

You can view the data, you can look at the other pages they viewed during their visit.  You can even look at the items they had in their basket.  You may be able to write hypotheses about why visitors left, but you can't say for sure.  If you can design a test to study these questions, you may be able to improve your website's performance.  For example, can you devise a way to show visitors your shipping costs before they reach checkout?  Can you provide more contextual links to special offers such as three-for-two deals to make it easier for users to spend more money with you?  Is your credit card validation working correctly?  No amount of quantitative data will truly give you qualitative answers.

A word of warning:  it doesn't always work out as you'd expect.

The UK, in its national referendum in June 2016, voted to leave the EU.  The count was taken for each constituency, and then total number of votes was counted; the overall result was that "leave" won by 52% to 48%.  


However, this varied by region, and the highest leave percentage was in Stoke-on-Trent Central, where 69% of voters opted to leave.  This was identified by the United Kingdom Independence Party (UKIP) and their leader, Paul Nuttall, took the opportunity to stand as a candidate for election as an MP in the Stoke-on-Trent Central constituency in February 2017.  His working hypothesis was (I assume) that voters who wanted to leave the EU would also vote for him and his party, which puts forward policies such as zero-immigration, reduced or no funding for overseas aid, and so on - very UK-centric policies that you might imagine would be consistent with people who want to leave a multi-national group.  However, his hypothesis was disproved when the election results came in:

Labour Party - 7853
UKIP (Paul Nuttall) - 5233

Conservative Party - 5154
Liberal Democrat Party - 2083




He repeated his attempt in a different constituency in the General Election in June; he took 3,308 votes in Boston and Skegness - more than 10,000 fewer votes than the party's result in 2015.  Shortly afterwards, he stood down as the leader of UKIP.

So, beware: inferring too much from quantitative data - especially if you have a personal bias - can leave you high and dry, in politics and in website analysis.








Wednesday, 31 May 2017

Collatz Conjecture: 3n+5

In my previous articles on the Collatz Conjecture, I've looked at 3n+1 (the well-known original); then 5n+1 and 3n+3, referring to what to do when a term in the series is odd.  In this article, I'll look at 3n+5

Let's start with the smaller numbers and see where they take us:

Collatz:  3n+5

Loop A:  lowest = 1
9, 32, 16, 8, 4, 2, 1,8,4,2, 1, 8...

Loop B: lowest = 3, loop goes around a minimum of 19. A frequent entry path is via 7, 11 or 13.
24, 12, 6, 3,14,7,26,13,44,22,11,38,19,62,31,98,49,152,76,38,19...

Loop C:  lowest = 5.  The paths to this loop contain the multiples of 10.
15, 50, 25, 80, 40, 20, 10, 5,20,10,5, 20...

Loop D:  lowest = 23.  Also contains 29.
23,74,37,116,58,29,92,46,23, 74 ...

Other paths into the loops:

17, 56, 28, 14 --> loop B

27, 86, 43, 134, 67, 206, 103, 314, 157, 476, 238, 119, 362, 181, 548, 274, 137, 416, 208, 104, 52, 26, 13, --> Loop B:

29 = loop D

31 = loop B

33, 104, 52, 26, 13 --> Loop B

35, 110, 55, 170, 85, 260, 130, 65, 200, 100, 50, 25, 80 --> Loop C

37, 116, 58, 29 --> Loop D

39, 122, 61, 188, 94, 47, 146, 73, 224, 112, 56, 28, 14, 7 --> Loop B eventually

Summary

As with anything Collatz-related, it's easy to show results but difficult to prove anything.  One thing I can say is that I've only identified four loops with most of the numbers up to 100, and it's highly likely that this will hold for larger numbers, although they may take longer paths.

My articles on the Collatz Conjecture:

Snakes and Ladders (an introduction to the Collatz Conjecture)
Collatz: 5n + 1
Collatz:  3n + 3
Collatz: 3n + 5
Generative AI proves the Collatz Conjecture (published 1 April 2024)

Friday, 28 April 2017

Collatz Conjecture Revisited (part 2): 3n+3

I've previously looked at the Collatz conjecture, (3n+1) and I have revisited it before, too (5n+1).  Now, I would like to revisit it again.

The Collatz Conjecture states that when you take a number, and if it's even then divide by two, or if it's odd then multiply by three and add one, then you will eventually reach 1.  There's no proof (yet), but it holds for all numbers that have been tested.


I extended this in a previous post, and looked at the case of multiplying by five (instead of three) and adding one, and identified two loops and a growing series.

In this post, I will share my findings on another alternative, which is "3n+3".  [3n+2 doesn't work, since if n is odd, then 3n + 2 will also be odd].


3n+3


3n+3 has one loops which covers all numbers I have tested.

The simple loop/termination is [1], 6, 3, 12, 6, 3, 12.

There are various ways into this loop, in particular,

10, 5, 18, 9, 30, 15, 48, 24, 12, 6, 3, 12 etc.
7, 30, 15, 48 etc.
11, 36, 18, 9, 30, 15, etc.
13, 42, 21, 66, 33, 102, 51, 156, 78, 39, 120, 60, 30, 15, etc.

Interestingly, many of the starting numbers reach a common maximum value of 27696 before coming back down to 1.    This is first seen for an initial n=53.

For larger values of n, there is a longer sequence.  The graph below shows the maximum value of n (vertical axis) for different start values of n (between 101 and 241, as example material).  Note how 27696 predominates as the largest value reached.


The sequence from 27696 is:

27696, 13848, 6924, 3462, 1731, 5196, 2598, 1299, 3900, 1950, 975, 2928, 1464, 732, 366, 183, 552, 276, 138, 69, 210, 105, 318, 159, 480, 240, 120, 60, 30, 15, 48, 24, 12, 6, 3

27696 is seen for the following initial values of n:

53, 61, 81, 93, 107, 109, 123, 125, 141, 145, 163, 165, 181, 187, 189 (and others).

For values above 27696
I have not explored extensively above 27696, but there is a cluster of initial values that have the same new peak.  The cluster is around 27754:  27754, 27755 and 27757 all have the same maximum, which is 2026128.  The highest peak I have observed so far is for 27729, which reaches a height of 2698752.

To close, the full sequence for 27729 is:

27729, 83190, 41595, 124788, 62394, 31197, 93594, 46797, 140394, 70197, 210594, 105297, 315894, 157947, 473844, 236922, 118461, 355386, 177693, 533082, 266541, 799626, 399813, 1199442, 599721, 1799166, 899583, 2698752, 1349376, 674688, 337344, 168672, 84336, 42168, 21084, 10542, 5271, 15816, 7908, 3954, 1977, 5934, 2967, 8904, 4452, 2226, 1113, 3342, 1671, 5016, 2508, 1254, 627, 1884, 942, 471, 1416, 708, 354, 177, 534, 267, 804, 402, 201, 606, 303, 912, 456, 228, 114, 57, 174, 87, 264, 132, 66, 33, 102, 51, 156, 78, 39, 120, 60, 30, 15, 48, 24, 12, 6, 3

I shall continue to explore 3n+3, and also too compare the data and sequences with 3n+5.

My articles on the Collatz Conjecture:

Snakes and Ladders (an introduction to the Collatz Conjecture)
Collatz: 5n + 1
Collatz:  3n + 3
Collatz: 3n + 5
Generative AI proves the Collatz Conjecture (published 1 April 2024)

Thursday, 16 March 2017

Average Time Spent on Page

The history of Web analytics tools has left a legacy of metrics that we can obtain "out of the box" even if they are of no practical use, and I would argue that a prime candidate for this category is time spent on page, and its troublesome partner average time spent on page. It's available because it's easy to obtain from tag-fires (or server log files) - it's just the time taken between consecutive page loads.  Is it useful? Not by itself, no. 

For example,  it can't be measured if the visitor exits from the page. If a user doesn't load another page on your site, then there are no further tag-fires, and you don't get a time on page.  This means that you have a self-selecting group of people who stayed on your site for at least one more page.  It entirely excludes visitors who immediately tell they have the wrong page and then leave. It also, sadly, excludes people who consume all the content and then leave. No net benefit there, then.

Worse still, visitors who immediately realise that they have the wrong page and hit the back button are included.  So, is there any value to the metric at all?  In most cases, I would argue not, although there can be if handled carefully. For example, there is some potential benefit in monitoring pages which require data entry, such as checkout pages or other forms. In these circumstances, faster is definitely better, and slower suggests unnecessarily complicated or lengthy. For most shopping pages, though, you will need a much clearer view of whether more time is better or worse. In an international journey, four hours on an airliner is very different from three hours in an airport.

I mentioned that time on page is not helpful by itself: it can be more informative in conjunction with other metrics such as exit rate, bounce rate or revenue participation. For example, if a page has a high exit rate and high time on page, then it suggests that only a few people are finding the content helpful and are prepared to work through the page to get what they want - and to move forwards. Remember that you can't draw any conclusions about the people who left - either they found everything they needed and then left, or they gave up quickly (or anything in between).

So, if you use and quote average time on page, then I suggest that you make sure you know what it's telling you and what's missing; that you quote it in conjunction with other relevant metrics, and you have decided in advance if longer = better or longer = worse.

Friday, 24 February 2017

Ten Things I learned from not quite reading the Bible in A Year

My 2016 sort-of New Year's Resolution was to read the Bible in a year. I've not tried it before - and it wasn't until the start of February that I decided to go for it. I'd read all of Genesis in 2015, so in order to catch up, I started with Exodus. The church I attend was providing reading plans showing that it was possible, and what to read each day. I started February by keeping track and ticking boxes, but then I lost my reading plan in the middle of May 2016 - and carried on anyway. I didn't quite manage it (it's late January 2017 and I'm still in 1 Corinthians), but here's what I learned.

1. Reading the Bible in a year is a lot like running the four-minute mile.  It's likely that you'll be so busy trying to read your daily quota and trying to keep up the pace that you won't have much time to think and you certainly won't get chance to smell the roses.  It's relentless, and if you start slowing down, you'll need to up your pace for the following days just to keep up. If you want to read, consider, ponder and meditate on the Bible, then you're going to have to go more slowly.


2.  If you read the Bible chronologically in a year, you're in for a tough ride. If you read it sequentially (from cover to cover, like I did) it's going to be challenging.  For a start, you won't meet Jesus in the flesh until September or October.  That's a long time.  You'll get plenty of hints and clues about him, but he doesn't arrive until the last quarter of the year. Hang on in there.

3.  It's more fun reading it when we're winning.  Moses, Joshua, Saul, David, Solomon, Gideon and so on - all big winners, and all interesting and easy to read.  It's definitely easier than some of the later stuff, when it's doom and gloom; exiles and punishment; warnings, wrath and judgement.  The narrative of the early Old Testament is more straightforward than some of the symbolic stuff that comes later on.

4.  April will feel like a repeat of March as you read 1 and 2 Chronicles after 1 and 2 Samuel and 1 and 2 Kings.

5.  There are spoilers all the way through the Old Testament.  The prophets persistently warn about desolation, destruction and devastation, but they almost all break off briefly to say, "God's going to send somebody to fix all your mess."  Keep reading - it's worth it to find these snippets, and they'll keep you going through Lamentations, and the last few minor prophets.

6.  Some of it is downright confusing (even the Old Testament).  When they aren't warning God's people, or telling them to repent, or reassuring them that God will send somebody to help, some of them even have visions of heaven, or of the distant future.  You thought the living creatures and the elders were only in Revelation?  So did I, until this year.

7.  Your speed through the Bible will probably change dramatically, depending on where you are.  It's possible to "read" large parts of Numbers very quickly - 132,000 of this tribe, 89,000 of that tribe, and so on. Remember how I said reading the Bible in a year is like running a four-minute mile?  Well, this mile-long track is not flat; you'll definitely run different parts of it at different speeds.

8.  When you do reach the start of the New Testament, it'll feel like a breath of fresh air.  Yes, there's the genealogy stuff that we had in the early parts of the Old Testament, but it gets going again - and you'll slow down again. There's just so much happening in each chapter. And when I finally started picking up the pace (through Acts), I slowed down again (Romans, with its exceptionally long, parenthetical, phrases, and therefore I couldn't go as quickly - or as rapidly, therefore - as I could through some of the other books).

9.  On the subject of the New Testament: one advantage to reading sequentially is that you start to notice themes and patterns that you wouldn't spot if you were just reading sections or passages.

For example:  Matthew's gospel frequently refers to "your heavenly Father", which is a very welcome change after God Above in the Old Testament.  There really is a massive change of tone between Jesus and the prophets who came before him - Jesus really knows about heaven.  Mark - immediately.  Jesus is quite clearly in a hurry.  Everything is immediately.  Matthew spends a few chapters with Jesus' genealogy, birth and childhood.  But Mark?  "This is the good news about Jesus: this is what he did first", and Jesus has carried out miracles by the end of the first chapter.   Luke - I didn't find anything specific in Luke, but John is all about "eternal life."  Inheriting it, getting it, having it.  I don't remember reading much about eternal life in the other gospels, so John is clearly compensating :-)

10.  Regular reading works.  I try to read at the same time each day, after the children have gone to bed and are settling down to sleep.  This works providing they sleep at the same time, and the rest of the daily routine works.  I didn't read as much when we were on holiday, and I didn't read as quickly when they stayed up late or didn't go to sleep as usual.  If you can find a fixed, regular time, that'll probably work better.

It's now late January, and as I said, I'm working through 1 Corinthians, with a view to completing the New Testament by the end of February... the finish line is in sight!  This year, I'm taking a far more measured approach - when I've finally completed the New Testament, I'm just going to loop round the gospels for a bit.  The aim of reading the Bible in a year isn't really to read all the pages in 365 days.  It isn't even to read all the pages eventually (although it's a worthwhile aim).  It's to learn to read the Bible regularly.  It's not about running a four-minute mile, it's about building strength and keeping fit.

Other articles I've written based on Biblical principles

10 things I learned from not quite reading the Bible in a year
Advent and a Trip to London
Advent: Names and Titles
Reading Matthew 1
My reading of Matthew 2
The Parable of the 99 Sheep