I'm gonna show you a game which seems difficult

But! I'f you learn one simple trick, and i'm serious it's genuinely this one simple trick

The game becomes, so easy! Most people can be beaten by a piece of plastic, From the sixties.

-music-

Here's the game of Dr.Nim I managed to find and buy online

It came in a fantastic original 1960s box check that out

You can tell us nineteen sixties America because there's a wholesome family having fun

with guns in the background! The game starts with the row Marbles along the

top of the board there, and the goal is to take the last marble, whoever gets

that one there wins the game, and each time you have a go

you can choose to take one two or three marbles.

but who am I going to play against? well for dr.Nim

you play, the piece of plastic itself there are levers and things that toggle

and bars underneath it will make its own moves and in theory it will always beat me

as the human i get the luxury of going first there's a little toggle down

here it is on the left and means it's Dr.Nim's go, if it's on the right

it's my go as a human and whenever I want to release a ball i just hit the

button on the side there

there goes the first one and you know what, i'm going to do two marbles on my

first go

so now I move the lever over to Dr.Nim's side and to set Dr.Nim going

you hit the button once and it will choose how many marbles that wants to take

so here we go, going for one, oh wait it's gone for a second one

oh! So it took two marbles and then moved the lever back over to indicate it's now

my go

well I only want one, so there's my one and it's made it through, ever so

often we get stuck I now go fine, dr. Nim all yours

I took one, what are you going to do? that's going for one, going for a second one its

gone for a third one, and then switched it back to my go

okay there are four left, I think dr. Nim may have me in a corner here, i'm

going to take, oh goodness

I'll go with two again there's- actualy you know what? Just one, I'll do one, and gonna go straight

back to dr.Nim, and you're on dr.Nim

one second, one

and the winning third one and just to rub it in as it winds it puts the lever

back over, to say it's now my go... ...to suck...

No matter how many times you play doctor Nim, the plastic jerk

as long as the human goes first as long as you play by all the rules and don't

cheat

it will beat you every single time

this is based on a mathematical game called unsurprisingly, NIM, and this is a

plastic computer that has been built to be any human in a simplified version of

NIM, NIM is a great game to play it like this piece of plastic

you're a big fan of beating other people and i'm going to teach you how to always

win at NIMH

so you can use it to annoy your friends and family,

- music-

the game of NIM has been known about and studied by mathematicians for, well over

a century, although people believe it predates that by a long way

specifically what we're looking at here is a version of NIM called single pile

NIM,for dr.Nim all the marbles came off one row the version i'm going

to show you, all these coins will be in a single line

technically proper NIM can have more than one pile, but believe me the

strategies for multi pile NIMH get a lot more complicated as very much another game

for another video

the way I would normally play NIMH in a bar or similar setting against friends

strangers you know, chumps, would be to use something like 12 coins we start

from one end each player can take one two or three coins

whoever takes the last coin wins while I absolutely never encourage any form of

gambling if you were the kind of person who would like to do that you and your

opponent can both put some money on the game

put it under the last coin or token and whoever takes that one gets the cash, in

a similar vein many years ago we were involved in setting up something called

mass of asking where we went outside and did busking with mathematics on the

street

one of the routines involved putting 12 pigs on one of our buskers the 12 peg

had 20 pounds underneath it

very importantly 20 pounds of our money but we knew if we played the correct

strategy we would always be able to win the game and keep money

some people found that pretty annoying they would go away come up with

strategies come back trying to beat us, in fact there are a few ways people can try

and get you in a corner where you can no longer win but I'll get to that in a

moment to start with

here's how you win 12 coin NIMH, a nice way to start is by looking at the end

game i got myself in before with dr.Nim i had for marbles left or in this case

for coins

it was my go, and i knew i couldn't possibly win, and if you get your opponent in

this situation you can always win because if they take one you take three

if they take to you take two they take three you take one and they can't take

four

according to the

rules, so the goal of the game is to get them into this situation but how do you

guarantee that situation

well imagine it earlier in the game and there are eight remaining and it's their

go

you've got the same deal going on with just these four to leave these four left

if they take one you take three they take to you take two

they take three you take one as long as between them and you you take for away

you'll be left in that end game

