4 kyu

Alphabet wars - trench assault

41 of 309Expurple
Description
Loading description...
Fundamentals
Strings
  • Please sign in or sign up to leave a comment.
  • harshvardhan_thakkar Avatar

    I have a question What happens when attackers enter the trench and get defeated?

    suppose the attack is:

    "ss "

    "--|dzp|"

    as d is 2 but also the first one in the trench it's defending power becomes 4 successfully defending. but now what? what will be it's attacking power? will it be (4 - 2) or (2 - 2), as you've said "it's not allowed to use more points than usual."?

  • M1Miketro Avatar
  • dfhwze Avatar

    I suggest to add 100 random tests instead of 30. My solution can't handle every case, yet it passes from time to time with so few random tests.

  • dfhwze Avatar

    You should add more examples with complete walkthrough in the description. The fixed tests are black boxes and have zero added value in debugging.

  • dfhwze Avatar

    Kata's like this should have an impeccable specification.

    • if letters join attack force on the ground, will they be split up again once they start going into trenches?
    • if a defender defeats an attacking letter in the trenches, will any other attacking letter to the left of the defeated letter start attacking the defender, or will we proceed from the defending letter to the right?
    • description mentions attacks go from left to right, but how about attacking group enters trenches, and there are some of their own in there ..
      • can they ally?
      • should those troopers in the trenches attack first, one by one, before the entering troops attack the remaining enemy forces in the trenches?
  • trashy_incel Avatar

    C :

    the assertion messages are not very helpful, because we dont see the input passed to our function. I suggest something like this :

    const char *actual = trench_assault(input);
    cr_assert_str_eq(actual, expected, "input was %s, your result was %s , expected %s", input, actual, expected);
    
  • trashy_incel Avatar

    C :

    The sample tests throw warnings because you forgot to declare the user's function; add this line :

    const char *trench_assault (const char *battlefield);
    
  • trashy_incel Avatar

    If a defending letter has less power than the attacking letters ...

    If a defending letter has more power than the attacking letters ...

    what happens in case of strict equality ?

  • trashy_incel Avatar

    The first letter in a trench has double amount of defense power. If it survives and attacks afterwards, it's not allowed to use more points than usual.

    What does 'more points than usual' mean here ? Say a letter is the first letter in a trench. It has power 4 and gets attacked by power 6. Thanks to the defensive bonus it fights with power 2 * 4 = 8 and wins. What is its new attacking power ? 4 - 6 = - 2 ? 0 ? 8 - 6 = 2 ? 4 ?

  • trashy_incel Avatar

    it's not clear to me what happens if there are several sides in a ground group. which group attacks the trench ? the last ? the biggest ? none ? same question for the trench, can they join the next attack ? can they help to attack their own trench ?

  • trashy_incel Avatar

    i dont understand if's it's guaranted that trenches and groups are always composed of same side letters i.e. is this invalid ?

    "wm    \n
    ---|wm|"
    
  • Blind4Basics Avatar

    Hi,

    The specs are lacking some important information:


    The definition of a "group" isn't given precisely enough. For instance:

    "ww ww"
    "-----"    
    

    => could that happen? is that 1 or 2 groups?

    "ww    w"
    "--|ww|-"
    

    => 1 or 3 groups?

    "ww      w"
    "--|w  w|-"
    

    could that happen? How many groups?


    Only one trench? Possible to have more than one in the same input? Are they always "well formed"? => All of this should be in the description

    example:

    "   ww"
    "ww|--"   => this wouldn't be "well formed"
    
  • Blind4Basics Avatar

    Letters always attack from left to right.

    why this difference with the original series?

  • Mercy Madmask Avatar

    This comment has been hidden.