Showing posts with label Fun Stuff. Show all posts
Showing posts with label Fun Stuff. Show all posts

Tuesday, August 27, 2013

The Lycurgus Cup

Several years ago, I visited the British Museum and took a pair of photographs of the Lycurgus Cup. The photographs are below:
The Lycurgus Cup.

The same artifact!

The two photographs depict the same object, but clearly the glass is of a different color in each photograph! This is due to special properties of the glass which scatters and reflects light differently. When light passes through the glass, the blue end of the spectrum is scattered to a greater degree, resulting in its normal red appearance. However, when light is reflected off the glass, the spectrum is reflected about equally, showing a green color.

Of course, the Lycurgus Cup is kept secure behind a wall of glass, which makes tampering with the lighting to create the color changes difficult. I managed to capture the color changes using a camera flash; the reflected light off the flash makes the Cup appear green. Signs of the flash can be seen in the first image above.

Wednesday, December 08, 2010

Google AI Challenge

For the past month or so I've been participating in the Google AI Challenge. The contest itself is quite interesting; you're supposed to write an AI to play a game similar to Galcon, and your bot will be pitted against other bots.

Now, the game is not quite as abstract, because what you're doing is moving ships around and attacking or defending; you can sort of explain or rationalize each move, or imagine some flavor or dramatic backstory to it. I find this to be good because you can actually do pretty well with heuristics or relatively simple decision rules.

Let me spend some time crowing about my bot, which I think did pretty well (446/4617 entries, or 90th percentile). To be honest, it's not all that elegant, being cobbled together from many generations of bots. The core algorithm is simple to describe: For each turn, each planet sends all (all!) its ships to attack a suitable target, which is determined by its distance, growth rate, owner, and number of defenders. There's also a simple defence algorithm in place to assist planets that are under siege, and a routine to expand optimally during the first turn. Surprisingly it did quite well, though I don't forsee it evolving further due to its limiting framework.

You can review some of the final matches at the bot's history page. Just click on "View Game" to view a game.

Sunday, October 31, 2010

A Tale of Madness

It was first reported in the papers of some minor nation, and even then it was treated as a matter of trifling importance; A man wielding two blood-soaked cleavers was seen walking down the major shopping district, muttering "This is a boring day."

What historical records remain note that his final words were "Tomorrow will be more exciting."

A lot of tomorrows later, there were many who looked similar to the Man. These creatures had a brain, 2 ears, a mouth and a pairs of eyes - furiously, furiously bloodshot. And in fervor they rampaged.

The world seemed doomed. They were everywhere. But one day, a solitary hero, one man by himself, stood up to these creatures. The final battle was in a large gorge. No one truly knows what happened, but it is rumored that a loud bellow was heard echoing from the valley.... "I LOVE PEACE !!!"

"REST IN PEACE MOTHERFUCKERS!"

A button was punched on an unimpressive looking outdated Nokia handphone. As a monophonic ringtone played, a flurry of warheads freed themselves from their respective pads scattered across the globe.

Then it rained drizzles of missiles and nuclear clouds bloomed everywhere one after another in the unfolding of the last day of Mankind of Earth.


Pilfered from a collaborative story with an incredibly insane inkblot.

Wednesday, May 26, 2010

Auction Game

I am keen on running a game that has some elements of game theory. The particulars of the game are described below.

The game is an auction game, where each player aims to end up with the most amount of money. The items to be auctioned are bundles of money. As with typical auctions, the highest bid win the auctioned bundle of money. However, there are two important differences. Firstly, the auction system is sealed-bid, meaning that each person places his bid in secret. Secondly, the auction is all-pay, meaning that everyone pays the amount they bid, regardless of whether they won anything. Hence, the auction is an all-pay sealed-bid first-price auction.

Thus, the rules are:

1) Each player starts with the same amount of money, S dollars.
2) The X bundles of money, and their denominations, are announced in advance.
3) Each player may place, secretly, up to one bid per bundle of money, so long as the sum of his bids is equal to or less than S. Each bid must be a positive integer.
4) Everyone pays an amount of money equal to amount they bid.
5) After each player has placed his bids, for each bundle of money, the person(s) with the highest bid(s) share the bundle of money equally.
6) Any remaining unclaimed bundles of money are forfeited.
7) The final score of each player is equal to the total amount of money he has; i.e., the sum of money won and money not spent during bidding.
8) The final score is used to rank the players in the game.
9) No communications are allowed between players before or during bidding.

