Brain Teasers
Programmatic Phrase
Find the common phrase that is represented by the following computer program code. Some amount of computer programming knowledge will help, as certain programming conventions are used. However, it may be solved without, as it is written in a very high-level (i.e., human-like) language.
Begin
yourLocation = 50
fenceLocation = 100
For Each BladeOfGrass
{
If itsLocation > 100
Then itsColor = #009900
Else itsColor = #007700
}
End
Begin
yourLocation = 50
fenceLocation = 100
For Each BladeOfGrass
{
If itsLocation > 100
Then itsColor = #009900
Else itsColor = #007700
}
End
Hint
#007700 is the hexadecimal color code of a green shade, and #009900 is that of a somewhat brighter green.Answer
"The grass is always greener on the other side."The location values are given for one dimension only, and since you are at 50, and the fence is at 100, any location less than 100 is "on your side" of the fence, and any location greater than 100 is "on the other side" of the fence. The program scans the location data of every blade of grass, and sets all that are on your side to one shade of green, and all others (those on the other side) to a brighter shade of green.
Hide Hint Show Hint Hide Answer Show Answer
What Next?
View a Similar Brain Teaser...
If you become a registered user you can vote on this brain teaser, keep track of which ones you have seen, and even make your own.
Solve a Puzzle
Comments hidden to avoid spoilers.
Follow Braingle!