Beta

Ecco the Dolphin: Ecco Junior

Description:


Ecco the Dolphin - Ecco Junior


Introduction (Lore)

In the vast, shimmering depths of the ocean, a young dolphin named Ecco embarks on a daring quest. His dear friend Tara, a playful killer whale calf, has wandered too far and found herself lost in a treacherous maze of coral and rock. Ecco must navigate through dangerous waters, avoiding lurking predators and tricky obstacles, to reunite with Tara. As he swims, Ecco remembers the lessons from his elders about using his wits and agility to overcome challenges. Will you help Ecco find a safe path to Tara in this aquatic puzzle?


Game Concept

Ecco Junior 🐬 is a marine navigation puzzle challenge where players guide a young dolphin through intricate underwater mazes. Inspired by the classic Sega game, this coding challenge tests pathfinding skills while navigating treacherous sea environments.

Problem Description

Your task is to guide Ecco through a 2D underwater maze to reach Tara. The maze is represented as a string with each row separated by a newline character '\n'.

Input:

  • A string representing the underwater maze.

Output:

  • An array of tuples (y, x) representing the path from Ecco to Tara.
    • (0, 0) is the top left corner with y coordinates going down and x coordinates going right.
  • If no path is possible, return null (or equivalent value in your programming language).

Characters in the Level:

  • ~: Sea (swimmable)
  • .: Air (unswimmable)
  • #: Rock (obstacle)
  • e: Ecco (starting position)
  • t: Tara (goal position)
  • S: Shark (moving obstacle)
  • Y: Jellyfish (moving obstacle)
  • O: Urchin (expanding obstacle)

Rules:

  1. Ecco can swim in all four cardinal directions (up, down, left, right), but not diagonally.
  2. Ecco can only swim through sea (~) tiles.
  3. Ecco cannot pass through rocks (#), jump through air (.) or go out of bounds of the level.
  4. Ecco is very cautious and will NOT swim in any lane or tile where sea creatures might potentially move or be located.
    • Sharks move horizontally, bouncing off rocks.
    • Jellyfish move vertically, bouncing off rocks and air.
    • Urchins expand to occupy all adjacent tiles (including diagonals) when Ecco approaches.
    • Sea creatures do not attack each other and can occupy the same spaces without conflict, though their initial locations are all unique.
  5. Both Ecco and Tara will always start in a safe zone, out of any danger.
  6. All rows in the maze have equal length.
  7. All creatures, including Ecco and Tara have starting locations implied on a sea (~) tile.

Constraints:

  • max height of level ≤ 40
  • max width of level ≤ 100

Win Condition:

  • Find a valid path from Ecco (e) to Tara (t).

Lose Condition:

  • No valid path exists between Ecco and Tara.

Debugging

  • On error, you'll be shown a possible valid path from Ecco to Tara, if any possible path is possible.

Examples

These and more basic scenarios are available in sample tests.

# "Happy friends swimming closely together"
# level:
# ~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~te~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~
# possible path:
[ [ 1, 8 ], [ 1, 7 ] ]


# "Separated by rock"
# level:
# ....................
# ....................
# ~~~~~~~~~~##~~~~~~~~
# ~~t~~~~~~####~~~~~~~
# ~~~~~~~~######~~~e~~
# possible path:
null


# "In shark territoy"
# level:
# ~~~~~~~~~~~~~~~e~~~~
# ~~~~###~~~~~S~~~~~~~
# ~~~~~~~~~~~~~~#~~~~~
# ~S~~~~S~~~#~~##~~~S~
# ~~~~~~~~~~~~~~~~~t~~
# possible path:
[ [ 0, 15 ], [ 0, 14 ], [ 0, 13 ], [ 0, 12 ],
  [ 0, 11 ], [ 0, 10 ], [ 0, 9 ],  [ 0, 8 ],
  [ 0, 7 ],  [ 0, 6 ],  [ 0, 5 ],  [ 0, 4 ],
  [ 0, 3 ],  [ 0, 2 ],  [ 0, 1 ],  [ 0, 0 ],
  [ 1, 0 ],  [ 2, 0 ],  [ 2, 1 ],  [ 2, 2 ],
  [ 2, 3 ],  [ 2, 4 ],  [ 2, 5 ],  [ 2, 6 ],
  [ 2, 7 ],  [ 2, 8 ],  [ 2, 9 ],  [ 2, 10 ],
  [ 2, 11 ], [ 3, 11 ], [ 4, 11 ], [ 4, 12 ],
  [ 4, 13 ], [ 4, 14 ], [ 4, 15 ], [ 4, 16 ],
  [ 4, 17 ] ]
  
  
# "Surrounded by jellyfish"
# level:
# ~~~~e~~#~~~~~~~~~Y~~
# ~~Y~~~~~~~####~Y~~~~
# ~~Y~~Y~Y~~~~~~~Y~#~~
# ~~~~~#~#~~Y~~~~#~~~~
# ~Y~~~~~~~~~~~~~~~t~~
# possible path:
[ [ 0, 4 ],  [ 0, 3 ],  [ 1, 3 ],
  [ 2, 3 ],  [ 3, 3 ],  [ 4, 3 ],
  [ 4, 4 ],  [ 4, 5 ],  [ 4, 6 ],
  [ 4, 7 ],  [ 4, 8 ],  [ 3, 8 ],
  [ 2, 8 ],  [ 1, 8 ],  [ 0, 8 ],
  [ 0, 9 ],  [ 0, 10 ], [ 0, 11 ],
  [ 0, 12 ], [ 0, 13 ], [ 0, 14 ],
  [ 1, 14 ], [ 2, 14 ], [ 2, 13 ],
  [ 2, 12 ], [ 2, 11 ], [ 3, 11 ],
  [ 4, 11 ], [ 4, 12 ], [ 4, 13 ],
  [ 4, 14 ], [ 4, 15 ], [ 4, 16 ],
  [ 4, 17 ] ]
  
  
# "Guarded by urchin"
# level:
# ~~~~~~~~#~~~~~~~~~~~
# ~~~~~~~~#~~~~~~~~~~~
# ~~e~~O~~~~~~t~~~~~~~
# ~~~~~~~~#~~~~~~~~~~~
# ~~~~~~~~#~~~~~~~~~~~
# possible path:
[ [ 2, 2 ],  [ 1, 2 ],
  [ 0, 2 ],  [ 0, 3 ],
  [ 0, 4 ],  [ 0, 5 ],
  [ 0, 6 ],  [ 0, 7 ],
  [ 1, 7 ],  [ 2, 7 ],
  [ 2, 8 ],  [ 2, 9 ],
  [ 2, 10 ], [ 2, 11 ],
  [ 2, 12 ] ]

Community Contributions

  • On request, custom levels can be added to this challenge.
    • Leave a comment on the dashboard with your level and name of the level
  • Make sure the level adheres to the design constraints and rules explained in this challenge.

Remember, the challenge is to find any valid path while considering the movement of sharks and jellyfish and the expansion of urchins! Good luck, save your friend!

Ecco Jr. wiki

Algorithms
Game Solvers
Puzzles

Stats:

CreatedNov 23, 2024
PublishedNov 24, 2024
Warriors Trained30
Total Skips14
Total Code Submissions36
Total Times Completed8
JavaScript Completions8
Total Stars2
% of votes with a positive feedback rating100% of 5
Total "Very Satisfied" Votes5
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes0
Total Rank Assessments5
Average Assessed Rank
5 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
5 kyu
Ad
Contributors
  • dfhwze Avatar
Ad