we can now go one step back to the very beginning of the game where there are 12

coins all together

you're thinking of them in lots of four for there for there for at the end for

each round of full the other person goes first

you go second you need to make sure you take enough coins after their go

so between you you have taken four in total once you know what's going on

it's a very straightforward game to win they take one you take three

they take to you take two they realize they can't win they get annoyed you get

the money

the only problem arises when people realize the trick themselves and this is

what we had when we were basking people would go away

work it out come back and then they would insist that we go first

instead of them, so what you do is if any of your friends caughten on to what you're

doing

the next time you reset it you do what we used to do you just take out an extra

coin and put it on the end we would suddenly increase the number of pegs to

be greater than 12

you go first and you bring it down to the now multiple of 4

it's they go and you're right back in your winning situation

-Some Extra Radical Music-

so how does dr.Nim the piece of plastic play by those rules with the top we have

the 12 marbles as we would expect

and then underneath that we have a series of these little toggling plastic

Levers, they keep track of how many models have gone through the game so far

and you can think of them as kind of like a binary counter but it's not true

binary it's more of a tally system that keeps track of the marbles

you start with the leftmost one up and the other two flat down the first model

release drop the left one that raises the center one if I then send a second

one it drops the things one raises the right one

the third marble just restore the right one to being flat

only when there's a fourth marble your left my one get raised back up again and

we're right back to where we started that repeats every set of four marbles

after they've gotten through what are now calling the paddles the marbles can

go one of two different ways they can either go to the left or they can go to

the right, if its Dr.Nim's turn and the switches over on their side

any marbles which go to the left will bump the switch over ending dr.Nim's go

any marbles which go to the right

hit the button and release another marble so we need to save from the

different arrangements of the top three paddles and it keeps track from each set

of 4 is the first second third or fourth ball

do they cause dr.Nim's go to end? or do they cause them to take another marble

let's have a look i'll just cycle through a few marbles and will keep

track

first Marvel out ends dr. names go second marble you take another ball

third marble take another ball fourth model and the go and it carries on like

that first one will end his go on the left second one goes to the right take

another one third one go to the right take another one for one goes to the

left ending their go

so what does this mean for dr.Nims strategy where you can imagine all 12

marbles at the beginning works in their groups of four and for each one

it's dr. him get to go on the first fourth model

they're going to call their go to an end

if they get to have a go on the second or third they're always going to carry

on to another one when i first got the game and I was investigating how it

works

actually found that a little bit odd because dr.Nim doesn't have to end

their go on the first marble in theory the human is always going to have the

first model from each set of 4

why is it designed to go to the left is it just easier to build that way

It turns out if you read the admittedly casually racist instruction manual

you see they're acting all different ways of playing doc turn in their

options for dr. need to go first and you can do the same trick you can give them

extra marbles

the doctor named will just take straight away in there are other versions where

you have a fighting chance

there are some versions of this game where you can actually beat dr.Nim and

that's what this little paddle here is for is called the equalizer paddle and

you can set that so initially doctor named doesn't play with perfect strategy

you get a chance at the beginning to beat it

but if you make one mistake it will take over return to perfect play and you're

not going to win, and that's why dr.Nim has to end its go on the first position

as well as the fourth position it would only end in the fourth position

there are some versions of the game where you may have ended at a whole

round of four

in that case dr.Nim would take four marbles that's against the rules and it

will have cheated and whoever designed the dr.Nim game

to their credit they made in such a way that it will never cheat

it will always play within the rules admittedly in such a way that it would

normally kick your ass

so they are that is the game of dr.Nim, I find it absolutely fascinating

as an example of a very early computing based game

the instructions for all their drawbacks to go into a surprising amount of detail

of the theory behind how dr.Nim actually plays so you can see here

there's a whole section next to that fantastic caricature which talks all

about whether or not machines can actually think, if you like this kind of

real-world ridiculous physical computing then you're going to love my Domino

computer check it out -

thousand dominoes arranged in a pattern such as they can do binary arithmetic

if you like this general concept of fascinating mathematics of course make

sure you subscribe to my stand-up mass channel and if you like winning drinks

money or just admiration of your friends when you do that how to playing them

and please do go beat them

-Last bit of Epic Music-