• Distribute Blood While Playing Mahjong And Painting Cells! 😜 Open And Find Out More!

Hello, checkiomates🐱‍👤!

Did you know, that at your profile, after clicking on big percent number of your progress, you may see module and methods you have already used in your shared solutions. If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!

🏁 MISSIONS:

In the missions you need to distribute 🩸 from donor to recipients properly, paint a specific shape of cells with minimum number of steps and split a correct r-mahjong 🀄 hand into sets by certain rules (and it's just the first mission in a whole series!). Looks interesting, isn't it?!

Blood distribution by dig - Your mission is to distribute available blood of different types to patients requiring transfusions, considering each blood type's compatibility restrictions. The blood supply is not always sufficient to meet all demands. You'll be provided with the quantities of each blood type and the needs of each patient type. Your goal is to optimally allocate the available blood, respecting compatibility rules. Keep in mind that there could be multiple optimal solutions, those that utilize the maximum possible amount of the available blood supply.

distribute_blood({'A': 30, 'B': 60, 'AB': 30, 'O': 60}, {'A': 30, 'B': 40, 'AB': 50, 'O': 60}) == 
{
   'A': {'A': 30, 'B': 0,  'AB': 0,  'O': 0},
   'B': {'A': 0,  'B': 40, 'AB': 20, 'O': 0},
  'AB': {'A': 0,  'B': 0,  'AB': 30, 'O': 0},
   'O': {'A': 0,  'B': 0,  'AB': 0, 'O': 60}
}

Grid Painting by kurosawa4434 - This mission paints designated cells in a 5x5 grid with a brush. And return its minimum number of steps.

Each cell is assigned a letter of the alphabet from A to Y (Row-major order). Use this as input value. You can paint vertically (or horizontally) consecutive cells with any width brush at a time.

NOTE: Don't paint undesignated cells. The cell may be painted multiple times.

grid_painting("ABCFGHMRX") == 3
grid_painting("GHLMNRS") == 2
grid_painting("GHILNQRS") == 4

R-mahjong Ⅰ: break hand into sets by gleb10101010101 - This mission is the beginning of a series of missions dedicated to Japanese game "riichi mahjong". In each subsequent mission, your task will become more difficult.

The meaning of riichi mahjong is to collect a certain combination of cards by discarding and taking cards. In this it resembles poker, only there are much more cards in it, and the rounds are longer. The cards in this game are called tiles, and each player has 14 of them.

The goal of the mission is to split this set of tiles ("hand") into sets.

riichi_mahjong_sets(['m2', 's9', 'p9', 'dg', 's3', 's2', 'm1', 's8', 'dg', 'p9', 'dg', 's7', 's1', 'm3']) == ['dggg', 'm123', 'p99', 's123', 's789']

💡ARTICLES:

Today's articles are about flattening a list of lists, catching multiple exceptions and creating a simple text generator.

Using a Markov chain to generate readable nonsense with 20 lines of Python - This article describes how to generate text using a simple Markov chain. The generated text is readable but is also complete nonsense; as prose it’s not worth much, but for predicting the next word like your phone keyboard’s suggestions, it’s surprisingly useful. This algorithm uses pairs of words, also called bigrams. Note that this algorithm is only one small use for Markov chains, which are a much more general statistical concept.

How to Catch Multiple Exceptions in Python - In this tutorial, you’ll learn various techniques to catch multiple exceptions with Python. To begin with, you’ll review Python’s exception handling mechanism before diving deeper and learning how to identify what you’ve caught, sometimes ignore what you’ve caught, and even catch lots of exceptions.

5 ways to flatten a list of lists - This short article will show 5 ways of flattening a list of lists, ranked from worst to best and their comparison.

Find the easier way!

🙌 Thanks for your attention! Hope to meet you at CheckiO. We are really interested in your thoughts! Please, leave a comment below! ⤵

Welcome to CheckiO - games for coders where you can improve your codings skills.

The main idea behind these games is to give you the opportunity to learn by exchanging experience with the rest of the community. Every day we are trying to find interesting solutions for you to help you become a better coder.

Join the Game