Thursday, October 30, 2025

Functions & Data Types

 

Creating My Army of Darkness


Script Objective:
The user inputs the base number of soldiers and level depth, and the script generates an army based on this formula:
Base = number of soldiers when squared comprises a unit (1,4,9,25, etc)
Level-1 = number of times to square to base
Number of soldiers = (Base^2)^(Level-1)
Eg. Base 2, Level 5= (2**(2*(5-1))) = 256

1. The user has to type in the base value and level depth




































2. Generates an army of soldiers "separated" in units for random colors and shapes. The soldiers are also rotated randomly.


Examples:

Base: 2, Level: 2 = 4 total soldiers
























Base:4, Level: 3 = 256 total soldiers


























Base:5, Level: 4 = 15625 total soldiers


























Perforce File Path:
//CLASSES/Cohort22/Students/Jocelyn.Fayola/Tech Art/Python/HW9.py








No comments:

Post a Comment

Start of FIEA Portfolio