Ad
  • Default User Avatar

    📝 Terminal Game Move Function

    In this game, the hero moves from left to right. The player rolls the dice and moves the number of spaces indicated by the dice twice.

    🏃‍♂️ Objective:

    Create a function for the terminal game that takes the current position of the hero and the roll (1-6) and returns the new position.

    🎲 Example:

    move(3, 6) should equal 15
    

    📝 Explanation:

    • Current Position of the Hero: Represents the starting position of the hero at the beginning of the turn.
    • Dice Roll Result: The number of spaces the hero will move in each dice roll. Since the dice are rolled twice, the total movement will be twice the result of the dice.

    📋 Steps:

    1. The hero starts at the given initial position.
    2. The player rolls the dice, and the hero moves a number of spaces equal to the result of the dice.
    3. The player rolls the dice again, and the hero moves the same number of spaces again.
    4. The function should calculate and return the hero's new position after both moves.

    Detailed Example:

    • If the hero's current position is 3 and the dice roll result is 6, the hero will move 6 spaces twice.
    • First move: 3 + 6 = 9
    • Second move: 9 + 6 = 15
    • Therefore, move(3, 6) should return 15.

    Expected Function:

    The function should accept two parameters:

    1. The current position of the hero (current_position)
    2. The result of the dice roll (roll)

    And should return the new position after both moves.

    Good luck! 🎲🎮

  • Default User Avatar

    "Thank you to the kata author and my fellow Codewars members for the support and learning opportunities. I've been improving both my English and Portuguese skills along the way!"

  • Default User Avatar

    Encountered issue where I had to refresh the page to update and rerun tests.
    Unclear if due to caching or server-side processing delays.
    I encountered an inconsistency in the calculate_tip function where the return varied between 0 and 'Rating not recognised' depending on the rating input. Initially, the code was set to return 0 when the rating was not recognized in the ratings dictionary. However, upon reviewing the specifications or encountering different test scenarios, I realized that the correct return should be the message 'Rating not recognised' instead of 0 when the rating is not found in the dictionary.

    This inconsistency led to divergent results during testing, as the code was adjusted to adhere to specific expectations for recognized and unrecognized ratings.