alice in summerland

learning and teaching math in alice


The player hs just found his 5th set, and he has 74 seconds left to find more.

I began the day by adding some details (instructions, timer, etc.) to my SET world and also cleaned up the code and visuals, as you can see from the picture. Actually, as I just wrote the caption to that picture, I just got an idea that I might want to add on Monday: maybe when a player finds a set, he earns 5 or 10 more seconds or something. Right now everyone always has 100 seconds, but it could be cool if doing well would allow you to play longer.

The game is paused so that the player can read the instructions until he is ready.

Anyway, I did this set of instructions differently than for other worlds I’ve made. When the player clicks on the instructions, the game pauses for him to read the instructions, and he presses the red “close” button to exit the instructions and resume the game. In reality, the timer does keep going, but when he exits the instructions, we give the player back the time he has lost so it is essentially the same as stopping the timer (couldn’t actually stop it because the time elapsed function doesn’t account for that). One thing I haven’t yet accounted for is the possibility that there is no set. I know that in the real 81-set game, 20 is the most number of cards you can have on the table without a set, but I’m not sure how it works in this case. I would imagine, though, with half the deck (12/27) on the table, there must be a set. I was thinking about putting in a “deal” button to re-deal the cards if the player can’t find a set, but at this point I have no reason to believe that there wouldn’t be a set in 12 cards, so the kids should just look harder—it’s a mind game! Besides that minor detail, the game seems perfect and is up and running!

I can’t decide whether or not I should make a tutorial for this. I would obviously have to include a pretty hefty starting world—27 cards, 12 spots on the table, 27 events for when a card is clicked on, 27-item object array of cards, 27-item number array of corresponding numbers, 27-item String array of corresponding colors and 27-item String array of corresponding shapes. And that is just the minimum. There are some confusing things I did especially with the timer in the events section that might be a little difficult to understand for a middle schooler. Having such a comprehensive starting world might suck the fun out of programming the game since the kid wouldn’t have really done much himself, but it’s still a possibility. And if I do decide to follow through with the tutorial, I’ve already made the title page and decided I’ll name it “ready, SET, go!

After working on SET for a while, I decided I was ready to make my own deck of cards and start making some card games. After downloading all 52, perfectly cut out cards from Wikipedia, I created a world with all of the cards imported as billboards and corresponding world lists of the 52 cards, 52 corresponding numbers and 52 corresponding suits.

Player 1 will get this hand since a queen is woth more than a 5.

I then began writing one of the simplest card games out there: War. In the two-player game, each player starts out with 26 cards. In a seemingly never-ending cycle, each player puts out a card, and then the player who has the higher-numbered card gets to take both cards. If the players’ cards have the same numbers, then there is a “war” in which both players have to put out 3 more cards, and the player with the highest card on the top gets all of the cards. All of  this continues until one player has all 52 cards and the other thus has no cards left. It’s pretty easy to tell that this game lasts a really long time especially with the probabilistic rules of central tendency working in favor of the longer game.

The game is pretty much done, with the exception that there’s some animation in the case where there is a war that isn’t quite working out with the 3 cards that the players put out. Other than that, this game was pretty simple to write, though the code is still a little gross since we’re dealing with so many arrays. For example, when I shuffle and deal the cards, each player has a 26-item list of indices in the cards array that are his. So, whenever I want to refer to an item (let’s player 1’s 5th card) in the cards—or numbers or suits array (just realized I didn’t need a suits array…)—I have to choose the (first item in player 1 cards’ array)th item in the cumulative cards array. Other than these few things and some more exciting visuals and animation that I would want to add, this game is pretty much done too!

The fact that I have (almost) successfully made a card game means that I’ll probably be able to make others too in a similar way. The beauty of card games is that they already have their own rules. When rules are written for kids, these are essentially the same kind of rules we give then computer when programming, i.e. if player 1 has the bigger card, he gets both cards; if player 2 has the bigger card, he gets both cards; if neither has the bigger card then there’s a war and we compare again the same way. Short, simple and intuitive.

No comments yet»

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

<span>%d</span> bloggers like this: