# Can you find an invisible cow with Wolfram Language?

Posted 10 years ago
15237 Views
|
|
11 Total Likes
|
 First things first - don't forget to have your sound on for this game.From time to time the Wolfram Language cow wanders the pages of Internet. Just very recently it visited our Community pages too  scroll down this discussion. And there is a chance that it will make its appearance again down this post  that is, if you can find itYesterday I opened my email and found this link: Find the Invisible Cow. So how does one go around writing a similar game in Wolfram Language? Well first, good news  we have a built-in cow  so we are almost done:ExampleData[{"Geometry3D", "Cow"}]And this is how we go about the rest of the thing. In Wolfram Language we can easily make all sorts of sounds. Lets do something musical. We will provide a few instruments and change the frequency of the notes depending on whether we are closer or far from the hidden invisible cow. The closer we are the higher the pitch. Proximity to cow is checked with EuclideanDistance function that measures distance between mouse pointer and some geometrical center of the cow. When we get closer than some radius the cow is revealed. The smaller the radius the harder the game  that is difficulty control. And when you find the cow, there is nothing that stops you from hitting Play Again  just dont go into an infinite loop ;-) Manipulate[    EmitSound[   Sound[SoundNote[Round[20 (1 - EuclideanDistance[p/.8, coo])], .5, in]]];    Overlay[{    Graphics[{}],    SetAlphaChannel[cow, If[EuclideanDistance[p/.8, coo] < ch, 1, 0, 0]]    }, Alignment -> coo], {{p, {0, 0}}, Locator}, "difficulty", {{ch, .1, ""}, .2, .005, Slider, ImageSize -> Small}, Delimiter, {{in, "Piano", ""}, {"Piano", "Organ", "Choir", "NewAge", "Accordion", "BaritoneSax", "Cello", "ElectricGuitar", "Sitar"}}, Button["Play Again", coo = RandomReal[{-1, 1}, 2]], ControlPlacement -> Left, Initialization :> (   coo = RandomReal[{-1, 1}, 2];   cow = Rasterize[ExampleData[{"Geometry3D", "Cow"}], ImageSize -> 110])]
Sort By:
Posted 10 years ago
 Suggest give use this name:  Cow of Duty: Ghost ?
Community posts can be styled and formatted using the Markdown syntax.