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
Trying to solve teasers when your dozed up on medication doesn't work
Trying to solve teasers when your dozed up on medication doesn't work
but another good one!
but another good one!
I didn't mean to put same comment twice... My bad!!
It's okay, I'll attribute the double post to the medication.
Is that Python?
I don't know Python, but it's probably pretty similar. I was just using generic human level language.
Really enjoyed as computer programming is one of my hobbies!
I have no idea at all what tis teaser is about. I am not computer savvy at all. I can do what my son has taught me and that is it. I let someone else figure out things like this.
Nice!
am going to age myself here, but the only language I ever learned to program in is BASIC. However, I guessed that the colour codes were for green and was able to solve it with no problem.
I suspect that many would-be solvers simply wigged out when they saw what looked like computer code, and didn't even try this one.
I had no idea how to solve this one; I am computer savvy but do not know the programming language; fun and challenging quiz anyway.
Hey thanks everybody for trying my teaser and for the nice comments. Congrats to those who solved it and sorry to those who couldn't make sense of it! I consider this mostly a logic problem, but it does require some trivial knowledge, so don't feel bad if you couldn't get it. Hopefully, after reading the answer/explanation, it makes sense; if not, that's a failure on my part.
Hard to solve after drinking. Actually, hard to solve if you don't know anything about whatever this is about.
I'm not savvy with computer languages apart from a little html, however I managed to solve the problem presented with logic.
It was fun thanks!
It was fun thanks!
Super easy, but very original and well thought out. Nice job!
Three years have passed, and no new comments. I worry about Braingle!
Anyway, if anyone cares, see my comment above. It still holds true.
Anyway, if anyone cares, see my comment above. It still holds true.
To post a comment, please create an account and sign in.
Follow Braingle!