Thursday, February 21, 2008

Codidioms : Take a guess

Guess the following Codidioms (Code + Idioms) :

// Idiom 1
var location = getLocation();
if (location == 'rome') {
do( location.getCitizen() );
}


// Idiom 2
injury += insult;

// Idiom 3
if (bird[1].feather == bird[2].feather) {
bird[1].flock(bird[2]);
}

// Idiom 4
a = getThickness('blood');
b = getThickness('water');
assert(a > b);

// Idiom 5
a_spade_a_spade();

// Idiom 6
take(salt * .01);

// Idiom 7
if (i == 2) {
tango();
}

// Idiom 8
function tunnel() {
var dark;
for (i = 0; i < 10; i++) {
dark = true;
}
dark = !dark;
return dark;
}

// Idiom 9
if ( monkey.inLineOfSight(it.x, it.y) ) monkey.do(it);

// Idiom 10
return way.my || way.high;

// Idiom 11
function getGain(pain) {
return pain >= 1;
}

// Idiom 12
if (cooks >= 3) {
broth = null;
}

// Idiom 13
if (a != 'cake') a.eat();

// Idiom 14
days = 365;
for (day = 1; day <= days; day++) {
if ( random(0,100) <= 50 ) apple++;
}
if (apple <= days) doctor();


(Found this here)

1 comment:

manian_pbs said...

2: adding insult to injury
4: blood is thicker than water
6: take a pinch of alt
12: too many cooks spoil the broth
14: an apple a day keeps the doctor away
5: call a spade a spade
1:When in Rome, do as the Romans do
3:Birds of a feather flock together
7:it takes two to tango
8:light at the end of the tunnel
11: no pain no gain

hi did this with a help from Larry & Sergey :) :D Just searches for phrases in the code