Nim Trainer

This is a discussion on Nim Trainer within the Game Programming forums, part of the General Programming Boards category; Seriously, I should never be up until 3:30am, but since my wife isn't around I have no self control. I'll ...

Nim Trainer

Seriously, I should never be up until 3:30am, but since my wife isn't around I have no self control. I'll turn in early tomorrow.

Why am I up so late? Can't you guess. I pulled another all-nighter. Got it in my head to do this program and couldn't stop until it was done.

Supposedly, making a computer program play Nim is an academic exercise. Don't you believe it. Especially if like me you insist on making Nim (multiple piles) and not pick up sticks (one pile) and insist on making the misere version (loser takes last) that everyone is SUPPOSED to be playing anyways, not the "normal" version (winner takes last) that mathematicians like to talk about because the math is easier. But add to that I set myself the sadistic goal of making a game that not only played a perfect game but would teach YOU, the human, to play a perfect game.

See, if the computer's going to beat you every time you play, what's the fun in that? I'd rather the computer be used as a tool to help me beat my friends later. Maybe your highly honed skills could settle a tab with the bar tender. Maybe not. The point is being beat isn't fun. Learning to beat someone else can be.

So now I present to you the fruits of my depravity. Why? Like I said, it's 3:30 am and it seems like a good idea.

Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

The difference? I removed 17 lines of code and now it plays to take that last piece. The strategy is exactly the same, up until the end game. Playing misere means the strategy has to change right at the end, but the method of keeping control is exactly the same up to that point.

Mathematicians are lazy, man. Thorough, but lazy. We'll sum up 20 pages of proof with "from here the solution is academic," which really means, "bugger all, it's going to take us 20 more pages to finish this right. You do it."

What drives me crazy is that lazyness affected the vocabulary. I was under the impression that the misere version of nim was the way to play it, the way everyone played it. Then I run into the mathematical analysis of the game and suddenly the normal way of playing it (misere) is not what they called the normal play. So the variant gets to be called normal because it's solution is shorter.