mscroggs.co.uk
mscroggs.co.uk

subscribe

Blog

 2019-12-27 
In tonight's Royal Institution Christmas lecture, Hannah Fry and Matt Parker demonstrated how machine learning works using MENACE.
The copy of MENACE that appeared in the lecture was build and trained by me. During the training, I logged all the moved made by MENACE and the humans playing against them, and using this data I have created some visualisations of the machine's learning.
First up, here's a visualisation of the likelihood of MENACE choosing different moves as they play games. The thickness of each arrow represented the number of beads in the box corresponding to that move, so thicker arrows represent more likely moves.
The likelihood that MENACE will play each move.
There's an awful lot of arrows in this diagram, so it's clearer if we just visualise a few boxes. This animation shows how the number of beads in the first box changes over time.
The beads in the first box.
You can see that MENACE learnt that they should always play in the centre first, an ends up with a large number of green beads and almost none of the other colours. The following animations show the number of beads changing in some other boxes.
MENACE learns that the top left is a good move.
MENACE learns that the middle right is a good move.
MENACE is very likely to draw from this position so learns that almost all the possible moves are good moves.
The numbers in these change less often, as they are not used in every game: they are only used when the game reached the positions shown on the boxes.
We can visualise MENACE's learning progress by plotting how the number of beads in the first box changes over time.
The number of beads in MENACE's first box.
Alternatively, we could plot how the number of wins, loses and draws changes over time or view this as an animated bar chart.
The number of games MENACE wins, loses and draws.
The number of games MENACE has won, lost and drawn.
If you have any ideas for other interesting ways to present this data, let me know in the comments below.
                  ×1      
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
@(anonymous): Have you been refreshing the page? Every time you refresh it resets MENACE to before it has learnt anything.

It takes around 80 games for MENACE to learn against the perfect AI. So it could be you've not left it playing for long enough? (Try turning the speed up to watch MENACE get better.)
Matthew
                 Reply
I have played around menace a bit and frankly it doesnt seem to be learning i occasionally play with it and it draws but againt the perfect ai you dont see as many draws, the perfect ai wins alot more
(anonymous)
                 Reply
@Colin: You can set MENACE playing against MENACE2 (MENACE that plays second) on the interactive MENACE. MENACE2's starting numbers of beads and incentives may need some tweaking to give it a chance though; I've been meaning to look into this in more detail at some point...
Matthew
                 Reply
Idle pondering (and something you may have covered elsewhere): what's the evolution as MENACE plays against itself? (Assuming MENACE can play both sides.)
Colin
                 Reply
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "theorem" in the box below (case sensitive):
 2019-12-08 
Just like last year, the year before and the year before, TD and I spent some time in November this year designing a Chalkdust puzzle Christmas card.
The card looks boring at first glance, but contains 9 puzzles. By splitting the answers into two digit numbers, then drawing lines labelled with each number (eg if an answer is 201304, draw the lines labelled 20, 13 and 4), you will reveal a Christmas themed picture. Colouring the regions of the card containing circles red, the regions containing squares green, and the regions containing stars white or yellow will make this picture even nicer.
If you want to try the card yourself, you can download this pdf. Alternatively, you can find the puzzles below and type the answers in the boxes. The answers will be automatically be split into two digit numbers, the lines will be drawn, and the regions will be coloured...
                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
Rishabh, what do you see that I do not?
Rob Glencairn
                 Reply
Thanks for the feedback. (I now understand the need for redaction). My son sent me your link as a Xmas present. I must think of an appropriate retaliation. (What is a PDF?)Think I've fixed 1,6 and 9....8 eludes me, for the moment.
Rob
                 Reply
@Rob: It looks to me like you've made mistakes in questions 1, 6, 8, and 9. The hints from the back of the pdf might help:

1. How many numbers between 1 and 10,000 have 1 as their final digit? How many have 1 as their penultimate digit?

6. How many ways can you write 1? 2? 3? 4? 5? What's the pattern?

8. How many zeros does 10! end in? How many zeros does 20! end in? How many zeros does 30! end in?

9. Carol’s sum is odd. What does this tell you about the 5- and 6-digit numbers?
Matthew
×1   ×1   ×2   ×1   ×2     Reply
I'm 71, with one good eye left. What am I missing?
1. 400001
2. 1849
3. 2002
4. 130405
5. 120306
6. 53?
7. 171175
8. 59?
9. 313525
Rob
                 Reply
It was fun.
Rishabh
   ×1         ×1     Reply
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "oitar" backwards in the box below (case sensitive):
 2019-11-24 
