Showing posts with label math. Show all posts
Showing posts with label math. Show all posts

Saturday, March 21, 2015

Nimbicus: An original game to play on a children's bead abacus stacker

You can play a surprisingly good variant of a nim game on this bead abacus stacker that I found at a friend's house on Friday night. I call this game Nimbicus.

Here are the rules I devised on the spot [1]: The frame contains 5 pegs of different height, each of which takes, 1, 2, 3, 4, or 5 balls. There are 15 balls in five colors, with 1, 2, 3, 4, or 5 balls in each color. The game starts with all of the balls off of the frame.

On your turn you must do ONE of the following: 1) Take as many balls as you like that are all the same color and put them all onto a single peg, or 2) Take exactly two balls of different colors and place them onto two different pegs.

The peg(s) must have room to accommodate the balls you selected. The peg(s) on which you place the balls can have other balls on it from any colors; you don't have to match the ball colors already on those pegs. When choosing the first option, you can take any number of balls you want of the same color; for instance, if there are four yellow balls, you can take 1, 2, 3, or all 4, as long as there is space on a a single peg to place them.

As in other nim games, the last player to play loses.

Analysis

There are only 15 balls, which makes this a very limited game. What complicates this is the varying color choices and limitations imposed by the spaces on the pegs.

Let's refer to the available balls at the start as (5,4,3,2,1) and the available frame spaces as [5,4,3,2,1]. As options disappear, we can ignore ball colors and spaces that have no available choices. So, for example, if there are three balls remaining in 2 colors, you can select (1), (2), or (1,1), but only if the frame spaces allow for these selections. If the remaining frame space is [3], you can't select (1,1). If the remaining frame space is [1,1,1], you can't select (2).

First Moves

For your first move, you have 25 choices for selection: 1 ball from (1), 1 ball from (2), 2 balls from (2), 1 ball from (3), etc up to 5 balls from (5): that's 15. You have 10 more choices for (1,1) from the 5 available colors. That's the selection.

Now you have to place the balls. If you chose (1)  (5 different possibilities), you have 5 choices for placing. That's 25 possibilities.
(2) (4 choices) x 4 placement possibilities = 16
(3) (3 choices) x 3 placements = 9
(4) (2 choices) x 2 placements = 4
(5) (1 choice) x 1 placement = 1
(1,1) (10 choices) x 10 placements = 100

Add it all together and you get a total of 155 options for your first move.

End Games

Let's work backwards, instead.

1 ball

You lose if it is your turn and there is one ball.

2 balls

You win if it is your turn and there are two balls. Place one on the frame, and now your opponent has 1 ball.

3 balls

There are nine options for 3 balls. In some configurations you can force a win, and in others you have lost.

StateBallsFrameWin/LossComments
3.1(3)[3]WinPlace (2), leaving your opponent with one ball.
3.2(3)[2,1]WinPlace (2), leaving your opponent with one ball.
3.3(3)[1,1,1]LossYou must place (1), leaving your opponent with two balls.
3.4(2,1)[3]WinPlace (2), leaving your opponent with one ball.
3.5(2,1)[2,1]WinPlace (2) or (1,1), leaving your opponent with one ball.
3.6(2,1)[1,1,1]WinPlace (1,1), leaving your opponent with one ball.
3.7(1,1,1)[3]LossYou must place (1), leaving your opponent with two balls.
3.8(1,1,1)[2,1]WinPlace (1,1), leaving your opponent with one ball.
3.9(1,1,1)[1,1,1]WinPlace (1,1), leaving your opponent with one ball.

4 balls

There are twenty five options for 4 balls. In some configurations you can force a win, and in others you have lost.


