• Okay :c
    It's not first Shell kata with same problem for me – optimization
    Will unlock solutions then, maybe I don't know some crucial tools for such problems
    Thank you for kata, I really enjoyed it :з

  • This comment is hidden because it contains spoiler information about the solution

  • Wow! Because of this even legit but not optimal solutions are invalidated!

    (*・‿・)ノ⌒*:・゚✧・゚✧・゚✧・゚✧・゚✧・゚✧・゚✧
                ✧・゚✧magic of coding・゚✧・゚
                ・゚✧・゚✧・゚✧・゚✧・゚✧・゚✧・゚✧
    
  • This comment is hidden because it contains spoiler information about the solution

    1. Added postmortem log. Looks like this:
    Amoeba died from starvation :c
    ~~~~~~HELP IN DEBUGGING~~~~~~
    
    You've reached maximum amount of iterations: 20
    Here is how maze looked like at start:
    52 58 64 || :: 
    46 || 70 || 94 
    40 || 76 82 88 
    34 || || || || 
    ~* 22 16 10 04 
    Here is how it looks at the end:
    52 58 64 || :: 
    46 || 70 || 94 
    40 || 76 82 88 
    34 || || || || 
    ~* 22 16 10 04 
    You could debug this maze by putting following list in "maze" parameter in test_amoeba_brain():
    [[0, 0, 0, 1, 3], [0, 1, 0, 1, 0], [0, 1, 0, 0, 0], [0, 1, 1, 1, 1], [2, 0, 0, 0, 0]]
    
    1. Now user able to provide maze map that looks like this:
    maze = [
        [0, 0, 3],
        [0, 1, 1],
        [0, 1, 2]
    ]
    # 0 - empty, 1, wall, 2 -amoeba, 3 - food
    

    More than this - user can copy-paste initial maze structure from postmortem log and try it in sample test.

    Added all this in the description of kata.

  • Someone tried to complete this kata in Bash? O_o

    My code looks pretty efficient, but Bash isn't supposed to compute LARGE prime numbers - it's pretty slow for such tasks. My solution fails on 5'th basic test because of timeout.

    For 6 kyu kata I need to implement some clever algorithm to check on various prime numbers properties, huh?

    • added parameter size_of_maze into test_amoeba_brain_fixed_maze(), so user could try different sizes (from 3 to 50)
    • added print for fixed tests of full suite: there are 5 of them 5x5 - 25x25. Won't add higher sizes because print will be too huge
    • removed test_amoeba_brain_random_maze() method from sample tests

    Thanks!

  • Whew! What a nice start of the day :D

    Fixed surrounding and direction (for sure).
    Added in desctiption mentioning of Y axis direction and behaviour when hitting walls.
    Changed view of debug output, so it's clear when your code is executing.

    And again, thank you so much for feedback! 🤩

  • Yes, I've broken something while fixing other issues :c

    I'll unpublish it untill everything neat and clean

    Thank you!

  • Fixed surrounding orientation -- now it's natural (y is up). Added mentioning of it in description.

  • Of course no :D

    I also prefer natural indexing. I've checked direction:

    With constant direction (-1, 0) amoeba moves like this:

    ::::::::::::::::::Start::::::::::::::::::
    . # . . A 
    . # . # . 
    . . . # . 
    . # # # . 
    X . . # . 
    ==============================
    . # . A . 
    . # . # . 
    . . . # . 
    . # # # . 
    X . . # . 
    ==============================
    . # A . . 
    . # . # . 
    . . . # . 
    . # # # . 
    X . . # . 
    

    With constant direction (0, -1) amoeba moves like this:

    ::::::::::::::::::Start::::::::::::::::::
    . # . . A 
    . # . # . 
    . . . # . 
    . # # # . 
    X . . # . 
    ==============================
    . # . . . 
    . # . # A 
    . . . # . 
    . # # # . 
    X . . # . 
    ==============================
    . # . . . 
    . # . # . 
    . . . # A 
    . # # # . 
    X . . # . 
    ==============================
    . # . . . 
    . # . # . 
    . . . # . 
    . # # # A 
    X . . # . 
    ==============================
    . # . . . 
    . # . # . 
    . . . # . 
    . # # # . 
    X . . # A 
    ==============================
    . # . . . 
    . # . # . 
    . . . # . 
    . # # # . 
    X . . # A 
    

    But for surrounding y points down - fixing it.

  • I've fixed it!
    This problem existed only in fixed maze. Sorry for inconvenience :c

  • Strange, I used indexing direction (at least I show it that way in directions and debug output).
    I'm looking into it!

  • Loading more items...