Skip to main content

Posts

Showing posts with the label game

Word Puzzle

I'm thinking of two common English words, W1 and W2. W1 is half as long as W2, but has twice the syllables. When combined, the two words form a phrase that can be used to refer to a nonspecific stage of a meal. The letters in these two words can be rearranged to form two new common words: W3, and W4. W3 is half as long as W4, and it also has half the syllables. The two words, when combined, may be used when telling somebody to draw with a certain art medium. What are all four words? New posts every month - subscribe for free !

Which Hurts More?

212° F Let's play a little game. I'll list a bunch of possible actions. Each action will have 2 variations, (a) and (b). You choose either (a) or (b), depending on which would be safer (or less painful). Each of the questions will involve an oven hot enough to bake a cake (350° F), and a pot of boiling water (assume we're at sea level). So... would you rather: 1.     (a) Stick your hand in the oven     (b) Stick your hand in the boiling water   ... for a period of 10 seconds 2.     (a) Leave a fork in the oven     (b) Leave a fork in boiling water   ... for a period of 15 minutes. Then hold the fork tight with your bare hand. 3. Fill a jar to the top with cool tap water. Then:    (a) Place the jar in the oven    (b) Place the jar in the boiling water   ... for a specific, but unknown, period of time. Then remove the jar and put your hand in it. First see if you can figure these out yourself. They shouldn't be too...

Online Snake Game

This is a simple Snake video game I wrote over the past few days. For the graphics, I used my Firetools.js library, which I also mentioned in my Pong post. To play the game, use the arrow keys on the keyboard (you might need to click on the game to give it focus). The world loops, so you can go out one side of the screen and come in the other. Eat 50 green pellets to win the game. Each time you eat a pellet, you will get longer and your score will go up; the longer you are, the more points you get for each pellet. If you don't eat enough pellets, you'll begin to starve, and get shorter. Cherries make you longer, but do not prevent starvation. I did not add the ability to track high scores, but I might add that feature later on. Meanwhile, you can post your scores in the comments. Have fun! New posts every month - subscribe for free !

Internet Pong Game

Here's a program I wrote earlier this year in July. It's a two-player pong game that involves communicating over the internet using Firebase. As I wrote this program, I also wrote a JavaScript library to take care of graphics and data communication over the internet. The library took the most work; the pong program just required some math and some creativity to help solve the problems I ran into... such as how the two computers would figure out who gets the top paddle and who gets the bottom paddle. To play the game, you'll need to send the URL to one of your friends (otherwise you won't have an opponent). Move your paddle (the white one) using the arrow keys, and click "Reset" to start over. The ball will bounce to the left or to the right depending on where it hits the paddle – you can use this to your advantage. And forgive the glitches; the computers are communicating over the internet, so it's not going to be perfect. Have fun! New posts every month ...

Khan Academy

In this post, I'll tell you about a really cool new site I found: Khan Academy. Khan Academy is basically a bunch of free tutorials for school subjects like mathematics, history, science, and just about anything else. And not only that, but they also have a special practice page that offers exercises, and when you complete enough of them you get points. And here's one of my favorite things about it: they have a special section just for computer science, so I can write programs (mostly video games), and everybody else can see and play them. So far I've only written one program, but it's pretty good for my first (even though it's not finished yet). But one of the coolest things about that programming feature is that you can embed the program on a web page: Super Ball Another nice thing is the badges you get for accomplishing certain things. There are 6 types: meteorite, moon, earth, sun, black hole, and challenge. The easiest to get are the meteorites, and the hardest...

Guess the Details

Here are some pictures I took. See if you can guess some things about the photos: Approximately what time of day the photo was taken at, or if it's computer-generated Which parts of the photo were computer-generated, if any The season (for outdoor photos) To view the images better, click on one. I'll give answers later. House Crayons Calendar Blue Moon Weeds and Grass

"Flipping Quarters" Solution

A couple of pieces of good news: First, in this post will be the answer to the problem I gave called Flipping Quarters ; and second, I'll even work through the solution! We have to figure out the average amount of money that the man pays you, minus $5. To start out, let's forget about the money and look at the actual coin flipping. Since it's about as likely for the coin to give tails as it is to give heads, you would get heads 50% of the time. So on your 1st flip, there's a 50% chance you'll get heads - a 50% chance that you'll have to stop. What is the chance that you'll have to stop immediately after the 2nd flip? There's a 50% chance that you will actually get to the 2nd flip, and a 50% chance that you'll flip heads on it. Multiply those numbers, and you get 25%. Look at the diagram to the right if you don't understand. Now for the 3rd flip: there's a 25% chance there will be one (because you got tails on the 2nd flip), and a 50% chance y...

Flipping Quarters

Here's an interesting puzzle involving chance: A man in a park asks you to play a game with him. It's a form of gambling. To play, you must pay the man $5, then flip a coin repeatedly until you get heads. As soon as you get heads, you stop flipping. If you only flipped the quarter once, he'll give you $1. If you flipped it twice, you get $2. Three times, $4. Four times, $8. Each extra flip gets you twice as much money, so the longer it takes before you get tails, the more money you get. Should you play, if you have a lot of time and the man will play as many games as you want? How much money, on average, would you gain (subtracting the $5 fee)? I will give the solution in a later post .