Draft

Yu-Gi-Oh! kata: kaiba's Ultimate dream

Description:

this Kata is based on the famous trading card game Yu-Gi-Oh!

This Kata's objective is to help the legendary duelist "Seto Kaiba" to figure out if he can use his most powerful card "Blue-eyes Ultimate Dragon !!" starting from a given duel situation

to summon the Ultimate, kaiba needs (at least) three exemplaries of "Blue-eyes white dragon" together with one "polymerization" card

u r given the following informaition *) a list of strings representing kaiba's hand as follows -)"BEWD" for blue-eyes white dragon -)"poly" for polymerization -)"xx" for any other card" *)the number of cards left in deck(d) *)the number of blue-eyes cards left in deck(b) *)the number of polymerization cards left in deck(p)

your task in to write a function "ultimaProb" that takes those parameters & returns the minimum number of turns after which the probability of Kaiba having the necessary cards exceeds (or is equal ) to 50% (one random card is added from the deck to the hand each turn)

you should conseder the following cases: *) Kaiba may have all the necessary cards from the start , in this case return 0 *) Kaiba could face a situation where it is impossible to summon the Ultimate dragon( deck+hand does not contain the necessary cards) in this case return -1

good luck, the world champion's countin' on ya :)

Puzzles

More By Author:

Check out these other kata created by KH!

Stats:

CreatedJun 16, 2017
Warriors Trained126
Total Skips5
Total Code Submissions212
Total Times Completed5
Python Completions5
Total Stars5
% of votes with a positive feedback rating50% of 1
Total "Very Satisfied" Votes0
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes0
Total Rank Assessments2
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • KH! Avatar
  • hobovsky Avatar
Ad