[Community Puzzle] Someone's Acting Sus

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @SubwayMan,validated by @juliendbg,@FreezeRain and @Benoi.
If you have any issues, feel free to ping them.

im new and dont know how to code

can you teach me

Even if this puzzle is easy, you should start with an easier puzzle (Temperatures, the Descent…)

Hi I am new to this puzzle, I use Java to solve it and write a helper function which takes in the room layout and the recorded path of crewmate, it will return a boolean to indicates is the crewmate sucks or not.
And the function with the debug message is here:

public static boolean isSus(String crewmatePath,String roomLayout){
    boolean isSus=false;
    // loops to compare the path first in ascending order
    for(int i=0;i<crewmatePath.length()-1;i++){
        char current=crewmatePath.charAt(i),next=' ';
        // skip to the next one if there is #

        // skip to the next location if there is # for the next
        // it will also represent the travel time of the current grid and the next grid.
        int recordedTimeForTraveling=1;

        System.err.println("current: "+current+"\nnext: "+next);

        // the actual time travel from the current location to the next recorded location
        int actualTime=Math.abs(roomLayout.indexOf(next)-roomLayout.indexOf(current));

        // if the room that crewmate travel from is the initial room they are spawn,
        // and the next one they are travelling to is at the end of the room
        // it is considered that the distance should only take 1 minutes according to
        // the rule.

        System.err.println("Recorded time for traveling from the current room to the next one: "+
                recordedTimeForTraveling+"\nActual time for traveling: "+actualTime);

        condition of the distance:
        less than recordedTimeForTraveling: it is either took less than j minutes for the crewmate
            travel from the current to the next, or the crewmate stayed in the given record.
        greater than recordedTimeForTraveling: the crewmate must have vent.

    return isSus;

As you can see the comment in the function, it traverse along the path and compare the variable of the recorded time of travelling from the current location to the next recorded one, and the actual time requires to travel from the current room to the next recorded location of the crewmate.

The function will return sucks and break out from the loop when the actual time is greater than the recorded time for traveling, which means the crewmate must have vented.

The problem is that I could only pass the first test case, although everything in the function seems right.

(#puzzles )

Based on a quick look - you are not handling the cycling configuration correctly.
For example - if rooms are arranged in the following way ABCDEFGH then:

  • crewmate can travel from A to H in 1 minutes (this is handled I think?)
  • crewmate can travel from A to G in 2 minutes
  • crewmate can travel from B to G in 3 minutes
  • etc.
1 Like

Thanks, I think I just handle the ltr but not rtl of the crewmate path.


I dunno whether I can post my script here. However, I run into the problem of having a script that passes all the tests. I also tried some custom test to try all the combinations that could possibly brake the script. Even with the custom test, I always get what I expect.

However, when I submit the code I fail to pass the 2nd test.
I am pretty much lost in what could be the cause. Especially considering that the script passes all “test cases”

Any help is appreciated.
Best regards,

When you submit your code it is checked against validators that are different than visible test cases.
This is to prevent hardcoded solutions.

So, there must be a bug in your code.
The 2nd validator is very similar to the 2nd test case - input lines are in different order.

1 Like

I slightly changed how the case with no rooms (i.e. “######”) is handled and I passed all test in the submit as well.

Thanks for your input.