A nice problem

by v_Enhance, Aug 15, 2011, 9:24 PM

Definitely one of my new all-time favorites:
Quote:
A maze is an $8\times8$ chessboard with some adjacent cells separated by walls, such that between any two squares there is a path not passing through any wall. Given a pawn in a square of a maze and a command of the type LEFT, RIGHT, UP, DOWN it executes the command if the corresponding cell and its current cell are not blocked by a wall, and otherwise does nothing.

Player $A$ writes down a sequence of such commands (a program), and then player $B$ constructs a maze, places a pawn into one of its cells and executes the command. Can player $A$ make sure that at the end of the program each cell of the maze had been visited at least once by the pawn, no matter what are $B$'s actions?
This post has been edited 2 times. Last edited by v_Enhance, Jun 29, 2012, 8:32 PM

Comment

14 Comments

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Hmm how did you do this problem

IIRC this was around the time i first learned probabilistic method, and this was one of the problems i first used it on.

by pythag011, Aug 15, 2011, 10:17 PM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Does the maze have any open loops in it? If not, I believe the right-hand maze algorithm would win each time.
This post has been edited 1 time. Last edited by phiReKaLk6781, Aug 15, 2011, 10:23 PM

by phiReKaLk6781, Aug 15, 2011, 10:22 PM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
How would you code the right hand algorithm?

by pythag011, Aug 15, 2011, 10:57 PM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Quote:
Does the maze have any open loops in it? If not, I believe the right-hand maze algorithm would win each time.
The only thing you know about the maze is that you can reach any square from any other square, so loops are okay.

This was the solution I presented to the judges; I was given this problem for AMSP Team Contest.

by v_Enhance, Aug 16, 2011, 1:16 AM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
There are a finite number of possible mazes; for each maze traverse it and then untraverse it (by giving the inverse of the sequence).
Edit: hm basically same as evan's solution lol
Edit2: this is wrong oops
This post has been edited 2 times. Last edited by AceOfDiamonds, Aug 16, 2011, 4:36 PM

by AceOfDiamonds, Aug 16, 2011, 1:44 AM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
AoD, I don't think that exactly works. Imagine a scenario where the last move should be "up" but instead you hit a wall. Then, when you move down to begin the inverse sequence, your entire path is shifted down by one and you're screwed.

by Mewto55555, Aug 16, 2011, 2:43 AM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Quote:
giving the inverse of the sequence
Yeah, unfortunately, simply taking the inverse of a sequence does not guarantee that you will return to the point you started at. I spent an hour trying to follow this idea, but I couldn't find anything useful.

by v_Enhance, Aug 16, 2011, 2:45 AM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Finite number of mazes, just solve at new starting point for each new maze.

by james4l, Aug 16, 2011, 4:09 AM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
^ waitwhat

by v_Enhance, Aug 16, 2011, 5:06 AM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
You don't have to invert anything or use any symbols whatsoever.

List the mazes and pawn positions (that is, one copy of every possible maze with every possible pawn position (below, we'll use "maze" to mean "a maze with a starting pawn square chosen")). There are finitely many. Take the first maze and write down a (finite) solution that makes the pawn reach every square (obviously possible). Now if B selected that maze, your solution solves it. Also you can add as many future moves as you like after this solution without "unsolving" the maze.

Now, take the second maze and use your partial solution on it, moving the pawn around in whatever random path that results, possibly getting blocked lots of times. Whatever happens, the maze is still solvable. From the resulting position, make moves so that the pawn reaches every square (if that has not yet happened), and add all moves made, if any, to your partial solution.

Take the third maze and add more moves to solve it. Do this for all the mazes, in some order. The final solution solves any maze.

by math_explorer, Aug 16, 2011, 9:10 AM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Awesome, we had this problem at Ideamath, except it was God vs. the Devil.

by abcak, Aug 16, 2011, 4:03 PM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
yeah i realized my mistake last night but i was too tired to edit :(
but i came up with math_explorer's solution afterwards (independently too; I'm so proud of myself)

by AceOfDiamonds, Aug 16, 2011, 4:35 PM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
@math_explorer:
EDIT: Actually nvm that's essentially the same as mine lol. I misunderstood your solution.
This post has been edited 2 times. Last edited by v_Enhance, Aug 16, 2011, 6:50 PM

by v_Enhance, Aug 16, 2011, 6:46 PM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
yeah that's my solution

ah the freeness of arbitrarily long time solving a finite problem

by james4l, Aug 18, 2011, 5:25 AM

Archives
- April 2023
+ August 2014
+ March 2014
+ February 2014
+ May 2013
+ April 2013
Shouts
Submit
  • no more school for a while :O

    by SamuelWang, Apr 16, 2025, 7:49 PM

  • first shout of 2026

    by Yiyj1, Apr 11, 2025, 2:10 AM

  • first shout in 2025

    by Captainscrubz, Jan 28, 2025, 5:32 PM

  • 289322 is crazy

    by Tem8, Nov 20, 2024, 3:13 AM

  • orz evan :orz: thx for diamond

    by Likeminded2017, Nov 17, 2024, 5:44 AM

  • a relic of the past

    by Clew28, Jul 25, 2024, 8:55 PM

  • why'd you look at this? You leave me no choice...

    by aidending, Jul 14, 2024, 11:49 PM

  • hi evan thanks for the diamond

    by Scilyse, Feb 8, 2024, 10:16 PM

  • woa hi evan

    by crazyeyemoody907, Aug 20, 2023, 9:14 PM

  • just google "nontrivial progress" for this blog! :D

    by gracemoon124, Jul 29, 2023, 10:40 PM

  • HI GUYS!

    by unknown12, Apr 16, 2023, 3:04 AM

  • isn't the shoutbox a bit too big?

    by cinnamon_e, Apr 1, 2023, 7:56 PM

  • Omg market moment

    by GrantStar, Mar 19, 2023, 12:50 AM

  • no $ $ $ $

    by v4913, Mar 18, 2023, 9:56 PM

  • do shouts bring this up the blogroll?

    by vsamc, Mar 4, 2023, 4:46 PM

181 shouts
Contributors
About Owner
  • Posts: 6876
  • Joined: Dec 30, 2008
Blog Stats
  • Blog created: Mar 13, 2010
  • Total entries: 383
  • Total visits: 293289
  • Total comments: 1317
Search Blog
a