StateBallsFrameWin/LossComments
4.1(4)[4]WinPlace (3), leaving your opponent with one ball.
4.2(4)[3,1]WinPlace (3), leaving your opponent with one ball.
4.3(4)[2,2]LossIf you place (2), you leave your opponent with two balls. If you place (1), your opponent is left in state 3.5.
4.4(4)[2,1,1]WinPlace (1) in the [2], leaving your opponent in state 3.3.
4.5(4)[1,1,1,1]WinPlace (1), leaving your opponent in state 3.3.
4.6(3,1)[4]WinPlace (3), leaving your opponent with one ball.
4.7(3,1)[3,1]WinPlace (3), leaving your opponent with one ball.
4.8(3,1)[2,2]LossIf you place (2) or (1,1), you leave your opponent with two balls. If you place (1), your opponent is left either in state 3.2 or 3.5.
4.9(3,1)[2,1,1]WinPlace the single ball in [2], leaving your opponent in state 3.7.
4.10(3,1)[1,1,1,1]WinPlace the single ball, leaving your opponent in state 3.7.
4.11(2,2)[4]LossIf you place (1) or (2), your opponent places (2) or (1) respectively.
4.12(2,2)[3,1]LossIf you place (1), your opponent places (2). If you place (2) or (1,1), your opponent is left with two balls.
4.13(2,2)[2,2]LossIf you place (1), your opponent places (2). If you place (2) or (1,1), your opponent is left with two balls.
4.14(2,2)[2,1,1]LossIf you place (1), your opponent places (1,1) or (2). If you place (2) or (1,1), your opponent is left with 2 balls.
4.15(2,2)[1,1,1,1]LossIf you place (1), your opponent places (1,1). If you place (1,1), your opponent is left with 2 balls.
4.16(2,1,1)[4]WinPlace (1) from the (2), leaving your opponent in state 3.7.
4.17(2,1,1)[3,1]WinPlace (1) from the (2) in the [1], leaving your opponent in state 3.7.
4.18(2,1,1)[2,2]LossIf you place (2) or (1,1), you leave your opponent with two balls. If you place (1), your opponent is left in state 3.5 or 3.8.
4.19(2,1,1)[2,1,1]LossIf you place (1), your opponent places (1,1). If you place (2) or (1,1), you leave your opponent with two balls.
4.20(2,1,1)[1,1,1,1]LossIf you place (1), your opponent places (1,1). If you place (1,1), you leave your opponent with two balls.
4.21(1,1,1,1)[4]WinPlace (1), leaving your opponent in state 3.7.
4.22(1,1,1,1)[3,1]WinPlace (1) in the single spot, leaving your opponent in state 3.7.
4.23(1,1,1,1)[2,2]LossIf you place (1), your opponent places (1,1). If you place (2) or (1,1), you leave your opponent with two balls.
4.24(1,1,1,1)[2,1,1]LossIf you place (1), your opponent places (1,1). If you place (2) or (1,1), you leave your opponent with two balls.
4.25(1,1,1,1)[1,1,1,1]LossIf you place (1) or (1,1), your opponent places (1,1) or (1) respectively.

Note that you always lose if the frame configuration is [2,2] on your turn, and you always lose if you're left with (2,2) on your turn.

5 balls and more

There are 49 options for 5 balls. Things continue to grow, but slower, for more balls, since limitations on spaces and ball colors begin to apply. The whole thing is not terribly hard to work out with a computer, but it doesn't appear to be easy to figure out for humans, unless someone hands you the winning strategy.

Variants

I created the game after showing my daughter the Towers of Hanoi puzzle on this. It's not hard to add a number of twists to the game to change the challenge. For example, you could say that certain colors are not allowed to be placed next to or on top of (like Towers of Hanoi) other colors.

Yehuda


[1] I vaguely recall rules similar to these in other games I have played, so the idea isn't original, although I think the game is.

Thursday, January 22, 2015

How Much Money Did My Hybrid Car Save Me?

My old car was a 1996 Honda Civic. It averaged about 450 km on 40 liters of gas.

