• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:02
CEST 11:02
KST 18:02
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18Serral wins EWC 202549
Community News
Maestros of The Game—$20k event w/ live finals in Paris20Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195Weekly Cups (Jul 28-Aug 3): herO doubles up6
StarCraft 2
General
What mix of new and old maps do you want in the next 1v1 ladder pool? (SC2) : 2v2 & SC: Evo Complete: Weekend Double Feature Geoff 'iNcontroL' Robinson has passed away The GOAT ranking of GOAT rankings RSL Revival patreon money discussion thread
Tourneys
RSL: Revival, a new crowdfunded tournament series Maestros of The Game—$20k event w/ live finals in Paris Sparkling Tuna Cup - Weekly Open Tournament Monday Nights Weeklies Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
External Content
Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below Mutation # 484 Magnetic Pull
Brood War
General
Flash On His 2010 "God" Form, Mind Games, vs JD Joined effort New season has just come in ladder BW General Discussion Flash Announces (and Retracts) Hiatus From ASL
Tourneys
[ASL20] Ro24 Group B [ASL20] Ro24 Group C BWCL Season 63 Announcement [CSLPRO] It's CSLAN Season! - Last Chance
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Dawn of War IV Path of Exile Stormgate/Frost Giant Megathread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread The year 2050 Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
Evil Gacha Games and the…
ffswowsucks
Breaking the Meta: Non-Stand…
TrAiDoS
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2229 users

[Math Puzzle] Day13 - Page 3

Blogs > evanthebouncy!
Post a Reply
Prev 1 2 3 4 Next All
Cambium
Profile Blog Joined June 2004
United States16368 Posts
June 08 2009 09:57 GMT
#41
To those of you who gave generic CS solutions (be it greedy, breadth-depth search, etc.), it doesn't work because you don't know the "exit condition" because the robot doesn't know when it has hit a wall and could not move further. Your program will most likely result in an infinite loop.
When you want something, all the universe conspires in helping you to achieve it.
DeathSpank
Profile Blog Joined February 2009
United States1029 Posts
June 08 2009 10:02 GMT
#42
On June 08 2009 18:57 Cambium wrote:
To those of you who gave generic CS solutions (be it greedy, breadth-depth search, etc.), it doesn't work because you don't know the "exit condition" because the robot doesn't know when it has hit a wall and could not move further. Your program will most likely result in an infinite loop.

well then its going to do that anyways. I'm sure I could do the math to figure out the limit I need for my solution but I really am to lazy. Programmers are lazy dudes. No one would ever program anything without an exit condition. Even if you found a correct solution you would never know when you hit the exit. So you would keep going and going. The robot can't know where it is. I therefor assume that the robot will exit automatically when I have reached my destination.
yes.
Ivs
Profile Joined January 2008
Australia139 Posts
Last Edited: 2009-06-08 14:20:22
June 08 2009 14:12 GMT
#43
+ Show Spoiler +

I'll have a go at this.

Result 1: Given any two start position in a fixed maze and two robots on one each, there exists a finite instruction such that, when executed simultaneously by the two robots (and no collision between the robots, so they are like probes on mining mode), they will eventually stack.

Assume the contrary. Find two starting positions with the minimal shortest path (ie, for each pair calculate the shorest path, then find the pair with the minimal value) such that the above fails. Call the two squares A and B and put robots there. Say the Euclidean (ie, measure with ruler distance) distance between them currently be say, d.

Now let the robot at A move towards B using the shortest path and let the other robot replicate the moves. The shortest path between robots does not increase during this whole time since one robot is reducing it. The shortest path also does not decrease by our minimal assumption. When the first robot gets up to position B, let the other be at position C. Now the path looks just like the original, because as one robot was "erasing" the path, the other one was "tracing" an identical one. Hence the Vector BC = Vector AB. And C is now 2d distance away from A.

We can continue this process and yield points D, E, F etc which gets further away from A by d each time. This is a contradiction since our maze is finite.

Result 2: Given a fixed maze and a robot on each square of the maze, there exists a finite instruction such that, when executed simultaneously by all robots, they will all stack.

This follows directly from Result 1. We just pick out any two separated robots, use Result 1 to stack them. Since once stacked they don't unstack, we can just pretend they are one robot. Repeat until all robots are stacked.

For a particular maze, define the sequence of moves found in Result 2 the "imba sequence"

Now after performing the "imba sequence", say the stacked robots are on a square S (which only depends on the "imba sequence" and not the start points). For any other square T, we can just now 1a2a3a our stacked robots there. Call this sequence of moves "attack-T sequence".

Final Result: Define our algorithm as follows:

List out all possible strings made up of U,D,L,R of length k, for all k. Concatenate them all together (so list all the possible strings of length 1, then 2, then 3 etc). It's clear that this big string has countable length. We'll prove that this algorithm satisfies the problem.

For any square T on the maze, combine our "imba sequence" with our "attack-T sequence", call it "bisu sequence" or something. Clearly the sequence is finite, so it appears in our algorithm somewhere. Consider performing the algorithm up to the start of "bisu sequence". Now no matter where the robot is, the "bisu sequence" will bring it to square T. And since this works for any T, no matter where the end of the maze is, as long as it's finite, the robot will get there in finite number of moves.


Hopefully it is correct :-).

Edit: Just read Muirhead's, It's much shorter/nicer :-). At least this is different and has a few additional results.
ven
Profile Blog Joined December 2008
Germany332 Posts
Last Edited: 2009-06-08 14:53:29
June 08 2009 14:49 GMT
#44
+ Show Spoiler +
Start with a length of 1. Follow every possible sequence with that length. Increase length by 1. Repeat.

Example: U, R, D, L, (length+1), UU UR UD UL, (length+1), UUU, UUR, UUD, UUL, URU, URR, URD, URL, UDU, UDR, UDD, UDL, ULU, ULR, ULD, ULL, (length+1), etc..

This way we'll create every possible path through the maze. It doesn't matter that we change positions between the tries because for every position there is a solution and as soon as our path is long enough we will eventually find the exit path that matches our current position.

This would be easier if we had knowledge about the maze size because we could just always use the longest possible path for our length but since we don't have that we increase our path length until we reach the one that we need.
You can reach the rainbow. I'll be there to help.
WhenHellfreezes
Profile Joined November 2008
United States81 Posts
June 08 2009 19:15 GMT
#45
On June 08 2009 23:49 ven_ wrote:
Start with a length of 1. Follow every possible sequence with that length. Increase length by 1. Repeat.

Example: U, R, D, L, (length+1), UU UR UD UL, (length+1), UUU, UUR, UUD, UUL, URU, URR, URD, URL, UDU, UDR, UDD, UDL, ULU, ULR, ULD, ULL, (length+1), etc..

This way we'll create every possible path through the maze. It doesn't matter that we change positions between the tries because for every position there is a solution and as soon as our path is long enough we will eventually find the exit path that matches our current position.

This would be easier if we had knowledge about the maze size because we could just always use the longest possible path for our length but since we don't have that we increase our path length until we reach the one that we need.


There is a problem with your assumptions. That it doesn't matter that we change positions is incorrect for example consider the length of three. It is possible that after doing UUU, UUR, UUD, that you moved to a spot such that UUU is the correct way to exit but you won't do that sequence again since you already did it in your rotation. The way to fix that would be to have every permutation of sequences for each length. Thus for every length i you would have (4^i)! sequences of lengths i. The total sum of moves in this sequence passes 1 mil within just like 5-6 lengths. Therefore a random algorithm would be loads better. I seriously don't understand why you are disallowing that.
Doom!
ven
Profile Blog Joined December 2008
Germany332 Posts
Last Edited: 2009-06-08 19:30:32
June 08 2009 19:24 GMT
#46
I do say that it will follow every possible arrangement of sequences for each length. So it will repeat ifself again. It will in fact repeat every previously used sequence 4 times per increase in length.
You can reach the rainbow. I'll be there to help.
WhenHellfreezes
Profile Joined November 2008
United States81 Posts
June 08 2009 19:39 GMT
#47
You missed what I'm saying completly.

You have every possible sequence of moves of length 3 as per what you said. But what I'm saying is that there are 4^3 such sequences and that you need to have every such possible arrangment of those sequences in order to fix the problem of not knowing where you are.

You need to write every permutation of these 4^3 sequences or (4^3)! sequences of length 3.

I'm saying that you stop at 4^3 and you need (4^3)!.
Doom!
ven
Profile Blog Joined December 2008
Germany332 Posts
Last Edited: 2009-06-08 20:29:56
June 08 2009 20:29 GMT
#48
No, I don't stop anywhere. The length will increase indefinitely. The example only shows the first 3 steps in order to show how it works. It doesn't stop there.
You can reach the rainbow. I'll be there to help.
WhenHellfreezes
Profile Joined November 2008
United States81 Posts
June 08 2009 21:28 GMT
#49
no i know that you continue past 3. I'm saying that you to have your step for each length be longer.
Doom!
moriya
Profile Joined March 2009
United States54 Posts
June 08 2009 21:59 GMT
#50
Such a solution tells nothing about the core of questions...
I thought the original question is to ask a gernal solution for every possible box. For example, in 1D case the solution is UDDUUUDDDDUUUUU...How to prove that there is no such a sequence for 2D case?
On June 08 2009 16:09 evandi wrote:
Show nested quote +
On June 08 2009 15:06 moriya wrote:
Now I doubt that within finite steps the solution can be achieved...