This year, the front page of mscroggs.co.uk will once again feature an Advent calendar, just like last year, the year before, the year before and the year before. Behind each door, there will be a puzzle with a three digit solution. The solution to each day's puzzle forms part of a logic puzzle:
It's nearly Christmas and something terrible has happened: while out on a test flight, Santa's sled was damaged and Santa, Rudolph and Blitzen fell to the ground over the Advent Isles. You need to find Santa and his reindeer before Christmas is ruined for everyone.
You have gathered one inhabitant of the four largest Advent Isles—Rum, Land, Moon and County—and they are going to give you a series of clues about where Santa and his reindeer landed. However, one or more of the islanders you have gathered may have been involved in damaging Santa's sled and causing it to crash: any islander involved in this will lie to you to attempt to stop you from finding Santa and his reindeer. Once you are ready to search for Santa, Rudolph and Blitzen, you can find the map by following this link.
Each of the clues will be about Santa's, Rudolph's or Blitzen's positions in Advent Standard Coordinates (ASC): ASC are given by six two-digit numbers with dots inbetween, for example 12.52.12.13.84.55. For this example coordinate, the islanders will refer to (the first) 12 as the first coordinate, 52 as the second coordinate, (the second) 12 as the third coordinate, 13 as the fourth coordinate, 84 as the fifth coordinate, and 55 as the sixth coordinate.
To find a point's ASC coordinates, split a map of the islands into a 9×9 grid, then number the rows and columns 1 to 9: the first two digits of ASC give the vertical then horizontal position of a square in this grid. The next two digits then give a smaller square when this square is then itself split into a 9×9 grid, and so on. An example is show below.
The ASC coordinates of this pair of flowers are 12.52.12.13.84.55 (click to enlarge).
Behind each day (except Christmas Day), there is a puzzle with a three-digit answer. Each of these answers forms part of a fact that one of the islanders tells you. You must use these clues to find Santa and his two reindeer.
Ten randomly selected people who solve all the puzzles, find Santa and his reindeer, and fill in the entry form behind the door on the 25th will win prizes!
The winners will be randomly chosen from all those who submit the entry form before the end of 2019. Each day's puzzle (and the entry form on Christmas Day) will be available from 5:00am GMT. But as the winners will be selected randomly, there's no need to get up at 5am on Christmas Day to enter!
As you solve the puzzles, your answers will be stored. To share your stored answers between multiple devices, enter your email address below the calendar and you will be emailed a magic link to visit on your other devices.
To win a prize, you must submit your entry before the end of 2019. Only one entry will be accepted per person. If you have any questions, ask them in the comments below or on Twitter.
So once December is here, get solving! Good luck and have a very merry Christmas!
                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
This search space is so large, it's way harder than trying to find Wally like in the children's books. Best to read everything carefully looking for any clues, and then solve all the puzzles and logic before searching randomly!
Did you know Wally is called Waldo in the US, Walter in Germany, and Charlie in France?
Dr. Matrix
×3   ×1              Reply
Thank you, I was worried. Thanks also for the puzzles, makes a change from my usual sudokus. I especially liked 3, 9, 11, 16, 21 and 23.
(anonymous)
                 Reply