My new car is a 2010 Honda Insight. At my last fill-up, I filled 32 liters after 480 km. I've had the car (18 months) and I've driven 30,000 km.

In the last few years gas has averaged around 7.25 NIS a liter.

Today's math question is: How much money have I saved driving my new car?

Old car: 450 km on 40 liters is 11.25km/l
New car: 480 km on 32 liters is 15 km/l

So my new car has used approximately 2,000 liters in the last 18 months. At 7.25 NIS a liter that should be around 14,500 NIS.

My old car would have taken 2,666 liters to drive the same distance. At 7.25 NIS a liter, that would have been 19,333 NIS, for an estimated savings of 4,833 NIS. Cool, right?

Looking at my records, I spent 14,446 NIS on gas since I got the car (and actually drove a bit more than 30,000 km). That works out. But during the final 18 months that I drove my old car, I spent only 14,149 NIS on gas. I had the same job and lived in the same apt. The price of gas was about the same for the last 3 years. What happened?

I'm guessing that, with the expectation that my new car costs less to run, I made more trips. I went to see my son an extra time (he goes to school in the south). I went for shabbat to Jerusalem a few extra times. I had a steady girlfriend who lived in another city for a lot of that time, and that added a weekly trip.

You could say that I got more value from my car. When you spend a resource to get a service, you are not losing anything: you spend $1 of money to get $1 of service. In my new car, I spent about the same amount of money but I got more service - more value for the same money, right?

Still, I can't help feeling that something didn't work out here.

Sunday, October 21, 2012

Who Knows and Who's Guessing?

Suppose we take 128 people from all over the world and we give them a quiz with 7 true-false questions.

If all 128 people answer all 7 questions correctly, we would find it hard to imagine that all, or even most, of them guessed their way to the correct answers. It would be more likely that all of them found little difficulty in answering the questions correctly.

Similarly, if all 128 people answer all 7 questions incorrectly, we must suppose that none of them knew any of the answers.

Things get trickier if the answers come out in a bell curve, that is: 2 people answered either all 7 questions correctly or none correctly, 14 answered either 6 or 1 questions correctly, 42 answered 5 or 2 correctly, and 70 answered either 4 or 3 correctly. We could draw 1 of 2 conclusions from this: either the sample of people we chose represents a perfect sampling of knowledge vs ignorance, such that they were equally likely as not to know the answers, or that all of them chose answers at random and the result was a matter of pure luck.

There are some odd things to note about this. The first is how the results of some participants affect the evaluation of how well other, seemingly unrelated participants performed. If you got 6 answers correct under the bell curve scenario, it is impossible to know whether you know anything. You might have guessed on all of them. However, if it turns out that that guy from Nepal, who we originally thought answered only 1 question correctly actually answered all 7 correctly, the likelihood that you answered correctly based on actual knowledge rather than by random guessing goes up.

Then there is the problem of just which questions were the ones that were not answered correctly. Take question 1. If everyone got it right, the odds are that you knew the answer. If half got it right and half got it wrong, the odds are that you and everyone guessed. If you actually knew the answer, the distribution would, mathematically, have been slightly skewed more toward people getting the answer correct (by half an answer). The more people who answer the question correctly, the more likely it is that those people who got it correctly didn't do so by accident. However, if you're the only one who got it wrong, we have no idea if you didn't know the answer or if you guessed.

One of the most important things to note is that a bell distribution or its equivalent implies that some people will answer the answers correctly by accident. This is why there is no proof that a financial adviser, economist, and so on, who guesses right several times in a row about the economy or what have you has any idea about what they're doing ... if the other people who guessed had some right and some wrong. Or that a study or series of studies showing the benefit or ill-effect of something means anything, if you don't know out of how many unreported tests the results were taken (see here).

Monday, September 24, 2012

Jenga Math, Robotics, and the List of Editions

