Sunday, December 30, 2007
Saturday, December 29, 2007
Game Theory in Las Vegas
I tried to use a bit of game theory to increase my odds when gambling in Vegas. Of course, I already know that the casinos have a house advantage so I wasn't surprised to see negative expected utilities when calculating the odds of a game. The rational choice would of course be not to gamble. Instead I just gambled a little.
After doing a bit of research on Wikipedia, some of the games with the worst odds are Keno and slot machines. However, these are the games I ended up playing. The games with better odds such as blackjack and roulettes had much higher minimum bets (especially compared to the one cent slots). Games which involve skill allow you minimize the house advantage.
Keno was slightly more interesting than slots because each casino had different paytables and specialty bets. You can choose bets with different payoffs and different probabilities of winning. I could calculate when one type of bet had a lower expected utility than another.
My brother came into Vegas with his own gambling strategy. Given a game with fifty-fifty odds and double payoff, his strategy was to continue doubling his bet until he wins. In the end, if he had an infinite amount of money to bet, this guarantees that he will win exactly the value of the first bet. For example: lose $1, lose $2, lose $4, win $8, profit=$1. However, with a finite amount of money to bet I tried to persuade him that the strategy does not make any sense. It is risking losing lots of money (with a low probability) and gaining a little (with a high probability). In the end this does not change your expected utility (which is zero for the game I described above). The strategy also doesn't make sense because of the concept of sunk cost. Once he loses money in previous games, it should not affect his future betting strategy. Despite my complaints he ended up making a profit o_o
Kevin Leyton-Brown gave an interesting guest lecture about game theory in my Cognitive Systems 300 class last year. Near the end of class we had several different types of auctions for $5 bills. He let us know that any profits would go to charity. I thought one of the auctions was particularly interesting in which the highest bidder would win the prize as normal but the second highest bidder would also have to pay their bid. This means as soon as there was more than two bids over $2.50 Kevin was guaranteed to make a profit on the $5 bill. I made bids over $2.50 even though I knew it wasn't an optimal strategy (it was for charity after all). Being the second highest bidder you are really tempted to outbid the highest in an attempt to win the prize and avoid a complete loss. Another guy in the class and I continued bidding against eachother until the bids actually got over $5. This means Kevin is getting over $10 for his $5 bill :). I eventually gave up and ended up being the second highest bidder. The highest bidder only lost a few cents while I lost over $5. I thought the auction was fascinating due to the temptation for the two highest bidders to continue outbidding eachother despite going over the actual value of the prize (let alone the optimal maximum of $2.50). I'll keep this auction in mind as a fun thing to try with my friends (except this time I will be the auctioneer).
After doing a bit of research on Wikipedia, some of the games with the worst odds are Keno and slot machines. However, these are the games I ended up playing. The games with better odds such as blackjack and roulettes had much higher minimum bets (especially compared to the one cent slots). Games which involve skill allow you minimize the house advantage.
Keno was slightly more interesting than slots because each casino had different paytables and specialty bets. You can choose bets with different payoffs and different probabilities of winning. I could calculate when one type of bet had a lower expected utility than another.
My brother came into Vegas with his own gambling strategy. Given a game with fifty-fifty odds and double payoff, his strategy was to continue doubling his bet until he wins. In the end, if he had an infinite amount of money to bet, this guarantees that he will win exactly the value of the first bet. For example: lose $1, lose $2, lose $4, win $8, profit=$1. However, with a finite amount of money to bet I tried to persuade him that the strategy does not make any sense. It is risking losing lots of money (with a low probability) and gaining a little (with a high probability). In the end this does not change your expected utility (which is zero for the game I described above). The strategy also doesn't make sense because of the concept of sunk cost. Once he loses money in previous games, it should not affect his future betting strategy. Despite my complaints he ended up making a profit o_o
Kevin Leyton-Brown gave an interesting guest lecture about game theory in my Cognitive Systems 300 class last year. Near the end of class we had several different types of auctions for $5 bills. He let us know that any profits would go to charity. I thought one of the auctions was particularly interesting in which the highest bidder would win the prize as normal but the second highest bidder would also have to pay their bid. This means as soon as there was more than two bids over $2.50 Kevin was guaranteed to make a profit on the $5 bill. I made bids over $2.50 even though I knew it wasn't an optimal strategy (it was for charity after all). Being the second highest bidder you are really tempted to outbid the highest in an attempt to win the prize and avoid a complete loss. Another guy in the class and I continued bidding against eachother until the bids actually got over $5. This means Kevin is getting over $10 for his $5 bill :). I eventually gave up and ended up being the second highest bidder. The highest bidder only lost a few cents while I lost over $5. I thought the auction was fascinating due to the temptation for the two highest bidders to continue outbidding eachother despite going over the actual value of the prize (let alone the optimal maximum of $2.50). I'll keep this auction in mind as a fun thing to try with my friends (except this time I will be the auctioneer).
Wednesday, December 26, 2007
Vegas
Pictures of my trip can be found here.
December 20:
I left from Vancouver to Las Vegas at 2pm. There was some severe turbulence on the descent into Vegas (enough to start some of the passengers screaming). In Vegas I met my brother, his wife, and her parents. There was a sandstorm when we were driving through town that night so that probably had something to do with the turbulence. The sandstorm was actually interesting to see since I have never been in one before. We were staying at a hotel called Harrah's which was right on The Strip. That night we went to Fremont Street. The massive display on the ceiling was very impressive. The slot machines I used on Fremont Street also turned out to be the only profitable gambling I did in Vegas.
December 21:
We started the day by going to the top of the Stratosphere. This is high enough that you can immediately feel a change in air pressure as you are riding up the elevator. It is way taller than any of the other buildings in Vegas so there are some amazing views. Our next destination was Hoover Dam. On the way there there was some authentic desert with cacti. The dam was a very impressive display of engineering. That night we had dinner at Sam's Town and saw a laser light show.
December 22:
I spent the morning sleeping in while everyone else went to the grand canyon. I had decided not to get tickets to go since it was very pricey. That afternoon we visited a few of the hotels and casinos along The Strip. Each hotel has very unique themes and shows in order to attract visitors. Two shows that I enjoyed were the fountains at the Bellagio and the volcano at the Mirage.
December 23:
We saw a car show in the morning and spent the rest of the day touring The Strip. That night we went to the best part of the trip for me - Cirque du Soliel. We went to Mystère at Treasure Island. This was by far the best circus I have ever seen. The music, theater, and performances combined perfectly to create a magical show. I was so impressed by the quality of it that I now want to see the other Cirque du Soliel shows in hope that they are as good.
December 24:
We went to a few more famous hotels and casinos along The Strip. My favorite building was the Luxor; an Egyption themed hotel/casino in the shape of a pyramid. The MGM had some lions on display. Some other cool places we saw were Caesar's Palace, Paris, New York, The Venetian, and Excalibur.
December 25:
We had a relaxing Christmas, mostly enjoying The Strip and playing some poker. Our hotel had an excellent buffet selection. It was almost overwhelming the number of different food options there were so I inevitably ended up eating way too much. I am fairly sure that I have gained a decent amount of weight in the last six days ;)
December 26:
I had to wake up at 4am to catch a very early flight. I was pleased to see that there was some snow when I returned to Vancouver. Waiting for me at my apartment was the PS2 lens I ordered. I spent about five hours working on the PS2. Although the lens was non-functional when I first installed it, I eventually got it to read original DVDs. It refuses to read any CDs or burnt DVDs however. At least it wasn't a total waste since I can now play a few games in my collection. The fact that it still isn't completely working implies that the lens was not the only problem.
For the rest of vacation I will be splitting my time between Robocup and CIspace. I am also playing the following games right now: Final Fantasy Tactics (on PSP), Grim Fandango, Unreal Tournament 3, and Crysis. Although these are all great games, the game I really want to play is Final Fantasy XII. That is why I have been putting so much effort into getting the PS2 working.
December 20:
I left from Vancouver to Las Vegas at 2pm. There was some severe turbulence on the descent into Vegas (enough to start some of the passengers screaming). In Vegas I met my brother, his wife, and her parents. There was a sandstorm when we were driving through town that night so that probably had something to do with the turbulence. The sandstorm was actually interesting to see since I have never been in one before. We were staying at a hotel called Harrah's which was right on The Strip. That night we went to Fremont Street. The massive display on the ceiling was very impressive. The slot machines I used on Fremont Street also turned out to be the only profitable gambling I did in Vegas.
December 21:
We started the day by going to the top of the Stratosphere. This is high enough that you can immediately feel a change in air pressure as you are riding up the elevator. It is way taller than any of the other buildings in Vegas so there are some amazing views. Our next destination was Hoover Dam. On the way there there was some authentic desert with cacti. The dam was a very impressive display of engineering. That night we had dinner at Sam's Town and saw a laser light show.
December 22:
I spent the morning sleeping in while everyone else went to the grand canyon. I had decided not to get tickets to go since it was very pricey. That afternoon we visited a few of the hotels and casinos along The Strip. Each hotel has very unique themes and shows in order to attract visitors. Two shows that I enjoyed were the fountains at the Bellagio and the volcano at the Mirage.
December 23:
We saw a car show in the morning and spent the rest of the day touring The Strip. That night we went to the best part of the trip for me - Cirque du Soliel. We went to Mystère at Treasure Island. This was by far the best circus I have ever seen. The music, theater, and performances combined perfectly to create a magical show. I was so impressed by the quality of it that I now want to see the other Cirque du Soliel shows in hope that they are as good.
December 24:
We went to a few more famous hotels and casinos along The Strip. My favorite building was the Luxor; an Egyption themed hotel/casino in the shape of a pyramid. The MGM had some lions on display. Some other cool places we saw were Caesar's Palace, Paris, New York, The Venetian, and Excalibur.
December 25:
We had a relaxing Christmas, mostly enjoying The Strip and playing some poker. Our hotel had an excellent buffet selection. It was almost overwhelming the number of different food options there were so I inevitably ended up eating way too much. I am fairly sure that I have gained a decent amount of weight in the last six days ;)
December 26:
I had to wake up at 4am to catch a very early flight. I was pleased to see that there was some snow when I returned to Vancouver. Waiting for me at my apartment was the PS2 lens I ordered. I spent about five hours working on the PS2. Although the lens was non-functional when I first installed it, I eventually got it to read original DVDs. It refuses to read any CDs or burnt DVDs however. At least it wasn't a total waste since I can now play a few games in my collection. The fact that it still isn't completely working implies that the lens was not the only problem.
For the rest of vacation I will be splitting my time between Robocup and CIspace. I am also playing the following games right now: Final Fantasy Tactics (on PSP), Grim Fandango, Unreal Tournament 3, and Crysis. Although these are all great games, the game I really want to play is Final Fantasy XII. That is why I have been putting so much effort into getting the PS2 working.
Thursday, December 20, 2007
Eyes
I found a cool webpage with a collection of detailed images of eyes. Its amazing how complex the patterns are and the amount of variation there is between different people.
I tried photographing my own eye but it turned out to be surprisingly difficult. Not only are reflections hard to avoid but my eye was half closed in most of the pictures:
I eventually got a picture with a full image of my iris and did some photoshoping to get this:
Not quite as interesting as the other eyes on the webpage :(
Wednesday, December 05, 2007
PS2 Frustration
I recently received my old PS2 and a fairly large collection of games shipped here from India. Shipping it here turned out to be a very bad plan. Despite the fact that it was packaged fairly securely, the CD spindle that the games were in was shattered. Luckily the CDs/DVDs were undamaged. However, when I tested the PS2 it would not read any discs. The memory card was also unreadable.
I have been struggling to find a way to fix the disc reader. After a combination of cleaning the laser lens (using alcohol and Q-tips) and cleaning the components which allow the lens to move to different locations on a disc, I have gotten it to reliably read audio CDs and PS2 CDs. It does not read PS2 DVDs or DVD movies however. I have been waiting over a year to play a certain DVD game.
Despite upcoming exams, I have spent several hours adjusting the lens alignment in an attempt to get it to read DVDs. There are many different alignment settings, and testing each setting requires assembling and disassembling the drive (to avoid hazardous laser radiation when the drive is powered up). Every time I make a minor adjustment a completely different set of sounds and vibrations are made when it tries to read a disc. None of the settings successfully read DVDs.
The cost of a replacement lens is $40. I am trying not to let the sunk cost of $67 for shipping the PS2 here play a factor in my decision. I am still not entirely sure if a replacement lens will fix the problem. Despite the fact that the amount of money that I have spent is approaching that of a brand new PS2, I have just finished ordering a new lens. I will post an update on whether it works when it arrives.
I have been struggling to find a way to fix the disc reader. After a combination of cleaning the laser lens (using alcohol and Q-tips) and cleaning the components which allow the lens to move to different locations on a disc, I have gotten it to reliably read audio CDs and PS2 CDs. It does not read PS2 DVDs or DVD movies however. I have been waiting over a year to play a certain DVD game.
Despite upcoming exams, I have spent several hours adjusting the lens alignment in an attempt to get it to read DVDs. There are many different alignment settings, and testing each setting requires assembling and disassembling the drive (to avoid hazardous laser radiation when the drive is powered up). Every time I make a minor adjustment a completely different set of sounds and vibrations are made when it tries to read a disc. None of the settings successfully read DVDs.
The cost of a replacement lens is $40. I am trying not to let the sunk cost of $67 for shipping the PS2 here play a factor in my decision. I am still not entirely sure if a replacement lens will fix the problem. Despite the fact that the amount of money that I have spent is approaching that of a brand new PS2, I have just finished ordering a new lens. I will post an update on whether it works when it arrives.
Monday, November 26, 2007
Thursday, November 15, 2007
Programming Contests
UBC dominated the regional ACM programming contest last weekend. The three teams placed first, second, and tenth (out of 76 teams). Here are some news articles about the event: [link] [link]
I am going to try to do some practicing over the next year to get ready for the next qualifiers. I think it would be a great experience to be on the team. This week I competed in two online contests (Google Code Jam and TopCoder). There are some really interesting problems in these contests. I feel like I can solve the majority of the problems, but the only problem is that I am extremely slow at doing so. It is really impressive to see the speed at which the top coders can create solutions.
I am going to try to do some practicing over the next year to get ready for the next qualifiers. I think it would be a great experience to be on the team. This week I competed in two online contests (Google Code Jam and TopCoder). There are some really interesting problems in these contests. I feel like I can solve the majority of the problems, but the only problem is that I am extremely slow at doing so. It is really impressive to see the speed at which the top coders can create solutions.
Thursday, October 25, 2007
Busy
This has been by far the busiest semester I have ever had. Four out of five of my courses have weekly assignments. I am close to getting through my midterms - the last one is tomorrow. Besides coursework, I have also gotten involved in some activities outside of class which take up a lot of time.
I have started volunteering at Thunderbird Robotics. I will be working on the AI for UBC's RoboCup entry. RoboCup is a robot soccer competition (we will be competing in the small size league).
I work about 8 hours a week on CIspace. Some recent major releases include the customizable applets section of the website and a new version of the Bayesian Network applet. The customizable applets allow you to choose which interface elements should be included in an applet and then embed it in a webpage. It should be helpful for creating tutorials about AI concepts. I am currently working on the robot navigation applet. I have added a RSS feed to CIspace so you can subscribe to keep track of the latest releases.
I have also been going to practices for the UBC ACM programming competition team. Every weekend there is a small practice contest between universities. We separate into small groups of 2-3 people and work on interesting (and frustrating) programming problems. There are usually around 7 problems to work on and the contests last about 3-5 hours. Waterloo seems to have very strong teams. UBC also does very well and seems to do better than Stanford. There are some incredible people on the team - its amazing to see how fast they can solve difficult problems.
I was also part of a team for vPortfolio. vPortfolio is a competition for creating a short video related to Computer Science. Unfortunately since I didn't have very much time to work on it (and neither did the other team members), we decided to forfeit.
There are some advantages to having a busy schedule. With less free time, I become much more selective at what I do for entertainment. This means I prioritize the highest quality entertainment first, saving myself many wasted hours of low quality entertainment I previously indulged in ^_^. I have still managed to get through several anime series, movies, and video games this semester however. I am currently enjoying the incredible video game compilation The Orange Box. Given how busy this semester has been, I worry about next semester in which I will be taking six extremely work intensive courses.
I have started volunteering at Thunderbird Robotics. I will be working on the AI for UBC's RoboCup entry. RoboCup is a robot soccer competition (we will be competing in the small size league).
I work about 8 hours a week on CIspace. Some recent major releases include the customizable applets section of the website and a new version of the Bayesian Network applet. The customizable applets allow you to choose which interface elements should be included in an applet and then embed it in a webpage. It should be helpful for creating tutorials about AI concepts. I am currently working on the robot navigation applet. I have added a RSS feed to CIspace so you can subscribe to keep track of the latest releases.
I have also been going to practices for the UBC ACM programming competition team. Every weekend there is a small practice contest between universities. We separate into small groups of 2-3 people and work on interesting (and frustrating) programming problems. There are usually around 7 problems to work on and the contests last about 3-5 hours. Waterloo seems to have very strong teams. UBC also does very well and seems to do better than Stanford. There are some incredible people on the team - its amazing to see how fast they can solve difficult problems.
I was also part of a team for vPortfolio. vPortfolio is a competition for creating a short video related to Computer Science. Unfortunately since I didn't have very much time to work on it (and neither did the other team members), we decided to forfeit.
There are some advantages to having a busy schedule. With less free time, I become much more selective at what I do for entertainment. This means I prioritize the highest quality entertainment first, saving myself many wasted hours of low quality entertainment I previously indulged in ^_^. I have still managed to get through several anime series, movies, and video games this semester however. I am currently enjoying the incredible video game compilation The Orange Box. Given how busy this semester has been, I worry about next semester in which I will be taking six extremely work intensive courses.
Wednesday, October 03, 2007
MSN Attacks!
For the last week I have been flooded with requests from random people I don't know to add me to their contact list. I find it unlikely that I have been infected with some sort of worm/virus since I use Linux. The people who try to add me are real and they seem just as confused as I am on why they added me to their list. I have started denying anyone who tries to add me, which is annoying since I can't tell which requests are legitimate.
Thursday, September 20, 2007
Last Lecture
I just watched a sad video of a Computer Science professor giving his last lecture. He is dying of pancreatic cancer and gave a presentation reflecting on his life.
Article: http://www.post-gazette.com/pg/07262/818671-85.stm
Here is a video of the lecture: http://www.cs.cmu.edu/front_im/pausch_9-18-07.wmv
Article: http://www.post-gazette.com/pg/07262/818671-85.stm
Here is a video of the lecture: http://www.cs.cmu.edu/front_im/pausch_9-18-07.wmv
Sunday, September 16, 2007
The Classics of Science Fiction
Here is a list of my favorite science fiction books and movies (only included works that were made before I was born):
Movies:
Blade Runner (1982) - This movie is one of the greatest science fiction films ever made. Everything about it comes together to form a fascinating universe combining many complex themes. If you are only going to watch one movie from this list, watch Blade Runner.
Solyaris (1972) - I regret watching the 2002 remake of this movie before the original. I actually really liked the remake when I saw it, but after seeing the original I know that the only reason I liked was because it was merely a glimpse at this incredible film.
Alien (1979) - Although I would consider this movie more of a horror/thriller than science fiction, it is still an excellent movie that deserves a place on this list.
2001: A Space Odyssey (1968) - It's unfortunate that humans haven't reached the level of technological development predicted in this film. An excellent novel by Arthur C. Clarke was released at the same time as the movie. The only thing stopping me from declaring this as my favorite sci-fi movie is that I didn't like the ending. In my opinion the movie would have been better off if it had ended at the discovery of the third monolith near Jupiter.
Stalker (1979) - This is an incredibly unique and bizarre movie. It may require some open-mindedness to watch because of its complexity and slow pace. However, it deals with many fascinating themes such as human psychology which really make the film rewarding.
Books:
Dune (Frank Herbert, 1965) - This is by far the best book I have ever read. It flawlessly combines culture, religion, technology, ecology, politics, and psychology into an unforgettable story. A movie, two mini-series, and numerous video games have been released based on the book, but none of them even come close to capturing the Dune universe.
Ender's Game (Orson Scott Card, 1985) - I am currently reading the third book in the Ender series. Given that I just started reading the series a little over a week ago, you can see that I have become so involved in the series that it has taken priority over homework.
Neuromancer (William Gibson, 1984) - This book has had a fairly large cultural impact. It popularized the term "cyberspace" and defined hacker culture long before the World Wide Web was even created.
Rendezvous With Rama (Arthur C Clarke, 1973) - Even though I was still in middle school the last time I read this, I still remember the entire plot of the series due to the fact that it was so interesting and original.
Foundation (Isaac Asimov, 1951) - The Foundation series involves an epic story about human civilization spanning over several hundred years.
Movies:
Blade Runner (1982) - This movie is one of the greatest science fiction films ever made. Everything about it comes together to form a fascinating universe combining many complex themes. If you are only going to watch one movie from this list, watch Blade Runner.
Solyaris (1972) - I regret watching the 2002 remake of this movie before the original. I actually really liked the remake when I saw it, but after seeing the original I know that the only reason I liked was because it was merely a glimpse at this incredible film.
Alien (1979) - Although I would consider this movie more of a horror/thriller than science fiction, it is still an excellent movie that deserves a place on this list.
2001: A Space Odyssey (1968) - It's unfortunate that humans haven't reached the level of technological development predicted in this film. An excellent novel by Arthur C. Clarke was released at the same time as the movie. The only thing stopping me from declaring this as my favorite sci-fi movie is that I didn't like the ending. In my opinion the movie would have been better off if it had ended at the discovery of the third monolith near Jupiter.
Stalker (1979) - This is an incredibly unique and bizarre movie. It may require some open-mindedness to watch because of its complexity and slow pace. However, it deals with many fascinating themes such as human psychology which really make the film rewarding.
Books:
Dune (Frank Herbert, 1965) - This is by far the best book I have ever read. It flawlessly combines culture, religion, technology, ecology, politics, and psychology into an unforgettable story. A movie, two mini-series, and numerous video games have been released based on the book, but none of them even come close to capturing the Dune universe.
Ender's Game (Orson Scott Card, 1985) - I am currently reading the third book in the Ender series. Given that I just started reading the series a little over a week ago, you can see that I have become so involved in the series that it has taken priority over homework.
Neuromancer (William Gibson, 1984) - This book has had a fairly large cultural impact. It popularized the term "cyberspace" and defined hacker culture long before the World Wide Web was even created.
Rendezvous With Rama (Arthur C Clarke, 1973) - Even though I was still in middle school the last time I read this, I still remember the entire plot of the series due to the fact that it was so interesting and original.
Foundation (Isaac Asimov, 1951) - The Foundation series involves an epic story about human civilization spanning over several hundred years.
Sunday, September 09, 2007
Mandelbrot Set
I spent the day making a Mandelbrot set fractal generator. Here is a link to the applet. I was originally hoping that it would be possible to have real-time zooming to allow convenient exploration of the fractal. However, since rendering each frame takes a significant amount of time, I gave up and just added a simpler zooming system.
It really is amazing the infinite complexity and beauty that arises from such a simple function. I spent at least an hour just exploring different parts of the fractal. I saw patterns which have never been seen before due its infinite complexity. I found it interesting that although you should be able to zoom in infinitely, there is actually a zoom limit in my applet due to the limitation of 64 bit double precision numbers. Here is an excellent documentary by Arthur C. Clarke about the Mandelbrot set.
Friday, September 07, 2007
Java Games
I recently made two simple Java games:
Ping:
Online applet
.jar file
This is a remake of a game I made in highschool [link]. It is based on the classic game Pong.
Swarm:
Online applet
.jar file
This actually started off as a little project I was working on to create emergent behaviors. After assigning a few simple rules to dots on the screen, the dots could actually interact with eachother in complex patterns. These are the rules which each dot follows:
- Move towards closest neighbor
- Move towards left mouse click (proportional to distance from click)
- Move away from right mouse click (proportional to distance from click)
- Move randomly
I thought it was interesting how the dots movement seemed similar to insect swarms. I then decided to make this into a simple game by adding worms which hunt down the dots. The user tries to control the dots to avoid the worms. I made the worms using Bézier curves and trigonometric functions. I had a few problems with the transition between the sin/cos functions (used to animate the worms wiggling), so occasionally a worm might have some strange movements ;)
(Note: the game is CPU intensive, so it might run slowly on older computers. It will probably run faster as an application from the .jar file than as an applet.)
Ping:
Online applet
.jar file
This is a remake of a game I made in highschool [link]. It is based on the classic game Pong.
Swarm:
Online applet
.jar file
This actually started off as a little project I was working on to create emergent behaviors. After assigning a few simple rules to dots on the screen, the dots could actually interact with eachother in complex patterns. These are the rules which each dot follows:
- Move towards closest neighbor
- Move towards left mouse click (proportional to distance from click)
- Move away from right mouse click (proportional to distance from click)
- Move randomly
I thought it was interesting how the dots movement seemed similar to insect swarms. I then decided to make this into a simple game by adding worms which hunt down the dots. The user tries to control the dots to avoid the worms. I made the worms using Bézier curves and trigonometric functions. I had a few problems with the transition between the sin/cos functions (used to animate the worms wiggling), so occasionally a worm might have some strange movements ;)
(Note: the game is CPU intensive, so it might run slowly on older computers. It will probably run faster as an application from the .jar file than as an applet.)
Monday, August 27, 2007
New Laptop!
I got a Gateway MT3705 for my birthday. So far I am really pleased with it. It has similar specs to my desktop (which is now over three years old) but was half its price. I have named the laptop Trillian. I am dual-booting Vista and Ubuntu on it. My only complaint so far is that audio isn't working at all under Linux. I found a thread full of people with the same problem - hopefully I will figure out how to get it working soon.
When I returned to my room with my new laptop in hand, I noticed my desktop was making a rattling noise. I narrowed the sound down to being produced by the video card fan. I tried to remove the video card, but the screw holding it in place was stuck. Trying to unscrew it with the tiny screwdriver I had gave me two really bad blisters. I went out, purchased a screwdriver with a better grip, and successfully removed the video card. After spraying the fan with some compressed air I returned it to the desktop. Unfortunately the computer then refused to boot. After running almost continuously for the last three years, my computer breaks down on the same day that I get the new laptop.
After randomly fiddling with the video card I actually got the computer booting again. However the fan has completely stopped, so I don't expect it to last for very long.
When I returned to my room with my new laptop in hand, I noticed my desktop was making a rattling noise. I narrowed the sound down to being produced by the video card fan. I tried to remove the video card, but the screw holding it in place was stuck. Trying to unscrew it with the tiny screwdriver I had gave me two really bad blisters. I went out, purchased a screwdriver with a better grip, and successfully removed the video card. After spraying the fan with some compressed air I returned it to the desktop. Unfortunately the computer then refused to boot. After running almost continuously for the last three years, my computer breaks down on the same day that I get the new laptop.
After randomly fiddling with the video card I actually got the computer booting again. However the fan has completely stopped, so I don't expect it to last for very long.
Saturday, August 25, 2007
Thursday, August 02, 2007
Fireworks
Last Saturday I went to the Celebration of Light fireworks festival. Definitely the best fireworks I have ever seen. There are four days of fireworks and each show is put on by a different country (Saturday was Canada's turn). I took lots of pictures and a short video.
I am currently taking my second week of vacation and enjoying Pender Island. Work has been going really well and I feel like I have been making some real progress on CIspace. I will be posting new versions of almost all the applets very soon. I have already started making plans for this Christmas vacation - I will be heading to South India.
I am currently taking my second week of vacation and enjoying Pender Island. Work has been going really well and I feel like I have been making some real progress on CIspace. I will be posting new versions of almost all the applets very soon. I have already started making plans for this Christmas vacation - I will be heading to South India.
Monday, July 23, 2007
UAI Conference
For the last four days I was attending the Uncertainty in Artificial Intelligence conference. I got free registration by volunteering to help out with the conference. I ended up staffing the registration desk for a few shifts as well as helping move some boxes. Not a bad deal for getting to attend interesting AI talks and eating lots of free conference food.
Most of the talks were actually very hard to follow. They dealt with advanced topics and assumed that the audience was already familiar with the concepts being discussed. I still enjoyed the talks however since there were some really interesting applications for the techniques being discussed. I probably also picked up some important AI terminology which should prove useful.
Most of the talks were actually very hard to follow. They dealt with advanced topics and assumed that the audience was already familiar with the concepts being discussed. I still enjoyed the talks however since there were some really interesting applications for the techniques being discussed. I probably also picked up some important AI terminology which should prove useful.
Tuesday, June 12, 2007
CIspace
After a month and a half of hard work, I have released new versions of the following CIspace applets:
I have been putting most of my effort into adding features for the neural network applet and the bayes applet. Depending on how progress goes, I should be able to release the new versions in a week or two. Some ideas we had for future CIspace projects included customizable inline applets, a new robot navigation applet, and a natural language processing applet using hidden Markov models.
I have really been enjoying working in the LCI lab. I get to attend a lot of interesting presentations about artificial intelligence. Hopefully I should be able to go to the upcoming AAAI conference (one of my supervisors is the president of AAAI!).
In other news, I have decided to spend a fifth year here at UBC and get a double major. I will be majoring in Computer Science and Cognitive Systems (Cognition and Brain stream). After I graduate I plan on attending graduate school (most likely in the U.S.).
- Search - Version 4.4.0
- CSP - Version 4.5.0
- Stochastic Local Search for CSP - Version 4.5.0
- Decision Tree - Version 4.3.0
- Deduction - Version 4.2.0
I have been putting most of my effort into adding features for the neural network applet and the bayes applet. Depending on how progress goes, I should be able to release the new versions in a week or two. Some ideas we had for future CIspace projects included customizable inline applets, a new robot navigation applet, and a natural language processing applet using hidden Markov models.
I have really been enjoying working in the LCI lab. I get to attend a lot of interesting presentations about artificial intelligence. Hopefully I should be able to go to the upcoming AAAI conference (one of my supervisors is the president of AAAI!).
In other news, I have decided to spend a fifth year here at UBC and get a double major. I will be majoring in Computer Science and Cognitive Systems (Cognition and Brain stream). After I graduate I plan on attending graduate school (most likely in the U.S.).
Sunday, June 10, 2007
Friday, June 08, 2007
In Celebration of Spork
Sunday, May 27, 2007
Penalty Box
Tuesday, May 08, 2007
Numbers
I am now the exclusive owner of the number 6D 37 00 22 9A 51 7D D7 5D 26 5B 75 2B 02 D2 6F. This number is mine and you are not allowed to know about it.
You too can claim a number (service may be unavailable due to the Slashdot effect).
"We own integers,
Says AACS LA.
You can own one too."
(C) 2007 Edward W. Felten
Saturday, April 28, 2007
Insanity
I just finished writing my formula sheet for CS320. I decided that instead of memorizing anything, it might save time if I just try to squeeze a semester of course work onto a single A4 piece of paper. Well... I ran out of room :(. It is now 1am and there are 11 hours left until the final. I better get back to studying.
Tuesday, April 24, 2007
Motivational Comics
Calvin offers his views on the world of academia:
... yes, I should really be studying right now since I have three exams within the next four days. Instead I find myself reading Calvin and Hobbes and learning how to play Go. I am actually proud of my progress learning Go since I can now beat the GNU Go artificial intelligence on its hardest difficulty level. I find that procrastination actually makes me more productive (except, of course, on the task I am procrastinating).
... yes, I should really be studying right now since I have three exams within the next four days. Instead I find myself reading Calvin and Hobbes and learning how to play Go. I am actually proud of my progress learning Go since I can now beat the GNU Go artificial intelligence on its hardest difficulty level. I find that procrastination actually makes me more productive (except, of course, on the task I am procrastinating).
Sunday, April 08, 2007
Easter Riddle
Since there was relatively low participation for my last riddle, the first person to correctly decode my Easter egg will win a mystery prize!
Saturday, April 07, 2007
Laptop Theft
I found out yesterday that Nath's laptop and passport were stolen while he was on the overnight bus from Banda Aceh to Medan. In an attempt to identify the thief, I decided that it would be helpful if I could log an IP address when the laptop connects to the Internet. The laptop is set to automatically log on to MSN, so I set up a buddy pounce to send a message as soon as the laptop connects. I don't think it is possible to trace an IP address directly through MSN because the packets travel through the MSN servers before heading towards their destination, so I set up the buddy pounce to send an irresistible URL to a webpage with a web tracker instead.
Today the thief actually logged onto MSN. The buddy pounce sent the link, and then he/she logged off a few seconds later. Unfortunately the thief did not take the bait, and didn't click on the link. I set up another buddy pounce just in case he/she decides to log on to MSN again, although I think that would be extremely unlikely. If I had succeeded in getting the IP address it probably would have been possible to track down the location of the connection... oh well :(
Today the thief actually logged onto MSN. The buddy pounce sent the link, and then he/she logged off a few seconds later. Unfortunately the thief did not take the bait, and didn't click on the link. I set up another buddy pounce just in case he/she decides to log on to MSN again, although I think that would be extremely unlikely. If I had succeeded in getting the IP address it probably would have been possible to track down the location of the connection... oh well :(
Thursday, March 29, 2007
Cryptomni Version 1.1 Released
Changes in this release include improved source code quality, as well as the ability to encrypt/decrypt multiple files from a single key file.
http://sourceforge.net/projects/cryptomni/
http://sourceforge.net/projects/cryptomni/
Tuesday, March 20, 2007
Crossing the Rubicon
For the last two weeks I have been contemplating what I consider to be the most important decision of my life. I have been offered an internship position at Microsoft, as well as a summer research position here at UBC. Both of the positions are related to artificial intelligence, but the Microsoft position will probably be more focused on software development. The research position will involve working on a program called CIspace (http://www.cs.ubc.ca/labs/lci/CIspace) funded by a NSERC USRA (Natural Sciences and Engineering Research Council of Canada Undergraduate Student Research Award).
To me this decision represents much more than just what I plan on doing this summer, but what I plan on doing for the rest of my life. On one hand I can do research on fascinating topics directly related to what I am interested in, but on the other I can start a career as a software developer with a much higher salary but work on something which I don't find as fulfilling. Choosing the Microsoft position would probably open many career opportunities within the software development industry, but I fear life as a code monkey will be stressful and unsatisfying. Today I was forced to choose between the two positions, and I have decided to go with CIspace. I really hope that I don't end up regretting this choice later in life.
To me this decision represents much more than just what I plan on doing this summer, but what I plan on doing for the rest of my life. On one hand I can do research on fascinating topics directly related to what I am interested in, but on the other I can start a career as a software developer with a much higher salary but work on something which I don't find as fulfilling. Choosing the Microsoft position would probably open many career opportunities within the software development industry, but I fear life as a code monkey will be stressful and unsatisfying. Today I was forced to choose between the two positions, and I have decided to go with CIspace. I really hope that I don't end up regretting this choice later in life.
Saturday, March 03, 2007
Windows Vista Business
Since I get a free copy of Windows Vista Business thanks to MSDNAA, I decided to install it on a partition this morning. I definitely think its an improvement over XP. The Aero interface looks awesome, and a lot of the features available in XP have been tweaked and improved. My only real complaint about it is the User Account Control, which displays an annoying dialog message requesting security permission way too often. I will continue to use Ubuntu as my main desktop environment, but may occasionally boot to Vista if I need to use software which doesn't run on Linux.
Cryptomni Version 1.0 Released
Cryptomni is a program which can encrypt and decrypt files using the one-time pad cipher. A key file is created using the cryptographically strong random number generator SecureRandom. If a key is truly random, kept secret, and never reused, this encryption algorithm can be proven to be unbreakable.
This project is hosted at SourceForge.net, and can be found at http://sourceforge.net/projects/cryptomni.
Tuesday, February 20, 2007
PDFTron Interview
I had an interview for a summer internship position with a local software company called PDFTron this morning. I think the interview went pretty well. There were some typical questions asking about my experience and job expectations, as well as some more technical questions involving programming concepts. They also gave me four programming tasks which I had to implement using C++ (writing out code on a piece of paper):
1) Write a function which converts a string to a positive integer. Ignore the '+' and '-' characters, return 0 if the string is empty, and return any interpreted digits if a non-numerical character is encountered. Here was my solution:
2) Swap positions of the nibbles in a byte:
3) Write a function which computes x to the power of n using O(log n) multiplications.
This has a recurrence relation of T(n) = T(⌊n/2⌋) + Θ(1) for n>=2 and T(n) = Θ(1) for n<2. T(n) is ∈ Θ(log n).
4) Implement a function which draws a line, given coordinates for a start point, coordinates for an end point, and a two dimensional array representing grayscale pixels (8 bits per pixel). I didn't get around to attempting this question since I ran out of time.
1) Write a function which converts a string to a positive integer. Ignore the '+' and '-' characters, return 0 if the string is empty, and return any interpreted digits if a non-numerical character is encountered. Here was my solution:
int atoi (char * string)
{
if (*string=='\0') return 0;
int value = 0;
while (*string!='\0')
{
if (*string=='0') value+=0;
else if (*string=='1') value++;
else if (*string=='2') value+=2;
else if (*string=='3') value+=3;
else if (*string=='4') value+=4;
else if (*string=='5') value+=5;
else if (*string=='6') value+=6;
else if (*string=='7') value+=7;
else if (*string=='8') value+=8;
else if (*string=='9') value+=9;
else if (*string=='+') value/=10;
else if (*string=='-') value/=10;
else return value/10;
value*=10;
string++;
}
return value/=10;
}
2) Swap positions of the nibbles in a byte:
char nibbleSwap (char byte)
{
char nibble1 = byte&0xF0;
char nibble2 = byte&0x0F;
return ((nibble1/16)|(nibble2*16));
}
3) Write a function which computes x to the power of n using O(log n) multiplications.
int power (int base, int n)
{
if (n == 0) return 1;
if (n == 1) return base;
int half = n/2;
int value = power(base, half);
if (n%2==0) return (value*value);
else return (value*value*base);
}
This has a recurrence relation of T(n) = T(⌊n/2⌋) + Θ(1) for n>=2 and T(n) = Θ(1) for n<2. T(n) is ∈ Θ(log n).
4) Implement a function which draws a line, given coordinates for a start point, coordinates for an end point, and a two dimensional array representing grayscale pixels (8 bits per pixel). I didn't get around to attempting this question since I ran out of time.
Tuesday, February 06, 2007
PlayStation Emulation
I recently installed custom firmware version 3.03 OE-A on my PSP (thanks Dark_AleX!). This allows nearly flawless PlayStation emulation without having to use the official PlayStation Network service for the PS3. I have been spending way too much time replaying FFVII instead of studying for my impending midterms...
Saturday, February 03, 2007
Robotics Conference
I spent the last two days attending the "Robotics for Society: New Directions in Cognitive Science" conference. It took place at Robson Square (downtown Vancouver). Invited speakers included:
James Little (UBC): Space for interaction with a robot
Gordon Cheng (ATR): Humanoid robotics perspective to neuroscience
Richard Vaughan (SFU): Assault and batteries: on the utility of robot aggression, competition and violence
Rodney Brooks (MIT): Robotics and everyday life
Alan Mackworth (UBC): You, robot, do no harm!
Hideki Kozima (NICT): A social robot in the wild world; practices in therapeutic and pedagogical applications
Stefan Schaal (USC): Computational motor control, humanoid robotics, and their societal relevance
Masaaki Honda (Waseda): Talking robot mimicking human speech production
Richard Rosenberg (UBC)
There were also various poster presentations outside of the theater. I found the conference very enjoyable because it provided exposure to a large variety of robots currently being researched and developed. My favorite presentation was by Rodney Brooks. Not only was he an excellent speaker, but he is also very well known in the field of robotics (I read a book by him in high school, as well as some of his research papers). He also founded the iRobot Corporation (well known for the Roomba robots). Unfortunately, attending the conference has put me way behind on my homework, so I am going to be spending the next 24 hours trying to catch up :(.
Friday, January 26, 2007
Mélange
High-definition Video:
I just acquired an amazing HD version of The Matrix. This is the first movie that I actually have to downscale in order to display on my monitor (its resolution is 1920x1080, while my monitor is only capable of 1280x1024). Here is a screenshot of the video playing in its original resolution, spanning across multiple desktops on my Beryl cube:
Mysterious Function Update:
It turns out that the graphs I made in my previous post were actually bifurcation diagrams of the logistic map. Wikipedia has a great explanation of the equation and how it is related to chaos theory.
Summer Internship:
I have been very busy looking around for summer internship positions. So far I have been applying to the big tech companies like Google, IBM, and HP. I am not very happy however, because most of these positions do not sound very interesting. I do not want to become a code monkey. What I really want is to be able to work on some interesting AI research. Unfortunately after examining the job market these sorts of positions seem to be rare. I also attended a career fair on Thursday, and applied for an internship position at Microsoft.
Das Experiment:
This afternoon I participated in a psychology study. It had the following experiment description: "This study will explore the manner in which an herbal extract, 'Salin', can affect memory." The experiment involved drinking a glass of iced tea flavored liquid, and then filling out some surveys. I soon realized that the forms were doing a terrible job at actually testing any of my memory skills, and I became suspicious. After handing in my forms the experimenter asked some questions - one of them being "did you notice anything unusual about the experimenter?" I answered no. He then let me know that he was actually a different person then the original experimenter. Half way through the study they actually switched people without me noticing. This was the real purpose of the experiment, to see how I reacted to a change that I didn't expect or consciously notice. The purpose of the forms was to determine if the switch might have had some sort of subconscious effect. The drink they gave me was a placebo. I wanted an actual memory enhancing drug!
Magic:
This evening I went to a magic show at Norm Theatre. I was disappointed since it seemed mediocre, and I knew how *every* trick performed actually worked. After the show they played the movie The Prestige. I think this was the best of the three big magic movies of 2006 (the other two being Scoop and The Illusionist). I thought the best aspect of the movie was its plot, and how it kept the viewer constantly guessing at how the magicians performed their feats.
I just acquired an amazing HD version of The Matrix. This is the first movie that I actually have to downscale in order to display on my monitor (its resolution is 1920x1080, while my monitor is only capable of 1280x1024). Here is a screenshot of the video playing in its original resolution, spanning across multiple desktops on my Beryl cube:
Mysterious Function Update:
It turns out that the graphs I made in my previous post were actually bifurcation diagrams of the logistic map. Wikipedia has a great explanation of the equation and how it is related to chaos theory.
Summer Internship:
I have been very busy looking around for summer internship positions. So far I have been applying to the big tech companies like Google, IBM, and HP. I am not very happy however, because most of these positions do not sound very interesting. I do not want to become a code monkey. What I really want is to be able to work on some interesting AI research. Unfortunately after examining the job market these sorts of positions seem to be rare. I also attended a career fair on Thursday, and applied for an internship position at Microsoft.
Das Experiment:
This afternoon I participated in a psychology study. It had the following experiment description: "This study will explore the manner in which an herbal extract, 'Salin', can affect memory." The experiment involved drinking a glass of iced tea flavored liquid, and then filling out some surveys. I soon realized that the forms were doing a terrible job at actually testing any of my memory skills, and I became suspicious. After handing in my forms the experimenter asked some questions - one of them being "did you notice anything unusual about the experimenter?" I answered no. He then let me know that he was actually a different person then the original experimenter. Half way through the study they actually switched people without me noticing. This was the real purpose of the experiment, to see how I reacted to a change that I didn't expect or consciously notice. The purpose of the forms was to determine if the switch might have had some sort of subconscious effect. The drink they gave me was a placebo. I wanted an actual memory enhancing drug!
Magic:
This evening I went to a magic show at Norm Theatre. I was disappointed since it seemed mediocre, and I knew how *every* trick performed actually worked. After the show they played the movie The Prestige. I think this was the best of the three big magic movies of 2006 (the other two being Scoop and The Illusionist). I thought the best aspect of the movie was its plot, and how it kept the viewer constantly guessing at how the magicians performed their feats.
Sunday, January 21, 2007
Mysterious Function
A few days ago in my COGS401 class our professor wrote a formula on the board. I hadn't been paying attention up until that point in the lecture, so I have no idea why he wrote the formula, or how it was related to psychology in any way. He seemed pretty excited about it however, so I wrote it down in my notebook:
Yi+1 = a * (1-Yi) * Yi
i+1 and i are both subscripts to the variable Y.
I just finished a small Java program to plot the formula to see what it looks like. 'Yi' is on the y-axis and 'a' is on the x-axis. My program could only plot the function between 1 < a < 4:
Here is 3.5 < a < 3.75:
and 3.75 < a < 4:
Very mysterious...
Yi+1 = a * (1-Yi) * Yi
i+1 and i are both subscripts to the variable Y.
I just finished a small Java program to plot the formula to see what it looks like. 'Yi' is on the y-axis and 'a' is on the x-axis. My program could only plot the function between 1 < a < 4:
Here is 3.5 < a < 3.75:
and 3.75 < a < 4:
Very mysterious...
Subscribe to:
Posts (Atom)