An exception to rule 9 is that before the bidding begins, each player may issue at most one public statement, viewable to all players. The public statements are displayed on a first-post-first-displayed basis.

10) At any point before the bidding phase, each player is allowed to make at most one public statement which is viewable by all players. The public statement will be displayed immediately.

A trial run of the game is provided below.

Preparation Phase:

There are three players, A, B, and C competing. They have $10 each.

There are 4 items being auctioned. The items are:
#1: $3 note.
#2: $5 note.
#3: $5 note.
#4: $12 note.

Before the bidding begins, it is possible to make public statements. C makes a first public statement, “Hello, I love money.” Everyone is notified of C’s statement.

A also wishes to make a public statement, “I will not make any bids.” Everyone is notified of A’s statement.

B forfeits his right to make statements as he does not wish to make any statements.

Bidding Phase:

The bidding phase begins. Each player independently and secretly makes their bids for the items.

A bids $2 for item #2, $2 for item #3, and $6 for item #4.

B bids $10 for item #4.

C bids $2 for items #1, #2, #3 and #4.

After each player has submitted his bids, the bidding phase ends. Each player pays for his bids. A pays $10 for his bids, and he has $0 left over. B pays $10 for his bid, and he has $0 left over. C pays $8 for his bids, and he has $2 left over.

Settlement Phase:

It is time to settle the auctions, and compute the final scores. Item #1 is won by player C. Item #2 is won and shared by players A and C. Item #3 is won and shared between players A and C. Item #4 is won by player B.

Player A has $5 in the end.

Player B has $12 in the end.

Player C has $10 in the end.

Player B has the most money, and wins.

If there are any willing participants to try this game, please contact me by some means. I will post more details if/when there is sufficient interest.

Saturday, December 05, 2009

Smoking Extends Your Lifespan

It is commonly thought that smoking decreases your lifespan. However, our research has shown that this is untrue!

Long before cigarettes were invented for recreation, smoking was used to preserve food. Logic tells us that if smoke can preserve food, it can also preserve humans (since humans are also some form of food, as attested to by various cannibals and carnivorous predators). In fact, smoke is "an antimicrobial and antioxidant". Hence, by smoking, you will be less vulnerable to diseases and illnesses.

It is noted that a major weakness of smoking in preserving food is that "the smoke compounds adhere only to the outer surfaces of the food; smoke does not actually penetrate far into meat or fish". However, this problem is circumvented by cigarette smoking, since the smoke is directly inhaled into the body. It suffices to say that the health benefits of cigarette smoking are greatly increased over that of standing in a bonfire to be smoked.

In all, one should not be convinced by anti-smoking propaganda. The health benefits of smoking are obvious; in fact, samples of organs from deceased cigarette smokers are readily available for viewing, and the fine state of preservation of such organs should readily convince the agnostic as to the veracity of our claims.

Sunday, November 08, 2009

Rocket Science, Revisited

In a previous post, I suggested that it is better to run into a rocket than to run away from it. Recently, a friend pointed out a small oversight on the reasoning.

The oversight is relative velocity. Evidently, running into a rocket means that the rocket will hit you at a higher velocity as compared to when you are running away from the rocket. However, the original considerations on the rocket's acceleration are still valid.

The optimal solution seems to be to run towards the rocket, then to jump back with all your might an instant before the rocket hits you.

Saturday, October 24, 2009

Proofs of Arithmetic Progression

Challenge:

Find as many proofs of the arithmetic progression; i.e. prove 1 + 2 + 3 + 4 + ... + n = 0.5 * n * (n + 1)

I have thought of four proofs, as detailed below.


Proof 1: Proof by Pairing

We pair the first and last elements, then the second first and second last elements, and so on. Each pair will have the same sum, since the earlier element gains 1 while the later element loses 1. Now, divide any pair by half. If there are even number of elements, all elements will be paired, and since each pair is the same, the average is found by diving any pair by half. Now, if there are odd number of elements, the remaining element, lying in the center of the sequence, will have the same value as the half of any pair, and this also yields the average.

