Day 12: Scoring and Ranking

Published by

on

black and white dartboard

Hi Friends! 👋

📊 Daily Stand-Up: Yesterday, as the Lead Engineer, we finished migrating our app to Firebase Firestore. Also during the migration we found Firebase Auth and switched to use it. This was really fun as we learned firebase security rules, auth, querying, creating, deleting, exception handling. Our app now has a few tables, keeping track of player profiles, individual game state, and more.

Next we moved on to Scoring & Ranking. We start where we always start, with AI. It suggested the following scoring algorithm: 

Me:

I have a game I’m building that has three levels of difficulty Easy, Medium, Hard. The player chooses the difficulty for each playthrough of the game. Easy difficulty means the player gets 5 guesses, medium difficulty means the player gets 4 guesses, and hard means the player gets 3 guesses.  If the player guesses the answer before running out of guesses they win, otherwise they loose. I’d like you to build an algorithm that scores players fairly. 

ChatGPT: 

def calculate_score(difficulty, total_guesses, won):

    # Assign base score based on difficulty

    if difficulty == “Easy”:

        base_score = 10

    elif difficulty == “Medium”:

        base_score = 20

    elif difficulty == “Hard”:

        base_score = 30

    else:

        raise ValueError(“Invalid difficulty level”)

    # Deduct points for each guess

    guess_penalty = 2

    score = base_score – (guess_penalty * total_guesses)

    # Add bonus points for winning

    if won:

        bonus = 50  # Adjust the bonus as needed

        score += bonus

    return max(score, 0)  # Ensure the score is non-negative

# Example usage

difficulty_level = “Medium”

guesses_used = 3

player_won = True

player_score = calculate_score(difficulty_level, guesses_used, player_won)

print(f”Player Score: {player_score}”)

This seems like a solid start for our game.

Today we work on implementing this along with ranking against other players using firestore querying.

💪🏼 New Skill: Scoring Algorithms

🎵 Playlist: https://open.spotify.com/track/1WYEDcS7WGjv0rG7rmMX3o?si=3c337ea4e2144d41

🧠 Mental State: Feeling really good about the game!

🛠️ Tools: MacBook Pro M2, Ipad Pro, Pixel 6, Intellij, Flutter, The Keyboard that Saved my Hands, The Desk that Saved my Back, The Perfect Stand for Ipads, Desk Mounts that Work and Go on Sale, Ollama

📚 Resources

#AI, #TechJourney, #Flutter, #MobileGameDevelopment, #SoftwareDevelopment, #ProgrammingLife, #TechBlog, #AIGame

By: David Giametta

Future David here! I hope you enjoyed reading through this post. AI Murders is now live! Apple, Google

Leave a Reply

Discover more from Bias To Action Software

Subscribe now to keep reading and get access to the full archive.

Continue reading