mscroggs.co.uk
mscroggs.co.uk

subscribe

Blog

 2015-08-27 

MENACE

Showing all comments about the post MENACE. To return to the blog post, click here.

Comments

Comments in green were written by me. Comments in blue were not written by me.
"When playing against skilled players, it is possible that the first move box runs out of beads. In this case, MENACE should be reset with more beads in the earlier boxes to give it more time to learn before it starts resigning."

If someone were doing this, you could do this automatically to avoid the perception or temptation of the operator to help it along. Instead of "oh, it's dead, let's repopulate the boxes", you could just make it part of the inter-game cleanup, like a garbage collection routine. After all the bead deleting/adding whatever, but before the next game starts, look at all the boxes, make sure that each box contains at least one of each color. Now this weakens the learning algorithm moderately, but it guarantees that it will never get stuck.
(anonymous)
   ×1              Reply
@(anonymous): Yes, those boxes are for O being MENACE and MENACE playing first
Matthew
                 Reply
@Matthew: Thank you for such a quick response. Just to let you know that that link did not work after .../tree/master/output, but I managed to search around for the right files :). In these files MENACE plays the Nought right? and the user plays the Cross?
(anonymous)
                 Reply
@Finlay: You can find them at https://github.com/mscroggs/MENACE-pdf.... The files boxes0.pdf to boxes3.pdf are the boxes for a MENACE that plays first.
Matthew
   ×1              Reply
Where can I find out all the Game states? I want to program MENACE for my computing coursework but for that I will need the Game states or matchboxes. Any help will be much appreciated.
Finlay
                 Reply
I've completed my own Menace, and will be making a video shortly. :)
Mike
                 Reply
@JT: I bought "craft matchboxes" (without the matches inside), but it looks like your bulk normals ones work out cheapers.
Matthew
                 Reply
@JT: correction, the best deal I have found is $120.48
https://www.amazon.com/dp/B07F6PY9XF/r...
JT
                 Reply
@Matthew: where do you buy your matchboxes at? Because I need 1296 and the best deal I have found is 1300 for $147.57 two packs of 500 for $49.65 each and three packs of 100 for $16.09 each.
JT
                 Reply
@Matthew: would it still work with the "roll over" rule? or would that just make it run out?
JT
                 Reply
@Matthew: Thank you so much, could you email me a link for it once you make it.
JT
                 Reply
@JT: Yes, you could. You need a matchbox for each possible combination of fingers on the players' hands, an beads in each box for each move that could be made in that position.

When I have some time, I'll have a go a write a javascript version of it...
Matthew
                 Reply
Hello Matthew Scroggs, I was wondering if it would be possible to make a "menace" with the game chopsticks? If you don't know what chopsticks is, then here are the rules listed on Wikipedia
Each player uses both hands to play the game, the number of fingers extended on a hand shows the number of points that the hand has.

Both players start with each hand having one point — one finger extended on each hand.

The goal of the game is for a player to force their opponent to extend all of their fingers and thumbs on both hands or to force the player to extend all their fingers and thumb and one hand if their other hand is already out. The score has to be exactly five. If the resulting number is more than five, the player is not out no matter what. For example, if a hand with 4 points is tapped by a hand with 2 points, the hand with 4 points becomes a hand with 1 point. This rule is called a 'roll over'.

Players take turns to tap their live hand(s) against another live hand (either their own other hand or one of their opponent's).

You can tap any live hand per turn, but only one

The number of points on the tapping hand is added to the number on the tapped hand, and the player with the tapped hand extends their digits to show the new score. The tapping hand remains unchanged.

A player may tap their two hands together to transfer points from one hand to the other. This is called a split. If a player has one hand out (0 fingers) and two fingers, on the other hand, they could split to have one finger on each hand. (This counts as a turn).You are not allowed to "swap hands" or switch the number of fingers between hands without splitting (going from 4 on one hand and 2 on the other to 2 on one hand and 4 on the other).
JT
                 Reply
Can you make a version where the ai goes second?
Nukey
                 Reply
@Sterling: To make a MENACE to play chess, you'd need to draw every possible position in chess. As I wrote in this blog post, if you had a matchbox for each possible chess position, your pile of matchboxes would be this big:



This number of positions is too big for this method of learning to work for chess, so you'd need a more advanced method...
Matthew
                 Reply
After watching the video with yourself and Matt, you commented on teaching it chess are there any PDFs on how to teach, the machine chess. Ie what are the mechanics
Sterling
                 Reply
@Alex: You can find the pdfs here. boxes0.pdf to boxes3.pdf are the states for a MENACE that goes first. second_boxes0.pdf to second_boxes2.pdf are the states for a MENACE that goes second.
Matthew
                 Reply
I know this has been asked a lot but would it be possible if you could make a pdf of all possible states of the game on your website? If not please just send them to me directly. Thank you, alex
Alex
                 Reply
@Alexis: Well spotted. There was a typo in the variable name used for the third move boxes, I've fixed this now
Matthew
                 Reply
When I try to change the settings of MENACE2, the sixth move is considered "NaN"... Hope you can fix this
Alexis
                 Reply
@David: I'll email you some pdfs. I've also added the (ugly) Python code I used to make the LaTeX that makes the pdfs to GitHub.
Matthew
                 Reply
My son is looking at doing a variation of this for his science fair, 2 questions: 1) Has there been a version where MENACE moves 2nd? 2) where might I find a pdf of the game states, at least for MENACE moving 1rst, but if possible moving 2nd
David
                 Reply
