Where's Waldo?

Here’s a more playful script…

This app will create a new folder named “Waldo” on your desktop, show it to you, then move it to the top level of some folder in your home directory (e.g., ~/Pictures). You then have 30 seconds to find it. If successful, you will advance to the next level which just means you have 5 less seconds to find Waldo. You can save the script below as an application and just double-click it from the Finder to start the game.

The only problem I see with it is if you have a folder named Waldo somewhere in your home directory but even then, you should get an error if the script tries to move the Waldo folder from your desktop to the same folder where the pre-existing Waldo already lives. If a folder named Waldo already exists on your desktop, you’ll get an error when it tries to create the original folder.

OS version: OS X

set home_folder to (path to "cusr") as string

tell application "Finder"
	set the_level to 0
	set the_timer to 35
	set advance_to_next_level to true
	repeat
		if advance_to_next_level = true then
			set the_level to (the_level + 1)
			set the_timer to (the_timer - 5)
			if the_level = 7 then
				set the_level to 6
				set the_timer to 5
			end if
		end if
		activate
		set visible of (every process whose visible = true and frontmost = false) to false
		close every Finder window
		set the_location to (home_folder & (some item of (get name of every folder of folder home_folder)) & ":")
		set Waldo to (make new folder at desktop with properties {name:"Waldo"}) as alias
		select Waldo
		open selection
		set the_button to button returned of (display dialog "See this folder? I'm about to hide it somewhere in your home directory. You are on level " & the_level & " and have " & the_timer & " seconds to find it. Ready?" buttons {"Quit", "Hide It!"} default button 2 with icon 1)
		if the_button = "Quit" then
			close every Finder window
			delete Waldo
			display dialog "Thanks for playing, hope you had fun!" buttons {"Goodbye!"} default button 1 with icon 1 giving up after 10
			return
		else
			close every Finder window
			move Waldo to folder the_location
			set start_time to (current date)
			set the_message to ""
			repeat
				set chosen_folder to (choose folder with prompt (the_message & "Find Waldo:")) as string
				set end_time to (current date) - start_time
				if chosen_folder = (the_location & "Waldo:") then
					if end_time < the_timer then
						set the_response to "Congratulations! You found Waldo in less than " & the_timer & " seconds!"
						set advance_to_next_level to true
					else
						set the_response to "Oooh! You found Waldo but it took more than " & the_timer & " seconds!"
						set advance_to_next_level to false
					end if
					exit repeat
				else
					if end_time > the_timer then
						set the_response to "Oooh! You didn't find Waldo and your time is up! (He was hiding in " & the_location & ".)"
						set advance_to_next_level to false
						exit repeat
					end if
				end if
				set the_message to "Nope, try again. "
			end repeat
			select folder (the_location & "Waldo:")
			set the_button to button returned of (display dialog the_response buttons {"Quit", "Play Again"} default button 2 with icon 1)
			close every Finder window
			delete folder (the_location & "Waldo:")
			if the_button = "Quit" then
				display dialog "Thanks for playing, hope you had fun!" buttons {"Goodbye!"} default button 1 with icon 1 giving up after 10
				exit repeat
			end if
		end if
	end repeat
end tell

I BEAT IT (In about 3 hours 5 minutes and one hell of a lot of luck!) IT’S IMPOSSIBLE!

only one issue i found was in the finder you can just use the search feature in finder and win ever time. if you can find a way to gray that out. then it will be ever so better. no more to cheating! :smiley:

Oooh, here’s a solution to the above problem:

When you create the Waldo folder, name it “.Waldo”, so it’s invisible.

Then add “with invisibles” to the choose folder line like this:

set chosen_folder to (choose folder with prompt (the_message & "Find Waldo:") with invisibles) as string

That way neither Spotlight nor Finder Search can locate the .Waldo folder.

Haha, very cool! Thats so neat! Also you could add a random character inside the name if the solution above ^^ doesn’t work. I haven’t tested there’s out yet…
EDIT: Also, add a try around the spot where it sets “.Waldo” to desktop and “on error” do the same but with Waldo2, just in case someone has a folder called Waldo, dont ask me why they would have an invisible folder called Waldo, just makes it more friendly
Here:

try
set Waldo to (make new folder at desktop with properties {name:".Waldo"}) as alias
on error
set Waldo to (make new folder at desktop with properties {name:".Waldo2"}) as alias
end try

That should work