[Community Puzzle] 2.5D maze

https://www.codingame.com/training/medium/2-5d-maze

The grid contains the following symbols:

  • “.” floor
  • “+” short wall (you can walk over)
  • “|” vertical slope
  • “-” horizontal slope
  • “#” high wall (you can’t walk across neither under or over)
  • “X” bridge (you can walk under and over)
  • “O” tunnel (you can walk under but not over)

I see several problems with this puzzle.

  1. There is no information about “O” (tunnel) symbol.
    What is difference between “.” and “O”?
    Both symbols allow to walk “under” only, not “over”!
    May be, every tunnel has entrance, exit and fixed direction (horizontal or vertical)? In this case: how I should to determine them? No information exists!

  2. Bad test-case set.
    There is no open test-case for “O” symbol.
    I cannot verify any assumption about tunnels…

I offer to remove this puzzle until author’s response and fix.

1 Like

I was reworking this puzzle but I did not have time to finish.

Is it possible to remove a puzzle (by a non moderator)?

No.
Why do you want to remove a puzzle? And which one? In case it’s 2.5D maze (as you wrote in this thread): the puzzle was already validated long ago and I see absolutely no reason to remove it.

I have no intention of removing any puzzle, I was only asking because @yizraor said:

Yes, I said that I would rewrite it a bit and I did not do it.

I am sorry I didn’t mean to point fingers. It was just out of curiosity :slight_smile:

OK, i pass all but the submit validator #4. Either I am trying to jump off the side of a downward slope or there is a bridge over and under situation or maybe a slope to slope transition. Can anyone shed light on this?

You just have the right to follow a slope, not to jump from it.

1 Like

Hi there. I’m stuck with validator 4. I tested many things, still not able to find out what’s wrong. Can anyone help me ?

Sure, I’m always happy to help.

You said you’ve tested many things, but maybe… have you thought about trying more things?

1 Like

influence of combination of different characters like tunnels, slopes, walls, mixd together in any order. O don’t get it.

@Razovsky i had the same problem; how do you enter a slope and how can you get out of it ? let’s say you are in a ‘.’, you check a direction and it is a ‘-’: you can take this way only if you are on a horizontal direction right ? this is the same if you want to get out of it. i hope it helps.

1 Like

(Sidenote: the thread is not linked to the puzzle, if a moderator could edit that it would be great.)

I recently started to learn ursina engine for Python and I thought it could be funny to implement a playable version of this 2.5D maze.