The spiral path may be promising solution, if there exsits a solution.


Muirhead solved it.

Muirhead
Profile Blog Joined October 2007
United States556 Posts
Last Edited: 2009-06-08 22:19:09
June 08 2009 22:11 GMT
#51
My solution is exactly the equivalent of UDDUUUDDDDUUUUU... in the 1-dimensional case.
I provide a single sequence which solves every possible maze.

All solutions posted are either like mine and Ivs's, grossly inefficient but nicely deterministic, or they are based on randomness. The random solutions are in many senses nicer but are "only" guaranteed to succeed with probability 1. Which you prefer depends on whether you want to be a practical computer scientists or an AWESOME MATHEMATICIAN ^^.

Though to be honest, I don't know enough (any) comp sci. Could someone summarize how fast my algorithm runs compared to a random algorithm?
starleague.mit.edu
ven
Profile Blog Joined December 2008
Germany332 Posts
Last Edited: 2009-06-08 23:04:15
June 08 2009 23:01 GMT
#52
You didn't really provide any actual algorithm.
But even then, any algorithm to solve a maze of this kind would be so horribly inefficient and slow that it doesn't make sense to compare their runtime.
You can reach the rainbow. I'll be there to help.
Muirhead
Profile Blog Joined October 2007
United States556 Posts
June 08 2009 23:54 GMT
#53
Sure I provided an actual algorithm
starleague.mit.edu
Ivs
Profile Joined January 2008
Australia139 Posts
June 09 2009 02:04 GMT
#54
I don't think it is obvious that

On June 08 2009 23:49 ven_ wrote:
+ Show Spoiler +

This way we'll create every possible path through the maze. It doesn't matter that we change positions between the tries because for every position there is a solution and as soon as our path is long enough we will eventually find the exit path that matches our current position.



Every possible path does occur, but you haven't shown that upon the positional change, the right path will follow.

For example, considers two squares A and B, let the classes of sequences that finish the maze be c(A) and c(B). Each member c(A) and c(B) does occur infinitely often, but you could have say, each element of c(B) only follows position A and each of c(A) only follows position B. To complete it you would need to show that the sets c(A) and c(B) have common elements, which they in fact do.
Daveed
Profile Blog Joined December 2006
United States236 Posts
June 09 2009 17:32 GMT
#55
@ Muirhead:
I know that this problem doesn't specify it, but generally, robots should be constrained by processing ability and memory. Keeping an enumeration of 2^{m*n} possible mazes should be out of the question. As a math solution, this would work, but I don't think the quantifiers of the problem were set up as well as they could have been.

That being said, I believe some variant of bugnav should do the trick.
Muirhead
Profile Blog Joined October 2007
United States556 Posts
June 09 2009 17:52 GMT
#56
Hrm I'm pretty sure that to execute my solution the robot would only need to keep one maze in its head at a time, though it would need to remember a set of directions corresponding to every square on the maze.
starleague.mit.edu
mmp
Profile Blog Joined April 2009
United States2130 Posts
Last Edited: 2009-06-09 19:49:56
June 09 2009 19:02 GMT
#57
On June 08 2009 14:44 Muirhead wrote:
+ Show Spoiler +
Suppose we are given the maze but not the starting position. Then we can solve the puzzle by looking at each possible starting position in turn. In short, we pick some box and assume the robot started there, giving it commands to solve the puzzle. Then, we pick a second box to assume the robot started in, see where the robot would be after our commands based on the first assumption, and give it commands to exit the maze. Etc.

Since the set of possible mazes is countable, we can adjoin the solutions for every given maze end to end and be done.


Interesting that you can try exhaustively on all mazes without worrying where the previous maze left your robit, since you are guessing from an unknown starting location. Counter intuitive, but cool once you think about it.

Worst-case runtime:
+ Show Spoiler +

Let B be the enumeration of possible mazes. This isn't exactly 2 ^ (m x n), since any open square must lead to an exit, but it is O(2 ^ (m x n)). To prove this, consider all mazes that do not have a solution path and are therefore invalid. Now make every other row entire open. All previously-invalid open squares are now adjacent to a solution row, while preserving (m x n) / 2 of the cells.

For every board there are O(m x n) starting positions to try. Since you know which board you are currently trying, there exists a known solution path of length O(m x n). So we immediately know that it will require O(B x m^2 x n^2) moves.


