šÆ Simulating the Siglo Game in Python: A Beginnerās Journey into Game Logic
š§ Why I Built This
As a computer science student learning Python, I wanted to create something fun, culturally meaningful, and educational. I played Siglo in my teen years, a traditional Colombian tile-drawing game where players aim to reach 100 points without going over. Itās simple, strategic, and perfect for learning how to build interactive programs using Python classes, loops, and conditionals.
š¼ļø What It Looks Like
Hereās a snapshot of my program in action:
In this round, Juan drew tiles totaling 121 and went bust, while Jose played it safe and won with 93 points!
š§¾ How the Code Works
The program is built around two classes: Player and SigloGame. Each player draws tiles from a shuffled bag (numbers 1ā90), and a special āwild tileā (called vira) is added to everyoneās score. Players decide whether to draw again or stay. If their total exceeds 100, they bust. The game ends by declaring the player closest to 100 as the winner.
Hereās a quick breakdown:
⢠Player class tracks each playerās name, tiles, and score.
⢠SigloGame handles the game setup, player registration, tile drawing, and winner logic.
⢠The game runs interactively in the terminal using input() prompts.
You can explore the full code on GitHub: š View siglo.py on GitHub
ā
What I Learned
Building Siglo taught me how to:
⢠Use object-oriented programming to model real-world games.
⢠Handle user input and control flow with loops and conditionals.
⢠Simulate randomness with Pythonās random module.
⢠Think about edge cases like busting or ties.
Thanks for reading! Whether you're learning Python or just love games, I hope this inspires you to build something playful and personal. Let me know if you try it out or want to improve it with AI strategies or GUI features.
š¤ Content generated with the help of Microsoft Copilot This blog post was created in collaboration with Copilot, an AI companion by Microsoft that assists with writing, coding, and creative tasks.

Top comments (0)