I was not the first to describe Jenga as a NIM like game. Fellow Israeli Uri Zwick also describes Jenga this way in his paper analyzing the mathematics of the game [PDF] and how to win it.

Jason Ziglar analyzes the mechanics of the game [PDF], namely each of the various possible ways of extracting the blocks.

A bunch of guys built a mobile robot that plays the game, described in a research paper.

Tsuneo Yoshikawa and others also tackle the robotic challenge with a robot that has multi-articulated fingers [PDF].

Meanwhile, Matthew South write an 82 page Master's thesis [PDF] on how to simulate the physics of Jenga real-time on the computer.

Official editions of Jenga? 44 so far (not counting Jenga-branded other games and items).

  1. Standard
  2. Blast
  3. Book Lovers
  4. Boston Red Sox
  5. Chicago Bears
  6. Chicago Cubs
  7. Chicago White Sox
  8. Coca-Cola
  9. Dallas Cowboys
  10. Detroit Tigers
  11. Donkey Kong
  12. Extreme
  13. Girl Talk
  14. Halloween
  15. Harley-Davidson
  16. Hello Kitty
  17. Holiday
  18. Jacks
  19. John Deere
  20. Kit Kat
  21. Las Vegas Casino
  22. Love
  23. Mark II
  24. New England Patriots
  25. New York Yankees
  26. Nightmare Before Christmas, The
  27. Oakland Riaders
  28. Ohio State University
  29. Onyx
  30. Party
  31. Philadelphia Eagles
  32. Philadelphia Phillies
  33. Pittsburgh Steelers
  34. Scrooge McDuck
  35. Spider Man
  36. Tarzan
  37. Throw 'n Go
  38. Transformers: Revenge of the Fallen
  39. Truth or Dare
  40. Ultimate
  41. University of Michigan
  42. University of Texas
  43. Winnie-the-Pooh
  44. XXL

Thursday, March 17, 2011

Fun Board Games to Enhance Students' Learning Experiences

The following is a guest post from Brian Jenkins

Playing board games is a great way for students to learn because children retain more information when they're having fun. Games get children motivated. Math and spelling won't induce boredom when they're integrated into fun games. By playing board games, children enhance their logic and reasoning skills, learn to solve problems, and gain skills in strategic thinking.

Kids also enhance their social skills while playing board games. They learn about following rules, taking turns, fairness, and how to graciously win and loose. Of course, gracious losing might kids some extra time to get the hang of!

Let's take a look at some of the best board games for young students:

Dino Math Tracks Place Value Game

This game has received the Oppenheim Toy Portfolio Gold Seal which is given to toys that enrich the lives of children. Players race around the game board with a pack of prehistoric pals. The game emphasizes the mathematical concept of place value and is a fun way for young students to learn addition and subtraction. The game includes multiple levels of play for children of different ages and abilities.

UPWORDS

UPWORDS is similar to Scrabble and exercises the same skills. However, it is easier to make words and score points because kids can stack onto existing words. Therefore, it's a better choice than Scrabble for younger kids. Also, the scoring system is simplified.

Primary Pups

This fun game integrates 1st through 3rd grade curricula. Players answer multiple choice questions from the following subject areas: Math, science, history, grammar, health, and geography. Students advance their puppies along the game board by correctly answering questions.

Flip 4

Flip 4 is designed for ages 8 to 12. It's a strategy game that teaches math and logical thinking and planning. Kids role the dice and then add, subtract, or multiply to land on board squares. Students try to strategically flip their opponents out of the game. The game received an Oppenheim Toy Portfolio Gold Award, a Dr. Toy Top 10 Game Award, and an iParenting Media Award.

Equate

This game is a mathematical version of Scrabble. Kids use tiles to make horizontal or vertical math equations. In addition to teaching kids how to add, subtract, multiply, and divide, the game requires kids to think strategically and creatively. Equate received a Parent's Choice Recommended Award, a Games Magazine Best Game award, and a Dr. Toy 100 Best Children's product award.