So here it is. All you need is Python 3.6+, install ursina (https://www.ursinaengine.org/) with ‘pip install ursina’ in the terminal, and launch the script:

from ursina import *
from ursina.shaders import basic_lighting_shader
from ursina.prefabs.first_person_controller import FirstPersonController
start, end, _, *G = """1 4
9 5
16 16
################
#....#....#....#
#.++++.++++.++.#
#.+..+.+..X.+..#
#.|.++X+.++++++#
#....X.+.#.....#
#.++++.+X+++++.#
#....+...+.....#
##+++++-.+++++##
#.....#...|....#
#.+++++++...++##
#.+.+.+...+.+..#
#.+X+...+.+.++.#
#.|.++++++-..+.#
#..........#...#
################""".split("\n")
i_start, j_start = map(int, start.split())
i_end, j_end = map(int, end.split())
h, w = len(G), len(G[0])
app = Ursina()
SKY = color.rgb(180, 230, 240)
GOLD = color.rgb(255, 215, 0)
BROWN = color.rgb(140, 70, 20)
NONE = color.rgba(255, 255, 255, 0)
GREEN, RED = color.green, color.red
window.color = SKY
window.fps_counter.enabled = False
window.exit_button.visible = False
window.fullscreen = True
YYSCALE = dict(zip("+#|-XO", [(2,8), (6,16), (0,4), (0,4), (5.5,1), (9.5,9)]))
for i in range(h):
    for j in range(w):
        c = RED if (i, j) == (i_start, j_start) else GREEN if (i, j) == (i_end, j_end) else BROWN
        Entity(model='cube', position=(4*i, -4, 4*j), collider='box', scale=(4, 4, 4),
               color=c, shader=basic_lighting_shader)
        if G[i][j] == ".": continue
        y, y_scale = YYSCALE[G[i][j]]
        Entity(model='cube', position=(4*i, y, 4*j), collider='box', scale=(4, y_scale, 4),
               color=GOLD, shader=basic_lighting_shader)
        if G[i][j] in "+X":
            if G[i][j-1] in ".|":
                Entity(model='cube', position=(4*i, 10, 4*j-1.75), collider='box', scale=(4, 8, 0.5),
                       color=NONE)
            if G[i][j+1] in ".|":
                Entity(model='cube', position=(4*i, 10, 4*j+1.75), collider='box', scale=(4, 8, 0.5),
                       color=NONE)
            if G[i-1][j] in ".-":
                Entity(model='cube', position=(4*i-1.75, 10, 4*j), collider='box', scale=(0.5, 8, 4),
                       color=NONE)
            if G[i+1][j] in ".-":
                Entity(model='cube', position=(4*i+1.75, 10, 4*j), collider='box', scale=(0.5, 8, 4),
                       color=NONE)
        elif G[i][j] == "|":
            Entity(model='cube', position=(4*i, 8, 4*j-1.75), collider='box', scale=(4, 8, 0.5),
                   color=NONE)
            Entity(model='cube', position=(4*i, 8, 4*j+1.75), collider='box', scale=(4, 8, 0.5),
                   color=NONE)
            Entity(model='cube', position=(4*i, 3, 4*j-1.75), collider='box', scale=(4, 2, 0.5),
                   color=GOLD, shader=basic_lighting_shader)
            Entity(model='cube', position=(4*i, 3, 4*j+1.75), collider='box', scale=(4, 2, 0.5),
                   color=GOLD, shader=basic_lighting_shader)
        elif G[i][j] == "-":
            Entity(model='cube', position=(4*i-1.75, 8, 4*j), collider='box', scale=(0.5, 8, 4),
                   color=NONE)
            Entity(model='cube', position=(4*i+1.75, 8, 4*j), collider='box', scale=(0.5, 8, 4),
                   color=NONE)
            Entity(model='cube', position=(4*i-1.75, 3, 4*j), collider='box', scale=(0.5, 2, 4),
                   color=GOLD, shader=basic_lighting_shader)
            Entity(model='cube', position=(4*i+1.75, 3, 4*j), collider='box', scale=(0.5, 2, 4),
                   color=GOLD, shader=basic_lighting_shader)
player = FirstPersonController(position=(4*i_start, 8, 4*j_start), collider='box', jump_height=4, speed=10)
player.cursor.color = color.black
player.cursor.rotation = (0, 0, 0)
player.cursor.scale = 0.005
app.run()

Controls are the basic wasd + mouse and space for jump.
To change the map, just replace the string in """ """ with the testcase you want to try or you can invent your own map. I implemented the "O" tunnel thing even if it’s not present in testcases.
There are invisible walls in the map to prevent forbidden moves, you can visualize them by changing the alpha of the color NONE, use 40 instead of 0 for example.
I didn’t use textures to make it a standalone script but you can easily add some.
Just put jpg files named wall.jpg, floor.jpg, sky.jpg in the folder of the script, add those lines in the script:

sky = load_texture('sky.jpg')
wall = load_texture('wall.jpg') 
floor = load_texture('floor.jpg')
Entity(model='sphere', position=(0, -200, 0), rotation=(0, 0, -90), texture=sky, scale=800, double_sided=True)

and add the option texture=floor in the BROWN/GREEN/RED Entities and texture=wall in the GOLD Entities.

2 Likes

I’m stuck with validator 4 despite having tried both recursion (DFS) and while loop (BFS), which may means that performance is not a problem. Would appreciate it if someone can PM me the input & output. Thanks a lot in advance.

Send me your code, I’ll send its answer.

Continuing the discussion from [Community Puzzle] 2.5D maze:

I would like to propose adding the following example as a test case. It captures the situation described by never-again above, where you cannot enter or leave a horizontal slope from the vertical direction (or vice-versa).

1 1
3 4
6 7
#######
#.....#
#+++-.#
#|...##
#...#.#
#######

Expected answer =15.

It’s an old puzzle, I don’t know if I can edit it.