Having the average, the sum can be found by simply multiplying by the number of elements, which is n. Hence,

Sum = 0.5 * (first element + last element) * (number of elements)
==> Sum = 0.5 * (n + 1) * (n)


Proof 2: Proof by Mathematical Induction

Suppose that the sum for a sequence (1 + 2 + ... + n) is equal to 0.5 * n * (n + 1) for some value of n = k.

Then, for the sum of a sequence (1 + 2 + ... + (k +1)), we have:
Sum = (1 + 2 + ... + k) + (k + 1)
==> Sum = 0.5 * k * (k + 1) + (k + 1)
==> Sum = 0.5 * (k + 2) * (k + 1)
Hence, if the identity is valid for n = k, it is also valid for n = k+1.

Now, consider n = 1.
Sum = 0.5 * (1) * (1+1) = 1.
Hence, it is true for n=1 ==> true for all n.


Proof 3: Proof by Square

Consider the following image.
A (n+1) by (n+1) square can be broken up into three pieces; n + 1 unit squares, and two arithmetic progressions of (1 + 2 + ... + n). Using this relation,

(n + 1) ^ 2 = (n + 1) + 2 * Sum
==> Sum = 0.5 * ((n + 1) * (n + 1) - (n + 1))
==> Sum = 0.5 * (n) * (n + 1)


Proof 4: Proof by Triangle

Consider the following image.
A triangle of base (n+1) and height (n+1) can be obtained from an arithmetic sequence of of (1 + 2 + ... + n) by adding n + 1 triangles of 0.5 unit area. Using this idea,

Sum = o.5 * (n + 1) * (n + 1) - 0.5 * (n + 1)
==> Sum = 0.5 * (n) * (n + 1)


I hope that you have found this exercise to be entertaining.

Wednesday, October 14, 2009

Rocket Science

A random thought struck me today. In the scenario that a villain is armed with a rocket launcher, and is aiming at you, would it be better to charge forward, or move backward? Assume that no lateral movement is possible, and that the distance is sufficiently close such that the rocket will hit you in seconds at most.

My insight is that moving forward actually reduces the amount of damage you take (if you ignore the salient point that you are likely to die anyway). Note that a rocket is by definition powered. Hence, when in flight, it actually accelerates, which means that if you give it more distance, the rocket gains more speed! The rocket has now a higher kinetic energy on collision. Conversely, by moving forward, the rocket will hit you at a slightly slower speed.

This analysis is, however, not valid for non-powered devices, such as bullets. Bullets will only decelerate, hence it would be wiser to run away in such a case.

This post was inspired by some weapons in comics which gain speed with distance, which on further thought did not seem that improbable after all.

Saturday, December 13, 2008

The Amazing Tale of Intrigue


The wicked witch had run out of her supply of children and was feeling hungry. Due to the poor economic climate, buying children off the market was costly, and so the witch decided to do things the old way, which was to catch some.

After breaking off two large baskets of sweets from her candy house, the witch moved to the traditional kid-luring location. The efficacy of the bait amazed even herself, as a child lunged towards her before she even reached the location.

But it was not to be! The child was not prey, but predator! The brave blue boy stunned the witch with a leap attack, and carried off the two baskets of lures. The unprecedented attack shocked the witch - could this boy be the fabled witch-slaying hero? The witch recalled the many cases of mysterious witch-deaths, such as one dying after "accidentally" climbing into the kitchen oven, and another being crushed to death by a falling house.

No chances could be taken, the crone thought. Cackling, she took out a spell scroll, disguised as currency, from her purse. She started chanting the activation words, but the child-hero acted swiftly, using kungfu to interrupt the spell. He focused his internal energies into his palms and blasted the witch. The power of the spell and the energy blast mixed together, and neutralized each other.

Her spell neutralized, the witch had to use the last resort, which was also kungfu. She raised her palm to attack, but her actions were far too slow. The child-hero had the time to change his clothes, and to take out a hose and spray water over the witch. The witch writhed in pain, as all witches were weak to water. One notable relative living in the west was even slain by immersion.

