Power of Thor - Codesize - Puzzle discussion


This puzzle can be solved without going north, please fix this

Also, test count is way too low and tests are predictable. This makes hardcoding more viable than actually solving it, which probably isn’t the intention. Please randomize tests and increase them in count. Really discouraging to see such problems, what’s the point of playing if the best option is hardcoding?


My Code should work but it does not… anybody know why?

var inputs = readline().split(' ');
const lightX = parseInt(inputs[0]); // the X position of the light of power
const lightY = parseInt(inputs[1]); // the Y position of the light of power
const initialTX = parseInt(inputs[2]); // Thor's starting X position
const initialTY = parseInt(inputs[3]); // Thor's starting Y position

var thorX = initialTX;
var thorY = initialTY;

while (true) {
    var remainingTurns = parseInt(readline());
    var directionX = "";
    var directionY = "";
    directionX = (thorX > lightX) ? "W":"E";
    thorX = (thorX > lightX) ? thorX-1:thorX+1;
    directionY=(thorY > lightY) ? "N":"S";
    thorY = (thorY > lightY) ? thorY-1:thorY+1;

    print(directionY + directionX);


I think you missed out on diagonal movements to shorten the move counts.


I think you’re missing the option to not go N/S or W/E at all. Currently, you’re always going e.g. North or South (if thorY > lightY then N else S), but what if thorY == lightY? You should neither go north nor south…