I'll work on non-deterministic runtime and expected runtime in a bit.
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
King K. Rool
Profile Blog Joined May 2009
Canada4408 Posts
Last Edited: 2009-06-09 19:07:46
June 09 2009 19:05 GMT
#58
I thought the maze was supposed to be arbitrary?

Solutions to this (assuming maze is given) seem inefficient like ven_ said. Assuming we follow an algorithm like muirhead's (can't really think of another solution, his is pretty cool)

Worst case the last box you check would be the correct box. Obvious upper bound for boxes are O(m^2 * n^2). Number of boxes to check would be O(m^2 * n^2). Of course you likely could math it down to a better upper bound.

Something similar to ...

loop1 : i = 1.. m^2 * n^2 //ith box you check
loop2: j = 1 .. i //follow 1..ith path
m^2*n^2 instructions //follow the path

Not sure if my math is right (not going to bother thinking too much, at work), but you get something like an arithmetic series 1+2+3+...+k, where k is m^2 * n^2. We know that the 1+2+...k is O(k^2), so you get O(m^4 n^4), but then this is assuming one instruction. We have at most m^2n^2 instructions so you get m^6n^6.

O(m^6n^6) + finding paths for all boxes (which seems like it'll be easier to do).
mmp
Profile Blog Joined April 2009
United States2130 Posts
Last Edited: 2009-06-09 20:04:59
June 09 2009 19:40 GMT
#59
On June 10 2009 02:32 Daveed wrote:
@ Muirhead:
I know that this problem doesn't specify it, but generally, robots should be constrained by processing ability and memory. Keeping an enumeration of 2^{m*n} possible mazes should be out of the question. As a math solution, this would work, but I don't think the quantifiers of the problem were set up as well as they could have been.

That being said, I believe some variant of bugnav should do the trick.


Most bug pathfinders are based on some limited information about the map. Our robit cannot detect collisions (or anything for that matter), so wall-crawling, tangent bug, etc. are simply out of the question. Because we have no information, the problem lends itself to non-heuristic approach.

As for memory constraints, you require (m x n) bits to store any one maze. Generating another is simply a matter of incrementing bits until you have exhausted all permutations. For any given maze, I believe that you can construct a spanning tree of the adjacency matrix in O(m x n) time. You can search the tree for a solution (not necessarily the shortest) from any starting location in just as much time (linear).

Computationally, 2 ^ (m x n) is bad, but you really cannot avoid this part of the problem. At best, you can do a depth-first approach and compute massively in parallel.
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
Daveed
Profile Blog Joined December 2006
United States236 Posts
June 09 2009 20:08 GMT
#60
@Muirhead:
Although it needs to keep only one maze in its head at a time, it also needs to know which maze it's on, in order to generate the next maze in its enumeration (that IS what you are doing, correct?).

@ mmp: I had overlooked the inability of the robot to detect where it was. Sure, point taken.
Prev 1 2 3 4 Next All
Please log in or register to reply.
Live Events Refresh
Next event in 58m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Sea 7406
PianO 657
Killer 621
Larva 620
Pusan 339
ggaemo 337
Hyun 309
Soma 160
Rush 49
NotJumperer 28
[ Show more ]
Free 23
HiyA 16
Noble 15
Sacsri 13
Dota 2
XcaliburYe406
febbydoto11
League of Legends
JimRising 437
Dendi0
Counter-Strike
Stewie2K1762
Super Smash Bros
Mew2King28
Heroes of the Storm
Khaldor176
Other Games
summit1g7980
singsing1709
Nina129
SortOf121
Happy46
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH496
• Reevou 5
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1016
Upcoming Events
Sparkling Tuna Cup
58m
SC Evo League
2h 58m
Chat StarLeague
6h 58m
Razz vs Julia
StRyKeR vs ZZZero
Semih vs TBD
Replay Cast
14h 58m
Afreeca Starleague
1d
Queen vs HyuN
EffOrt vs Calm
Wardi Open
1d 1h
RotterdaM Event
1d 5h
Replay Cast
1d 14h
Afreeca Starleague
2 days
Rush vs TBD
Jaedong vs Mong
Afreeca Starleague
3 days
herO vs TBD
Royal vs Barracks
[ Show More ]
Replay Cast
3 days
The PondCast
4 days
Replay Cast
4 days
LiuLi Cup
5 days
Cosmonarchy
5 days
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
BSL Team Wars
5 days
Team Hawk vs Team Dewalt
BSL Team Wars
5 days
Team Hawk vs Team Bonyth
SC Evo League
6 days
[BSL 2025] Weekly
6 days
Liquipedia Results

Completed

Jiahua Invitational
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 1
Acropolis #4 - TS1
CSLAN 3
SEL Season 2 Championship
WardiTV Summer 2025
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL Season 18: Qualifier 2
CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.