The child-hero took the witch back to the secret headquarters for interrogation. This move would prove to be a mistake, since there was a secret double agent in the organization. The boy was caught unawares by a sneak attack and was defeated.

The witch took the boy back to her candy home, where she intended to cook the boy. Unexpectedly, a deus ex machina happened, and a taxi popped out from empty space. Riding inside it was Captain Mustache, one of the most famous superheroes in the world. The greatest battle of the century was about to begin...

Friday, September 26, 2008

Time Traveler Verification Experiment Unveiled

Now, I shall unveil the experiment!

All time travelers, please post a comment stating that you are a time traveler under the post titled "Time Traveler Verification Experiment". You should post the comment anytime before this post (the one that you are now reading) comes up. Yes, you need to use a time machine to return a few days back to post the comment.

For the rest of the ordinary non-time traveling folks, here's what I did - I wrote this post 1 week ago, but I set the post to auto-appear only now. Only time travelers can comply with my set of instructions (by virtue of their time travel devices), since ordinary folk would read the instructions too late.

Of course, this is a pretty lousy way of verifying the status of a time traveler. The more evident way is to ask for a set of lottery numbers. Still, it makes some use of the feature of future-posting.

Friday, September 19, 2008

Time Traveler Verification Experiment

All time travelers take note! I have devised and begun an experiment that can verify that you are indeed a time traveler.

In one week's time, we shall see how many true time travelers have come forward. Til then, the details of the experiment will be kept hidden, although if you are a time traveler you can ostensibly jump forward and sneak a peek.

Monday, August 04, 2008

Spot the Mistakes

Spot the mistakes in the following map.



In spite of the mistakes, I still find the entire piece of mapping work amazing, since apparently they mapped the whole of Singapore within a short period of time.

Tuesday, April 29, 2008

First Divine Skill Under Heaven

Recently, while I was walking on the street, I met an incredibly skilled pugilist. The pugilist was dressed in rags and had unkempt hair. He was clearly from the Beggar Sect, Bukit Panjang Branch. Perhaps he was even the leader of the preeminent Sect.

The pugilist stared at me, and then spoke, "To that young hero over there, I observe that you have the bone structure of a martial arts genius which is only seen once every 1000 years ! It will be a pity if you do not practice martial arts and uphold justice ! Let me transfer all my skills and internal power to you !!!".

After speaking, he grabbed me, and transferred his internal power to me. After the process was complete, the man laughed loudly, and said, "Now I have transferred all my internal power to you ! Don't underestimate this power, for I myself received all the internal power of my master, who received all the internal power of his master !!! You are now very powerful, powerful enough to defeat 2 pugilists !"

I remarked that 2 was a seemingly low number for the combined internal power of 3 generations of experts. Perhaps they were quite lousy in combat. That would also explain why they were beggars.

The master sighed, shaking his head. "You do not understand, young hero. The power transference skill is not perfect ! As power transference goes against the natural laws of the world, only 50% of the internal power is transfered, and the rest wasted ! Hence, even though power transference is an amazing skill, ultimately the maximum power attainable has an upper ceiling."

"Consider a pugilist of generation n + 1. Assuming that he is an average pugilist, his total power, X(n+1), will be X(n+1) = 1 + r * X(n), where r is the percentage of internal power transferred. For the pugilist of generation n, his power is X(n) = 1 + r * X(n-1).

Hence, the power of the pugilist in generation n + 1 is:
X(n+1) = r * ( 1 + r * X(n -1)) + 1 = (r^2) X(n-1) + r + 1

Continuing the process until the original pugilist, X(0),
X(n+1) = (r^(n+1))*X(0) + (1-r^(n+2))/(1-r)
Assuming that there are many many generations, or n large, and since r less than 1, hence,
X(n+1) = 1 / (1-r)
Since my Sect's energy transference skill transfers power at 50% loss, the power of a pugilist (assuming he trains) is 2 !"

After explaining the situation to me, the pugilist fell over and died. I was slightly saddened, since I had lost a comrade in upholding justice.

Not all was lost, however. I discovered a secret manual hidden in his rags. The manual was titled, "First Divine Skill Under Heaven", which arguably meant that it was either the most powerful skill in the world, or (inclusive or) that it was the most primitive skill in the world.

