• Don't Learn C! Sort Waters Tubes And Connect Islands With Bridges Instead!

Hello, checkiomatesđŸ±â€đŸ‘€!

Did you know, that at every mission page, under the editor window, there is a terminal window. If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!

🏁 MISSIONS:

Today we've prepared for you very interesting missions! You all know about mobile app stores and play games from them. Now it's time to write a script that solves some logic games for you!

In the first game you need to build a correct number of bridges among islands 🏝 ! This game you may also find among Simon Tatham's Puzzles. And some other puzzles from this collection you may solve at CheckiO station Maya after it's opening for you.

In the second game you need to sort liquids of different colors inside tubes with the less number of steps.

We also have the third mission for you, where you are going to say numbers out loud and write what you hear! This mission includes video explanation from the famous John Conway!

Archipelago by freeman_lex - You are given a rectangular map of islands where the number in each island tells how many bridges are connected to it.

The object is to connect all islands according to the number of bridges with the following rules:

  • there are no more than two bridges in the same direction;
  • bridges can only be vertical or horizontal and can't cross islands or other bridges;
  • when completed, all island on a map are interconnected by bridges, enabling passage from any island to another.

Your function must return a sorted ascending tuple of directions with bridges. Each direction is a tuple itself with three integers. The first two are serial numbers of islands (sorted ascending), the third one is number of bridges between these two islands (1 or 2). Islands must be ordered starting from 1, from top-left to bottom-right, row-major.

assert archipelago(
    (
        (0, 1, 0, 0, 2),
        (2, 0, 0, 2, 0),
        (0, 0, 2, 0, 2),
        (0, 0, 0, 1, 0),
        (3, 0, 6, 0, 3),
    )
) == (
    (1, 2, 1),
    (2, 6, 1),
    (3, 4, 1),
    (3, 8, 1),
    (4, 7, 1),
    (5, 9, 2),
    (6, 10, 1),
    (8, 9, 2),
    (9, 10, 2),
)

Water Sort Game by freeman_lex - In Water Sort game you are given a sequence of flasks. Most of them are filled with mixed liquids of different colors, and some are empty. Your task is to collect liquids of the same color in one flask using empty flasks by pouring a single color portion(s) from one flask to another with this color on top or to empty one.

The sequence of flasks is represented as list of strings. All non-empty flasks in a sequence have the same capacity (which may vary from test to test). Colors of liquids are encoded by Latin letters from top to bottom (in flasks) and from leftest to rightest flask in order of first appearance (the first color is encoded as "a", the next distinct color - "b" etc). Adjacent portions of the same color encoded with repeating letter ("aa", "ccc" etc.).

Your mission is to calculate the minimum number of pourings needed to collect every distinct color in one flask.

water_sort(["abab", "baba", ""]) == 7
water_sort(["abcc", "abca", "bcab", "", ""]) == 10
water_sort(["abca", "bcbc", "aabc", "", ""]) == 10

Count And Say by freeman_lex - Given a string of digits that is guaranteed to contain only digit characters from 0123456789, read that string “out loud” by saying how many times each digit occurs consecutively in the current bunch of digits, and then return the string of digits that you just said out loud.

count_and_say("333388822211177") == "4338323127"
count_and_say("1") == "11"
count_and_say("") == ""

💡ARTICLES:

Today's articles are about overrated learning of C programming language, dictionary performance comparison and filtering a lsit.

You (probably) don’t need to learn C - Ned Batchelder wrote, that he was tired of people saying, “you should learn C so you can understand how a computer really works.” He got a lot of replies which did not change my mind, but helped him understand more how abstractions are inescapable in computers.

A question he asked a number of people: what mistakes are JavaScript/Ruby/Python developers making if they don’t know these things (C, syscalls, pointers)?”. He didn’t get strong answers and now offers you the following article with his thoughts.

Performance Analysis of Python’s dict() and {} - Some time ago, during a code review, the author had a discussion with a colleague of him about preferring dict() over {} in new Python code. They argued that dict() is more readable — and expresses intent more clearly — therefore should be preferred.

Yet that made the author wonder: what’s the difference between the dict type and {} literal expression? Let’s go down the rabbit hole.

How Do You Filter a List in Python? - In this tutorial, we’ll explain different methods to filter a list in Python with the help of multiple examples. You’ll learn to use the Python filter() function, list comprehension, and also use Python for loop to select elements from the list.

Be strong while solving CheckiO missions!

🙌 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