@Sam: I've emailed them to you
Matthew
                 Reply
I loved the standupmatha video on your MENACE, and I’m trying to build my own. Any way I could get a pdf with the 304 game states on it? Thanks! :)
Sam
                 Reply
@Marc St-jacques: To build MENACE, I only used the boards that could happen when it is player 1's turn, as MENACE always plays as player 1.
Matthew
                 Reply
Hi. I tried to implement my own version but I'm stuck at generating 626 boards, after removing impossible boards, wins and ties and transposing all 8 positions for each remaining board. This fellow here https://stackoverflow.com/a/32019787/7... comes to a similar conclusion stating there are 626 mid-game boards. So what am I missing to reduce my number to 304 ? --- PS. I could have asked the fellow in question, but my reputation on S-O is too low. :(
Marc St-jacques
                 Reply
I put it into a resign loop after 3 games. Left it resigning for a few hours, after selecting 'random' and speed to maximum, just to see what happens. 15 seconds for the first 1,000 resigns. After a couple of hundred thousand resigns, it had slowed to about 10% of the initial speed. It didn't crash. You could use an unlimited number of beads in the first move box, to stop people like me from finding the boundaries!
g0mrb
                 Reply
It seems to work! It didn't loop! Is there a way to represent the matchboxes (the game positions) in memory so that the 90 and 180 rotations of a same position would automatically be the same matchbox object ?
Misccold
                 Reply
I played ~40 games and then it got stuck in a loop of "MENACE resigns" on an empty board. I didn't touch the settings. Cool project :-)
Misccold
                 Reply
@Blan: I think I've fixed that. Let me know if you still have the same problem after refreshing the page.
Matthew
                 Reply
The online version of MENACE is really glitchy. Whenever you change the settings, it just keeps going in the corner. For instance, I changed it to get 1 bead per victory, and it just kept going in the corner every time. It made its second move, and then it just stopped playing after that. I put x's all over the board until I won. This happens with a lot of the custom settings.
Blan
                 Reply
@Matthew: Cool, thanks! Also thanks for translating the site to German, really useful.
Stephan Graf
                 Reply
@Stephan Graf: I do. I will email them to you
Matthew
                 Reply
I would like to build my own menace. Would you happen to still have a document template with the possible game states in matchbox size? This could save me some work ;)
Stephan Graf
                 Reply
If you take one bead out on a loss and put three in on a win, then a careful human player (by judicious choice of moves) can win almost three times as much as losing, without letting the machine "catch on"
Martin
                 Reply
@Steve Paget: I've also made a physical MENACE since writing this. I plan to make a video at some point: I'll let you know when I do...
Matthew
                 Reply
Oh, I just read further and saw that Oliver made the physical MENACE. I shall menace him instead!
Steve Paget
                 Reply
I would love to see a game being played with this machine. Could you make a Youtube video of a game in progress, so we can see it in action? How long does a typical game last with a trained engine?
Steve Paget
                 Reply
@Joe: There may be a mistake in the source code somewhere. I will look into it.
Matthew
                 Reply
Whenever the board turns into two opposite corners, and I have played in bottom middle and center, Menace stops playing for some reason (aka I get a free move).
Joe
                 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>
To prove you are not a spam bot, please type "i" then "n" then "t" then "e" then "g" then "e" then "r" in the box below (case sensitive):

Archive

Show me a random blog post
 2020 

Jul 2020

Happy ϕ+e-2 Approximation Day!

May 2020

A surprising fact about quadrilaterals
Interesting tautologies

Mar 2020

Log-scaled axes

Feb 2020

PhD thesis, chapter ∞
PhD thesis, chapter 5
PhD thesis, chapter 4
PhD thesis, chapter 3
Inverting a matrix
PhD thesis, chapter 2

Jan 2020

PhD thesis, chapter 1
Gaussian elimination
Matrix multiplication
Christmas (2019) is over
 2019 
▼ show ▼
 2018 
▼ show ▼
 2017 
▼ show ▼
 2016 
▼ show ▼
 2015 
▼ show ▼
 2014 
▼ show ▼
 2013 
▼ show ▼
 2012 
▼ show ▼

Tags

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

Archive

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