Word Pirates

It takes spelling and strategy skills to win this game. Kids try to be the fist player to reach the treasure by building a path of words and bridges. The game is designed for ages six and up and received a Creative Child Magazine Preferred Choice Award.

Have Kids Create Their Own Board Games

Besides playing with fun, educational games made by adults, let students have the opportunity to make their own games. Give them criteria to meet and allow them to use their creativity to develop a game. This is a great challenge for students!

Board games are a great way to break up the monotony of everyday classroom instruction. Fun and education is always a great combination!

Brian Jenkins writes feature articles, including pieces that offer career information for elementary school teachers, about a variety of different education and career topics for BrainTrack.com.

The opinions expressed in this post do not necessarily reflect the blog owner's.

Thursday, June 26, 2008

Dogs, Math, and Path Traversal

Every time I walk my dog, I like to take a different route. Here is my local neighborhood, showing the two or three block radius I walk around my house while walking the dog.

I start and return to my house. Aside from my house, I do not traverse the same vertex twice. The two vertices at either end of my short block count as my house for this purpose; after leaving one of them, if I hit either one of them, I go home.

I didn't think there were that many unique paths I could walk. Turns out I was wrong.

Path Traversal

Much has been written on graph theory and path traversal algorithms, including finding all paths through all nodes, the shortest path between two nodes, and so on. I couldn't find my exact problem using a quick google.

I want to know how many unique paths there are between two nodes, where paths cannot visit the same vertex twice. (A more complicated question would be where you cannot visit the same path segment twice.)

Here's a simple graph:



To get from A to B, there are 12 distinct paths you can take, without crossing the same vertex twice:
SSEE
SSENES
SSENNESS
SESE
SEES
SENESS
ESWSEE
ESSE
ESES
EESWWSEE
EESWSE
EESS
That's already more than the number of vertices, and equal to the number of path segments.

For a 2x2 grid, there are only 2 paths. For a 2x3, there are 4 paths. For 3x3 there are 12 paths. The number grows quickly:
2x2 = 2
3x3 = 12
4x4 = 184
5x5 = 8512
As I mentioned, if you can repeat vertices, but not paths, the number inflates much quicker:
2x2 = 2
3x3 = 16
4x4 = 800
5x5 = 323,632
Yowza.

My son, Saarya, wrote some basic code for this (I amended a little):

#include<iostream>
using namespace std;
#define N 5
#define M 5
int cnt,tx,ty,lev;
int mat[N][M];

void print()
{
for(int i=0;i<N;i++)
{
for(int j=0;j<M;j++) {
cout<<" ";
if(mat[i][j]<=9) {
cout<<0;
}
cout<<mat[i][j];
}
cout<<endl;
cout<<"\n";
}
cout<<"------------------------------\n";
}


void go(int x, int y)
{

mat[x][y]=++lev;

if(x==tx&&y==ty)
{/*print();*/
cnt++;
mat[x][y]=0;
lev=lev-1;
return;
}
if(y-1>=0&&!mat[x][y-1])
{
go(x,y-1);
}
if(x-1>=0&&!mat[x-1][y])
{
go(x-1,y);
}
if(y+1<M&&!mat[x][y+1])
{
go(x,y+1);
}
if(x+1<N&&!mat[x+1][y])
{
go(x+1,y);
}
mat[x][y]=0;
lev=lev-1;
}

int main()
{
for(int i=0;i<N;i++)
for(int j=0;j<M;j++)
mat[i][j]=0;
cnt=0;
tx=N-1;
ty=M-1;
go(0,0);
cout<<endl<<"-----------------------\n"<<cnt<<endl;
system("PAUSE");
}

For path segments, Saarya's approach is to add extra matrix elements for the paths between each vertex and move two spaces each move.

Which all means that I could walk the rest of my life with my dog in a couple block radius and never take the same path twice.

Yehuda