@(anonymous): You don't get a confirmation email but if you hit submit you'll be entered. (I'll add confirmation emails before next year...)
Matthew
                 Reply
Do we get a confirmation email after submission of the entry form? I never received one, so I'm not sure if I am entered.
(anonymous)
                 Reply
Thanks for the nice puzzles!
Gert-Jan
                 Reply
@Seth: If you find them on the map then that's all you need to do. (And if you didn't find them yet then the entry form won't appear so you definably did everything you need to do.)
Matthew
                 Reply
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "decagon" in the box below (case sensitive):
 2019-09-15 
Today, I wrote this LaTeΧ document. It only uses default LaTeΧ functionality, and uses no packages.
If you compile it (twice so that cross references are not ??s), you will get a four page document (pages numbered i to iv), that repeatedly says: "This document ends on page v."
This document ends on page iv and says: "This document ends on page v."
If you then recompile it, you will get a five page document (pages numbered i to v), that repeatedly says: "This document ends on page iv."
This document ends on page v and says: "This document ends on page iv."
Repeatedly compiling it will alternately give these two results, and so the process of compiling this LaTeX document does not converge.
Tags: latex
                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "tnemges" backwards in the box below (case sensitive):
 2019-09-01 
This week, I've been in Cambridge for Talking Maths in Public (TMiP). TMiP is a conference for anyone involved in—or interested in getting involved in—any sort of maths outreach, enrichment, or public engagement activity. It was really good, and I highly recommend coming to TMiP 2021.
The Saturday morning at TMiP was filled with a choice of activities, including a treasure punt (a treasure hunt on a punt) written by me. This post contains the puzzle from the treasure punt for anyone who was there and would like to revisit it, or anyone who wasn't there and would like to give it a try. In case you're not current in Cambridge on a punt, the clues that you were meant to spot during the punt are given behing spoiler tags (hover/click to reveal).

Instructions

Each boat was given a copy of the instructions, and a box that was locked using a combination lock.
The instructions, download a pdf here.
Locked boxes.
If you want to make your own treasure punt or similar activity, you can find the LaTeX code used to create the instructions and the Python code I used to check that the puzzle has a unique solution on GitHub. It's licensed with a CC BY 4.0 licence, so you can resuse an edit it in any way you like, as long as you attribute the bits I made that you keep.

The puzzle

Four mathematicians—Ben, Katie, Kevin, and Sam—each have one of the four clues needed to unlock a great treasure. On a sunny/cloudy/rainy/snowy (delete as appropriate) day, they meet up in Cambridge to go punting, share their clues, work out the code for the lock, and share out the treasure. One or more of the mathematicians, however, has decided to lie about their clue so they can steal all the treasure for themselves. At least one mathematician is telling the truth. (If the mathematicians say multiple sentences about their clue, then they are either all true or all false.)
They meet at Cambridge Chauffeur Punts, and head North under Silver Street Bridge. Ben points out a plaque on the bridge with two years written on it:
"My clue," he says, "tells me that the sum of the digits of the code is equal to the sum of the digits of the earlier year on that plaque (the year is 1702). My clue also tells me that at least one of the digits of the code is 7."
The mathematicians next punt under the Mathematical Bridge, gasping in awe at its tangential trusses, then punt along the river under King's College Bridge and past King's College. Katie points to a sign on the King's College lawn near the river:
"See that sign whose initials are PNM?" says Katie. "My clue states that first digit of the code is equal to the number of vowels on that sign (The sign says "Private: No Mooring"). My clue also tells me that at least one of the digits of the code is 1."
They then reach Clare Bridge. Kevin points out the spheres on Clare Bridge:
"My clue," he says, "states that the total number of spheres on both sides of this bridge is a factor of the code (there are 14 spheres). My clue also tells me that at least one of the digits of the code is 2." (Kevin has not noticed that one of the spheres had a wedge missing, so counts that as a whole sphere.)
They continue past Clare College. Just before they reach Garret Hostel Bridge, Sam points out the Jerwood Library and a sign showing the year it was built (it was built in 1998):
"My clue," she says, "says that the largest prime factor of that year appears in the code (in the same way that you might say the number 18 appears in 1018 or 2189). My clue also says that the smallest prime factor of that year appears in the code. My clue also told me that at least one of the digits of the code is 0."
They then punt under Garret Hostel Bridge, turn around between it and Trinity College Bridge, and head back towards Cambridge Chauffeur Punts. Zut alors, the lies confuse them and they can't unlock the treasure. Can you work out who is lying and claim the treasure for yourself?

The solution

The solution to the treasure punt is given below. Once you're ready to see it, click "Show solution".

Show solution

                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "m" then "e" then "d" then "i" then "a" then "n" in the box below (case sensitive):

Archive

Show me a random blog post
 2024 

Feb 2024

Zines, pt. 2

Jan 2024

Christmas (2023) is over
 2023 
▼ show ▼
 2022 
▼ show ▼
 2021 
▼ show ▼
 2020 
▼ show ▼
 2019 
▼ show ▼
 2018 
▼ show ▼
 2017 
▼ show ▼
 2016 
▼ show ▼
 2015 
▼ show ▼
 2014 
▼ show ▼
 2013 
▼ show ▼
 2012 
▼ show ▼

Tags

misleading statistics fractals nine men's morris folding tube maps php numerical analysis radio 4 the aperiodical mean london edinburgh bempp gather town go live stream rugby folding paper ucl map projections gaussian elimination propositional calculus noughts and crosses realhats finite element method polynomials dates quadrilaterals datasaurus dozen accuracy coins latex trigonometry news numbers big internet math-off harriss spiral countdown preconditioning braiding talking maths in public computational complexity runge's phenomenon guest posts cambridge pythagoras fonts asteroids european cup phd speed golden spiral crossnumber pascal's triangle estimation machine learning graph theory squares menace reuleaux polygons 24 hour maths manchester science festival hyperbolic surfaces chess stirling numbers recursion game of life advent calendar anscombe's quartet programming simultaneous equations geogebra statistics turtles convergence inverse matrices people maths tmip standard deviation sorting reddit manchester oeis cross stitch captain scarlet logs games determinants geometry javascript interpolation errors sport tennis newcastle finite group light frobel data visualisation python royal institution stickers exponential growth probability sound plastic ratio rhombicuboctahedron matrix multiplication matrix of minors raspberry pi mathsteroids signorini conditions dinosaurs approximation binary logic arithmetic royal baby mathslogicbot ternary bodmas weak imposition inline code books chalkdust magazine national lottery mathsjam triangles craft a gamut of games pac-man christmas card crochet databet curvature puzzles final fantasy dataset correlation hats wave scattering world cup logo gerry anderson london underground pizza cutting football wool martin gardner electromagnetic field sobolev spaces flexagons boundary element methods golden ratio hexapawn draughts palindromes chebyshev christmas fence posts hannah fry video games pi game show probability matt parker error bars matrices graphs dragon curves weather station data zines platonic solids pi approximation day youtube matrix of cofactors bubble bobble

Archive

Show me a random blog post
▼ show ▼
© Matthew Scroggs 2012–2024