6 kyu

Bouncing Beams (Pt. 1)

57 of 179jkorinth
Description
Loading description...
Puzzles
  • Please sign in or sign up to leave a comment.
  • RealKenshiro Avatar

    Great Kata!

  • SunMaster Avatar

    Fun :-) Is there a part 2?

  • Ob1ivion Avatar

    How first answer of is equal to (0,1)? Isn't it (1,0)?

    Describe(exit_from_maze_tests) {
      It (passes_example) {
        Board m {
          "##############",
          "#        \\   #",
          "*   \\        #",
          "#            #",
          "#   \\    /   #",
          "##############"
        };
        Assert::That(exit_from_maze(m), Equals(Result({0, 1}, 22)));
      }
    

    The same second example: it should end on (5, 7)! how it is (6,4)?

     It (passes_second_tests) {
        Board m {
          "###*###",
          "#/ /  #",
          "#     #",
          "#     #",
          "#\\    #",
          "#######",
        };
        Assert::That(exit_from_maze(m), Equals(Result({6, 4}, 10)));
      }
    };
    

    I am totally confused, with how answers have gotten? Can you explain me, please!

  • trashy_incel Avatar

    Fixed C compiler warnings ;-)

  • Voile Avatar

    I don't see any mentions of the order of the position property: which one is the x direction and which one is the y direction?

  • docgunthrop Avatar

    It's a decent kata, but I agree with @JohanWiltink's comment. It's a familiar challenge, essentially a simpler version of my Ziggurat ride kata.

  • JohanWiltink Avatar

    I'd have ranked it higher but for the task not being new. Maybe it's new in C, in JS it's not. I don't know if it's really an issue, but this feels like more of the same old same old. Looking forward to new parts though, hope they do bring newness ( newity? ).

  • adri326 Avatar

    https://www.codewars.com/kumite/5cd3387ffb6f25456f8806b4

    ^ here's a javascript translation :)

  • ZED.CWT Avatar

    It's never mentioned that when * doesnot exist, {{-1,-1},0} is expected

  • ZED.CWT Avatar
    main.cpp:110:11: error: use of undeclared identifier 'Dir'
            if (d == Dir(1,0)) return {0,1};
                     ^
    main.cpp:111:11: error: use of undeclared identifier 'Dir'
            if (d == Dir(0,1)) return {-1,0};
                     ^
    main.cpp:112:11: error: use of undeclared identifier 'Dir'
            if (d == Dir(-1,0)) return {0,-1};
                     ^
    main.cpp:113:11: error: use of undeclared identifier 'Dir'
            if (d == Dir(0,-1)) return {1,0};
                     ^
    main.cpp:118:50: error: use of undeclared identifier 'Pos'
      auto m { empty(radius * 2 + 2, radius * 2 + 2, Pos(0, radius)) };
                                                     ^
    main.cpp:119:3: error: unknown type name 'Pos'; did you mean 'solution::Pos'?
      Pos p { radius, radius };
      ^~~
      solution::Pos
    main.cpp:21:7: note: 'solution::Pos' declared here
    using Pos    = std::pair<int, int>;
          ^
    main.cpp:120:3: error: unknown type name 'Dir'; did you mean 'solution::Dir'?
      Dir d = { 1, 0 };
      ^~~
      solution::Dir
    main.cpp:24:7: note: 'solution::Dir' declared here
    using Dir    = Pos;
          ^
    main.cpp:140:46: error: use of undeclared identifier 'Maze'
          Assert::That(exit_from_maze(m), Equals(Maze(m).exit_from_maze()));
                                                 ^
    main.cpp:155:46: error: use of undeclared identifier 'Maze'
          Assert::That(exit_from_maze(m), Equals(Maze(m).exit_from_maze()));
                                                 ^
    main.cpp:183:46: error: use of undeclared identifier 'Maze'
          Assert::That(exit_from_maze(m), Equals(Maze(m).exit_from_maze()));
                                                 ^
    10 errors generated.
    
  • ZED.CWT Avatar
     passes_fixed_tests
    Expected: equal to [unsupported type]
    Actual: [unsupported type]
    

    This is not debuggable, please change to another type (maybe a simple std::vector<uint64_t>), or you will need to construct your own debug message

  • ZED.CWT Avatar
    using uint  = unsigned int;
    using Pos   = std::pair<uint, uint>;
    using Model = std::vector<std::string>;
    

    Test cases should not relay on these definitions cause users can modify them easily

  • ZED.CWT Avatar
    main.cpp:22:8: error: unknown type name 'Maze'
    static Maze circle_maze(std::size_t radius) {
           ^
    main.cpp:23:3: error: unknown type name 'Maze'
      Maze m { {radius * 2 + 2, radius * 2 + 2}, { 0, radius } };
      ^
    main.cpp:25:3: error: unknown type name 'Direction'
      Direction dir = Direction::Right;
      ^
    main.cpp:25:19: error: use of undeclared identifier 'Direction'
      Direction dir = Direction::Right;
                      ^
    main.cpp:31:22: error: use of undeclared identifier 'Maze'
        m.set(p, i % 2 ? Maze::Field::Right : Maze::Field::Left);
                         ^
    main.cpp:31:43: error: use of undeclared identifier 'Maze'
        m.set(p, i % 2 ? Maze::Field::Right : Maze::Field::Left);
                                              ^
    main.cpp:43:7: error: unknown type name 'Maze'
          Maze m { {xsz, ysz}, origin };
          ^
    main.cpp:54:7: error: unknown type name 'Maze'
          Maze m { {xsz, ysz}, origin };
          ^
    main.cpp:57:28: error: use of undeclared identifier 'Maze'
                  rand() % 2 ? Maze::Field::Left : Maze::Field::Right);
                               ^
    main.cpp:57:48: error: use of undeclared identifier 'Maze'
                  rand() % 2 ? Maze::Field::Left : Maze::Field::Right);
                                                   ^
    main.cpp:87:7: error: unknown type name 'Maze'
          Maze m { circle_maze(i) };
          ^
    11 errors generated.