mscroggs.co.uk
mscroggs.co.uk
Click here to win prizes by solving the mscroggs.co.uk puzzle Advent calendar.
Click here to win prizes by solving the mscroggs.co.uk puzzle Advent calendar.

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.
This is very neat. I wonder how long it would take to use that many matches to get all those match boxes.
Duke Nukem
×14   ×13   ×6   ×3   ×3     Reply
"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)
×3   ×7   ×3   ×4   ×4     Reply
@(anonymous): Yes, those boxes are for O being MENACE and MENACE playing first
Matthew
×4   ×3   ×2   ×2   ×2     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)
×2   ×2   ×2   ×2   ×2     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
×2   ×4   ×3   ×2   ×3     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> <logo>
To prove you are not a spam bot, please type "elbatnuocnu" backwards in the box below (case sensitive):

Archive

Show me a random blog post
 2024 

Nov 2024

Christmas (2024) is coming!

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

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

Archive

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