6 kyu

Lottery Ticket

8,688 of 13,611PG1
Description
Loading description...
Fundamentals
Strings
Arrays
  • Please sign in or sign up to leave a comment.
  • AbdullahBakeBake Avatar

    sweet little kata :3 perfect for 6 kyu

  • natan Avatar

    js/didn't check others:

    missing fixed test where a subarray has a matching character multiple times such as [['OOO', 79], 3] with the duplicates required to reach the target - instructions state that a sub array may only be counted once. random tests are not sufficiently well crafted to consistently fail such solutions

    additionally, the test output should quote strings in the "testing for ..." it name, that's really annoying when looking to call it myself

  • The Spine Avatar

    I'm a little confused on the generated attempt test. I was given [[BXUBG,75], [NNLLEGHQ,71], [PGKZJCC,85], [TSMEJKFJ,87], [EEX,86], [DJIZVOZ,79], [KRRFVLR,88]] and 1 'G' is code 71 and 'O' is code 79, both in two separate mini wins. Am I missing something?

  • rsschool_1e2b0ad411a664a1 Avatar

    Very bad kata. Firstly, nothing is clear from the conditions, and there are no examples. Secondly, I solved the test correctly, but it gave an error. Thanks to the comments, I understood that I need to press submit until the test is completed, I pressed it five times, and still passed the test.

  • egg22 Avatar

    Add a test case for miniwins > win as there is currently none and random tests may miss this senario.

    Example: test.assert_equals(bingo([['TUCYPFOU', 84], ['LRG', 76], ['DV', 83]], 1), 'Winner!')

  • AlexRz912 Avatar

    This comment has been hidden.

  • PetitLu117 Avatar
  • CClairvoyant Avatar

    Tests use deprecated function toByte(). The deprecation notice spoils the solution.

  • Dimashum1225 Avatar

    In random test may be two twin characters.

  • gfandrade10 Avatar

    That sould be 7 at best, too easy for lv6.

  • analogueBubblebath Avatar

    This comment has been hidden.

  • Ali76 Avatar

    This comment has been hidden.

  • FutureGoose Avatar

    Perfect 6 kyu!

  • rsschool_d96feabccc406403 Avatar

    Testing for [[AKOXCRLP,90], [IBXFRAKK,75], [CRPO,65], [FB,82], [LXPW,70]] and 2 expected 'Loser' from me, why? There is double K, which code is 75, that means at least already my total is more than win

  • rsschool_fd66f4a8ff9cfbd6 Avatar

    Testing for [[YOPEWBI,73], [JMXKLK,68], [YXUCQFUE,89]] and 1 It should work for random inputs too: expected 'Loser!' to equal 'Winner!' Why is 1 correct? ASCII table says code(I) -> 73 from the first subarray. code(Y) -> 89 from the last one. There should be 2

  • marjan Avatar

    That was very easy, c++.

  • 66  Avatar

    Language: C++
    Test suit missing the required headers std::string|std::vector|std::pair

  • rsschool_9b82f5d8a1600639 Avatar

    This comment has been hidden.

  • m1rstan Avatar

    The most stupid task that is impossible to understand, the code should work according to the author's explanation but gives an error, correct the text and then publish. For example, according to the tests I should output 'Winner!' But why? [['FIQDTMTD',90], ['PHNGRRW',72], ['TTVSRU',72], ['WOXLT',68], ['ZXPL',84], ['LHKYCGQG',83], ['YT',88], ['XF',69], ['KDMRY',65]], 1

  • CyberCat001 Avatar

    This comment has been hidden.

  • Assile Avatar

    This comment has been hidden.

  • Mars4me Avatar

    This comment has been hidden.

  • KarolinaAHK Avatar

    Sometimes when number of miniwins equals winning number tests fail. I've literally had tests expecting 'Winer!' when miniwins = 3 and win = 3, and I also had tests expecting 'Loser!' in such situation. You can submit your solution if you click 'Attempt' enough times to draw a set of tests that are not violating assumptions set in the task. (This is for Python.)

  • rsschool_af31f609eb515e03 Avatar

    'It should work for random inputs too - Expected: 'Winner!', instead got: 'Loser!''

    I'm not sure what this means, can you elobarate? I pass 90% of the tests, others fail on this problem.

  • Kanzi Avatar

    This comment has been hidden.

  • Chrono79 Avatar

    The user can mutate the input affecting the expected value at least in javascript. Calculate the expected value before calling the user's function.

  • Thuringud Avatar

    Random tests

    Testing for DSYLTWUI,87,TQDV,79,MKUVZJN,77,JGICV,87 and 1

    Log

    [ [ 'DSYLTWUI', 87 ],

    [ 'TQDV', 79 ],

    [ 'MKUVZJN', 77 ],

    [ 'JGICV', 87 ] ] 1

    It should work for random inputs too - Expected: 'Loser!', instead got: 'Winner!'

    Why 'Loser!'?

  • DOKL57 Avatar

    This comment has been hidden.

  • nodewalker Avatar

    Python version generates warnings.

  • caerdroia Avatar

    This comment has been hidden.

  • caerdroia Avatar

    Good day,

    I have a problem here: my solution works for 90%. One of the cases that doesn't work: "EKIV,81,RYVFY,87,KGPAMYPO,75,JDNOQF,75,JRFHMPNQ,90 and 1" My solution finds '1' lucky ticket - KGPAMYPO,75 (K is '75') and to me it looks as 1 lucky ticket === win so it should be correct. I'm a bit confused here, any help would be appreciated.

  • Ysliria Avatar

    In PHP, I earned the test, but when I try to attempt it failed ! Is there a bug ?

    Debug here :

    array(3) {
      [0]=>
      array(2) {
        [0]=>
        string(3) "ABC"
        [1]=>
        int(65)
      }
      [1]=>
      array(2) {
        [0]=>
        string(3) "HGR"
        [1]=>
        int(74)
      }
      [2]=>
      array(2) {
        [0]=>
        string(4) "BYHT"
        [1]=>
        int(74)
      }
    }
    string(7) "win = 2"
    string(9) "Result : "
    string(8) "in = ABC"
    string(10) "Search : A"
    string(9) "Result : "
    string(8) "in = HGR"
    string(10) "Search : J"
    string(9) "Result : "
    string(9) "in = BYHT"
    string(10) "Search : J"
    string(10) "Result = 1"
    string(12) "Attenmpt = 2"
    
  • mightykiller Avatar

    JS random tests generates warnings. Verified the random ones myself and they work.

  • AndrewShamrey Avatar

    JS version generetas warnings

    MHCEAHQR,76,AUIUYJUB,65,TKYJQU,74,DZLACK,66,DQNL,69,JMCFPA,65 and 1 YTTKHLF,89,ZXPUNQ,81,BIZOMT,86,VNXWULB,65 and 1 JP,84,ZEHDK,75,JBIZVXGG,86,PSLHLX,67,HW,70,RUFFVD,89 and 1

    ... and many others :(

  • Mathter85 Avatar

    Phyton version generetas warnings Example ticket = [['YXSPUIX', 84], ['EOL', 64], ['UZ', 80], ['CYWT', 73]] win =2

  • Mathter85 Avatar

    This comment has been hidden.

  • FArekkusu Avatar

    C version generates warnings.

  • FArekkusu Avatar

    C++ version generates warnings.

  • mrrobot993 Avatar

    This comment has been hidden.

  • evolvingWill Avatar

    I don't understand the question. What is a character code in this case. I cannot identify what a mini win is.

  • jamnjerry Avatar

    This comment has been hidden.

  • Hamburgler Avatar

    This comment has been hidden.

  • imjasonmiller Avatar
  • b3vs Avatar

    I think data that comes in random tests are wrong. //println(bingo(arrayOf("GOO" to 80, "MZACH" to 66, "UMGWNM" to 84, "SZN" to 89), 2)) -- no mataches 0 //println(bingo(arrayOf("FTL" to 87, "XLRUS" to 82, "QLRDXW" to 87), 1)) -- 2 matches but tests expected "Winner"

  • chustos96 Avatar

    I'm having problem too with the random tests in C. please help

  • Venky108 Avatar

    Looks like there is a problem with random test cases 3 of them are always failing , no matter in which language u code. It is not showing details of the failed test cases. Please update ...

  • guysbryant Avatar

    Using Ruby for this and I'm not sure where I'm messing up. Here are two Logs from where I'm using puts to print out the various values:

     Log 1
    Characters: SWPSDG
        Value to match: 84
    
    Character: S Value: 83
    Character: W Value: 87
    Character: P Value: 80
    Character: S Value: 83
    Character: D Value: 68
    Character: G Value: 71
    
    Matches to Win: 2
    Total Matches:  0
    Loser!
    Expected: "Winner!", instead got: "Loser!"
    
     Log 2
    Characters: XS
        Value to match: 62
    
    Character: X Value: 88
    Character: S Value: 83
    
    Matches to Win: 3
    Total Matches:  0
    Loser!
    Expected: "Winner!", instead got: "Loser!"
    
  • orangeornithus Avatar

    Definitely not a 6 kyu in PHP, but I had fun. I wonder if it's harder in other languages?

  • oceancypress Avatar

    This comment has been hidden.

  • paulkan Avatar

    Looks like random test generates wrong tests (at least on C language). Here is my example:

    Testing for {{"VJD", 66}, {"AYTNQRS", 89}, {"IL", 71}, {"KMKA", 65}, {"RP", 87}} and 1

    89 == 89 (Y) 65 == 65 (A) winCnt = 2 win = 1 == 0 Expected Winner! Received Loser!

    So we have 2 matches here, and win number should be 2, but random test puts 1 and expects "Winner!". Please update this kata.

    UPD: After investigation I found that miniWin string which has correct ASCII key from other miniWin - has not been counted in random generated tests. It's the reason why random tests failing. Please update random tests. Thanks!

  • Mounica Avatar

    Hi,

    I wrote code in Javascript; For the below mentioned ticket; the mini-win(s) is 1 and the provided win is 1; so the expected should be Winner!, but the tests failed saying as Loser!

    Testing for HMOAHIRY,77,VGDU,73 and 1 It should work for random inputs too - Expected: 'Loser!', instead got: 'Winner!'

    Need help on this!

    Thanks!

  • rsalgado Avatar

    Elixir translation kummited. Feel free to review/approve when you get some time. BTW, nice kata!

  • Kuribo Avatar

    This comment has been hidden.

  • stellartux Avatar
  • kdmatrosov Avatar

    Kotlin Translation

    please, review and approve

  • deshdaaz Avatar

    3 of 100 random tests are failing but it does not show the actual test case details. It only says 'Winner!' should equal 'Loser!'

    How do I look up test case input it failed for to work on fixing my code?

    Thank you,

  • clcraig Avatar

    @A.Partridge, C translation available.

  • KenKamau Avatar

    Ruby translation

    Please review and approve

  • KenKamau Avatar

    Python translation

    Please review and approve

  • vasilikb2014 Avatar

    It appears the solutions have a few mistakes. I compared to ascii table and the ones that are getting marked errors are correct.

  • donaldsebleung Avatar

    PHP Translation Kumited - please accept :D