Ad
  • Default User Avatar

    please help me. How to access X and Y coordinates. I can't find the names of the variables or the method by which I can access the variables of the point object.Was it difficult to just specify 2 variables x and y?

  • Default User Avatar

    I'm currently in the same boat with java. Makes me wonder if theres an issue with the java test-checker.

  • Default User Avatar

    Language is Java BTW. I'm having some trouble with the random tests and I can't see what I'm doing wrong. The smallest test I've seen that I fail has no rollbacks and is just simple moves. It can be recreated with

    Go g = new Go(5, 7);
    String[] moves = new String[] { "4B", "3E", "3C", "1E", "4F", "2G", "3D", "2E", "4A", "3B", "4G", "1A", "3E",
    			"2A", "2B", "3B", "3B", "1F", "1E", "2A", "3D", "3E", "4D", "1A", "4A", "3A", "1A", "1C", "3F", "4F",
    			"1A", "3D", "3F", "3B", "4A", "1C", "2C", "1B", "3F", "2B", "2C", "1A", "1D", "2A", "1B", "4E", "1A",
    			"2G", "3A", "2A", "4D", "2A", "1B", "1E", "3B", "1D", "1E", "1E" };
    for (String s : moves) {
    	try {
    		g.move(s);
    	} catch (IllegalArgumentException e) {
    	}
    }
    

    What I end up with is

      A B C D E F G 
    5 . . . . . . . 
    4 x x . o o x x 
    3 x o x x o x . 
    2 x o . . o . o 
    1 x x o o o x . 
    

    and while I can't see what it should be, I'm getting the error

    arrays first differed at element [1][4]; expected:<x> but was:<o>
    

    element[1][4] is "4E" which is only set once and, according to my program, it is set by white. Can anyone that has completed this tell me what this move set should result in? I can complete every other test and most of the time I can complete 30+ random tests, but no matter how many times I try I can't complete this thing.

  • Custom User Avatar

    Hello @Tonio31

    Using the input you provided I think the result should be [0, 1, 2, 3, 4, 3, 2, 1, 0, 2, 4, 0]

    Maybe you found a problem.

    What language are you using?

  • Default User Avatar

    I'm having the exact same problem and I really can't understand why the lift stops at floor 3 at the end.

    SO the case is:

    Capacity: 4
    
    4: [2]
    3: [4, 1, 0, 4]
    2: [3, 4, 4, 4]
    1: [0, 4]
    0: [4, 3]
    

    Lift Stops at 0 - [4, 3] in the lift
    Lift Stops at 1 - [4, 3, 4] in the lift (queue at floor 1: [0])
    Lift Stops at 2 - [4, 3, 4, 3] in the lift (queue at floor 2: [4, 4, 4])
    Lift Stops at 3 - [4, 4, 4, 4] in the lift (queue at floor 3: [1, 0])
    Lift Stops at 4 - [2] in the lift (queue at floor 4: [])
    Lift Stops at 3 - [2, 1, 0] in the lift (queue at floor 3: [])
    Lift Stops at 2 - [1, 0] in the lift (queue at floor 2: [4, 4, 4])
    Lift Stops at 1 - [0, 0] in the lift (queue at floor 1: [])
    Lift Stops at 0 - [] in the lift (queue at floor 0: [])
    Lift Stops at 2 - [4, 4, 4] in the lift (queue at floor 2: [])
    ************* WHY IS IT SUPPOSE TO STOP AT FLOOR 3 HERE ****************
    Lift Stops at 4 - [] in the lift (queue at floor 4: [])
    Lift Stops at 0 - [] in the lift (queue at floor 4: [])

    Can someone tell me why my logic above is wrong. I'm going crazy on this

  • Default User Avatar

    Nevermind. the "..." wasn't to indicate varargs.

  • Default User Avatar

    Can someone help me with this higher order function thing in Java? As far as I know varargs has to be the last parameter in a function but in this example it isnt. Does this somehow change if you use a higher order function?

  • Default User Avatar

    Thanks for this B4B. I was struggling to get through the Javascript version.

  • Default User Avatar

    Thanks for the reply. Yeah I figured it out a little later. Kata was a lot of fun.

  • Custom User Avatar

    It is a carboned chain like any other else from the chemist/molecule point of view, yes. But what I call branches in the kata are the chains that are defined through the brancher method only. From the coding point of view there is a huge difference: you cannot access the atoms of the lateral chains (C-C-C-Mg-Br, for instance), but you can access any atom (even mutated ones) that are considered "branches", meaning, "were defined using branher(...).

    Clear enough?

  • Default User Avatar

    I have a question about the addChaining method. The description says As for the add method, this chain is not considered as a new branch of the molecule. If this is the case what is the chain? You give the example of -C-C-C-Mg-Br. I'm imagining that bonded to a C at a 90 degree angle. How is this any different from any other branch in the molecule? If it isn't a branch, what makes it not a branch and what makes a branch a branch?

  • Default User Avatar

    I have a question about the addChaining method. The description says As for the add method, this chain is not considered as a new branch of the molecule. If this is the case what is the chain? You give the example of -C-C-C-Mg-Br. I'm imagining that bonded to a C at a 90 degree angle. How is this any different from any other branch in the molecule? If it isn't a branch, what makes it not a branch and what makes a branch a branch?

  • Default User Avatar

    java translation added

  • Default User Avatar

    avoid string concatenation

  • Default User Avatar

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

  • Loading more items...