Greetings, young Pi-Wing Pilot! The galaxy is under attack by the sinister Imperial Tau Forces, who dare to challenge the supremacy of Pi with their inferior constant, Tau (6.28... ugh, so basic).Â
As a member of the Rebel Pi Alliance, your mission is to pilot your Pi-Wing Fighter, armed with blasters powered by the digits of Pi, to fend off waves of enemy ships. Survive as long as you can, rack up a galactic score, and prove that Pi is the ultimate Force in the universe!
This isn’t some boring "calculate the circumference" nonsense—this is a full-on space battle where your coding skills and Pi knowledge will save the day. Ready your blasters, and may the Pi be with you!
Your task is to build a Python program that simulates your Pi-Wing Fighter’s battle against the Tau Forces. Here’s what your program needs to do:
Welcome the pilot with a dramatic message and the tagline.
Set up starting stats: score (0), wave (1), health (100), and an approximate Pi value (3.14159).
Use a loop to keep the game running until health runs out.
For each wave, display the current wave number, health, and score.
Spawn 1-3 random Tau Fighters (store them in a list to track them).
Pick a random position (0-4) in Pi’s decimal digits (e.g., 0 = 1, 1 = 4, 2 = 1, etc.).
Ask the pilot to input the digit at that position to fire.
If correct, destroy 1 or more enemies (randomly chosen) and add to the score (10 points per hit).
If wrong, the Tau Forces strike back, reducing health based on remaining enemies.
If all enemies are destroyed, move to the next wave.
If enemies remain, take extra damage from their counterattack.
Add a short delay between waves for dramatic effect.
When health hits 0, display the final score and waves survived.
If the score is 50+, praise the pilot as a Jedi; otherwise, call them a Padawan needing training.
Use random.randint() for enemy spawns and hits.
Convert pi to a string and slice it to get digits (e.g., str(pi)[2] is the first decimal).
Use a list to track enemies—each 1 is a fighter; remove them with slicing.
Test your code often—don’t let the Tau Forces win!
Finished early? Prove your Jedi coding skills with these galactic challenges. Add them to your program for extra glory (and points if your teacher’s feeling generous). Don’t expect a step-by-step guide—these are your trials to conquer!
Objective:Â
Give your Pi-Wing a shield ability!Â
When activated, it blocks all damage for one wave.Â
To use it, the pilot must correctly guess two consecutive digits of PiÂ
Limit it to once per wave.
Objective:Â
Every 5 waves, summon the dreaded Darth Tau, a boss with extra health.Â
Defeat him by guessing three correct Pi digits in a row (random positions).Â
Reward: 50 bonus points!
Objective:Â
When your score hits a multiple of 50, gain a Pi Power-Up that restores 20 health (but caps at 100).Â
Add a fun message when it triggers.
Objective:Â
Track the highest score across games.Â
Display it at the end and update it if the current score beats it. Hint: You’ll need a variable outside the main loop!