Dark Labyrinth

Dark Labyrinth

Do you remember the classic mission Open Labyrinth ? Well, you once again find yourself inside a labyrinth, but the lights are out and you cannot see the full map. You have flashlight and know that all passages in the Labyrinth are directed along South-North and East-West lines. You don't yet know your position or the location of the exit. You must hurry as you cannot run forever.

This is a "multicall" mission and as such, your function will be called until you have solved the maze or run out of moves. For each iteration you see a part of the labyrinth in four directions (function input). You can see passages and where they have crossings and turns. If it’s in your range of vision, you’ll see the exit too. The visible zones are represented as a grid as a tuple of strings, where "X" is a wall, "." is a passage cell, "?" is unknown, "P" is player and "E" is the exit. Grids are represented as 2D rectangular arrays. The size is related to size of the visible zone.

For each iteration your function should return one or several actions as a string with directions. Actions are described as directions: "N" - North, "S" - South, "W" - West and "E" - East. For example: the string "NWS" describes a sequence of three moves. The walls are coated in a weird slime so you shouldn’t make a move that would have you walk into a wall. To make things interesting, you are limited to 250 moves (not iterations). You can use global variables between iterations.

example

For example on the image you can see the full labyrinth and that will be visible for player. And your function will receive:

("???XXX",
 "???...",
 "???X.X",
 "XXXX.X",
 "X...PX",
 "XXXX.X",
 "???X.X",
 "???...",
 "???X.X",
 "???X.X",
 "???..X",
 "???XXX")

Input: A visible part as a tuple of strings.

Output: An action or several actions as a string.

Example:

    

How it is used: This concept is pathfinding algorithm with search. It can be used to explore territory and make a map.

Precondition:
The labyrinth are surrounded by walls.
All passages are narrow (1 cell width)
3 < len(visible) ≤ 15
all(len(row) == len(visible[0]) for row in visible)

45
Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.

×
 
 
<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in a moment
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission