• Habits of Great Devs & Kings of Optimization and Play With Cleaner and Bridge Hand

Hello, checkiomates🐱‍👤!

Did you know, that if you find an interesting solution, you may add it to your bookmarks by clicking the flag near solution title. You can find all your bookmarked solutions by clicking your nickname and then "Bookmarks". 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 predict the final position of cleaning robot 🧹, count scores of bridge hand ♣ and combine names of celebrity stars! Yes, such different tasks for you fun and learning. 💻

Combining Celebrity Names by freeman_lex - Combining the first names of beloved celebrity couples to a catchy shorthand for mass media consumption turns out to be simple to automate.

Start by counting how many maximal groups of consecutive vowels (aeiou, as to keep this problem simple, the letter y is always a consonant) exist inside the first name. If the first name has only one vowel group, keep only the consonants before that group and lose everything else. Otherwise, if the first word has n > 1 vowel groups, keep everything before the second last vowel group n – 1.

Concatenate that string with the string that you get by removing all consonants from the beginning of the second name.

brangelina("brad", "angelina") == "brangelina"
brangelina("Angelina", "brad") == "angelad"
brangelina("Sheldon", "amy") == "shamy"

Bridge Routine by freeman_lex - The trick taking power of a bridge hand is estimated with Milton Work point count, of which we shall implement a version that is simple enough for beginners of either Python or the game of bridge!

Looking at a bridge hand that consists of thirteen cards as tuples (rank, suit), your function must return a number of points and a shorthand form of a given hand.

list(
    bridge_routine(
        [
            ("four", "spades"),
            ("five", "spades"),
            ("ten", "hearts"),
            ("six", "hearts"),
            ("queen", "hearts"),
            ("jack", "hearts"),
            ("four", "hearts"),
            ("two", "hearts"),
            ("three", "diamonds"),
            ("seven", "diamonds"),
            ("four", "diamonds"),
            ("two", "diamonds"),
            ("four", "clubs"),
        ],
        "diamonds",
    )
) == [8, "xx QJxxxx xxxx x"]

Cleaning Robot by freeman_lex - Dr. Asimov, a robotics researcher, loves to research, but hates houseworks and his house were really dirty. So, he has developed a cleaning robot. His house has 9 rooms, where each room is identified by a letter of the alphabet.

A battery charger for the robot is in a room. It would be convenient for Dr. Asimov if the robot stops at the battery room when its battery runs down. Your task is to write a program which computes the probability of the robot stopping at the battery room.

cleaning_robot(1, "E", "A", "C") == 0.0
cleaning_robot(1, "E", "B", "C") == 0.25
cleaning_robot(2, "E", "A", "B") == 0.0625

💡ARTICLES:

Today's articles are reflections about ways of code optimization, habits of good developer and using queues in Python. You are welcome to read and discuss.

Guide to Queues in Python - From storing simple integers to managing complex workflows, data structures lay the groundwork for robust applications. Among them, the queue often emerges as both intriguing and ubiquitous. For developers, especially in Python, queues aren't just theoretical constructs from a computer science textbook. They form the underlying architecture in many applications.

Four Kinds of Optimisation - Premature optimisation might be the root of all evil, but overdue optimisation is the root of all frustration. No matter how fast hardware becomes, we find it easy to write programs which run too slow. Often this is not immediately apparent. Users can go for years without considering a program’s performance to be an issue before it suddenly becomes so — often in the space of a single working day.

Habits of great software engineers - The role of a software developer often gets distilled down to a singular activity: coding. While coding is undeniably the heartbeat of the profession, defining a developer by this act alone is akin to defining a painter by their ability to mix colors. It's a crucial part but just the tip of the iceberg. The true essence of a software developer's role combines many different skills, mindsets, and disciplines. The author wants to talk more about what makes a great software developer. What are the habits of highly effective developers?

Don't forget, that developers are not like other people!)

🙌 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