In order to ensure that everyone is also able to uphold justice, I'm sharing part of the manual here.

Manual for the First Divine Skill Under Heaven



Note : I really think that for power transference skills, there should be an attenuation factor, otherwise everyone would be extremely powerful after a few generations.

Friday, April 25, 2008

Secret Research Project 1: Interesting Facts

Now that the research report has been completed and submitted, I have some time to share some interesting facts about the research.

  1. When people ask what I do for my secret research, I say I download images of apples, bananas, irons, scientific calculators, suitcases, crayons, dustbins, pears, plastic bottles, tissue boxes, forks, spoons, laptops, clocks, pillows and blenders.
  2. I now possess a large collection of images of apples, bananas, irons, scientific calculators, suitcases, crayons, dustbins, pears, plastic bottles, tissue boxes, forks, spoons, laptops, clocks, pillows and blenders. Much time was spent to collect and download these images.
  3. For the preliminary versions of the classifier, the classifier achieved a classification rate of 70%. Coincidentally, the training set consisted of 70% natural images and 30% synthetic images.
  4. For the uninformed, point 3 was a consequence of the classifier labeling everything as a natural image, hence achieving a 70% performance. This approach is excellent. By increasing the set of natural images to 99%, the performance can be boosted to 99% !
  5. Point 4 was a joke.
  6. The trusty Microsoft Paint was used to perform many tasks for the project. These tasks include converting GIF, PNG, and BMP images into JPEG format, and creating diagrams for the final report.
  7. Two computers were used for the project. The project could be run exclusively on either the desktop or the laptop computer, but using two computers greatly increase rate of work.
  8. The increase in rate of work was not due to being able to run multiple simulations simultaneously. Rather, the simulations were mostly done on one computer (the laptop), while the other (the desktop) was used for net research and report writing. Useful work was done on the desktop while the MATLAB program ran on the laptop.
  9. Using two computers was also cool for report writing. All the data and related papers were displayed on the laptop screen, while the desktop ran only Word. Information could be directly read from the laptop and entered into the report without ALT-TABBING and changing windows constantly.
  10. I want a dual monitor setup after learning the advantages of point 9.
  11. I want a dual core system to be able to run my (hypothetical) dual monitor system properly without lagging. This is also to make running simulations less of a pain.
  12. MATLAB should perform some checks on code integrity before running. Many times, MATLAB would return an error after it had run much of the simulation processing. The error was a simple formatting error located at the last few lines of the code.
More information on the image classifier will be released if anyone is interested.

Sunday, June 03, 2007

Meta-review

Fans of unconventional fiction would be pleased to learn of a novel piece of writing, cleverly titled Meta-review. As the title suggests, the manuscript is disguised in the form of a review. Beyond that disguise, however, lies a pot of creative gold.

The entire concept of Meta-review lies in the idea of self-reference. It is not merely a review, which by itself would be mundane by any standards. Rather, it is a review of a review of a review of a ... And yes, you guessed it, it is a review of itself. The subject of Meta-review IS Meta-review.

While self-reference may seem like a confounding subject for any literary work, the author manages to tie all the strings together to form a cogent and thought-provoking read. In particular, many parts of the article will surely catch the mind's eye; One especially colourful example was when Meta-review suddenly changed the colour of the text just as it was making reference to the change of colour. This unexpected case of self-reference definitely made the writing appear more vivid.

However, the most amazing line in Meta-review is not that, but the sentence highlighted (in green) below. What a mind-boggling existential paradox!

Beyond the perplexing genius of the self-referential device, however, Meta-review also suffers from a number of non-critical flaws. The most glaring is a lack of proper editing, which is apparent in a misspelling inside a quote, which we have reproduced below.
The mispeling.
What makes things worse is that the entire paragraph containing the misspelling was superfluous, and could have been removed without affecting the contents of the article.

Another weakness, and one which is more serious, is that when under the guise of a review, Meta-review criticized the reviewed article for committing Tu quoque, when in fact, Meta-review was also guilty of making the same error. What was particularly distasteful was Meta-review's harsh denouncement of the error - such hypocritical behaviour should definitely be condemned.

All in all, Meta-review is an interesting and unique work that should be read by all readers of this review. Meta-review can be read by clicking on this hyperlink.