This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:discrete:fall2021:projects:pnf2 [2021/09/16 01:52] – Fixed typo and added detail on the algorithm smalik3 | notes:discrete:fall2021:projects:pnf2 [2021/09/16 02:26] (current) – Fixed minor typos and formatting of page smalik3 | ||
---|---|---|---|
Line 7: | Line 7: | ||
=====Objective===== | =====Objective===== | ||
+ | |||
Using the TIC-80 fantasy console simulator on your pi, implement a program that visually displays a range of values (lower and upper bounds adjustable by the user) that colorfully displays whether each value is a **prime** or **composite** value. | Using the TIC-80 fantasy console simulator on your pi, implement a program that visually displays a range of values (lower and upper bounds adjustable by the user) that colorfully displays whether each value is a **prime** or **composite** value. | ||
Line 21: | Line 22: | ||
=====Background===== | =====Background===== | ||
+ | |||
The Sieve of Eratosthenes was discovered by Eratosthenes who was born in 276 B.C. This Makes this method over 2200 years old. The algorithm is not too complex, and relatively easy to understand. It works by determined a list of prime numbers from 2, to a given number. It works by checking weather or not numbers within the given range have been marked as composite yet. For example, if you wanted to determine what numbers are prime up to 100, you would start at 2. Because 2 is at the beginning of the range, it has not been marked as composite and therefore is prime. But now we must say that all multiples of 2, up to 100, are composite(4, | The Sieve of Eratosthenes was discovered by Eratosthenes who was born in 276 B.C. This Makes this method over 2200 years old. The algorithm is not too complex, and relatively easy to understand. It works by determined a list of prime numbers from 2, to a given number. It works by checking weather or not numbers within the given range have been marked as composite yet. For example, if you wanted to determine what numbers are prime up to 100, you would start at 2. Because 2 is at the beginning of the range, it has not been marked as composite and therefore is prime. But now we must say that all multiples of 2, up to 100, are composite(4, | ||
+ | |||
====TIC80==== | ====TIC80==== | ||
=====Specifications===== | =====Specifications===== | ||
- | |||
====Prime Detection Algorithm==== | ====Prime Detection Algorithm==== | ||
Line 48: | Line 50: | ||
====Implementation==== | ====Implementation==== | ||
- | Since the Sieve of Eratosthenes relies on what is effectively an array of Booleans, the process of implementation must begin roughly there. An array must be initialized of size N-2, where N is the upper bound of the user-selected range. This array will effectively be one of potentially prime numbers ranging from 2 to N. As calculations begin, this array must be walked effectively in increments of the currently selected prime (so, when starting at prime 2, walk in increments of 2) and set each selected index to FALSE or whatever not-prime should be represented as. That walking process must occur every time an un-marked-as-not-prime is encountered, | + | Since the Sieve of Eratosthenes relies on what is effectively an array of Booleans, the process of implementation must begin roughly there. An array must be initialized of size N-2, where N is the upper bound of the user-selected range. This array will effectively be one of potentially prime numbers ranging from 2 to N. As calculations begin, this array must be walked effectively in increments of the currently selected prime (so, when starting at prime 2, walk in increments of 2) and set each selected index to FALSE or whatever not-prime should be represented as. That walking process must occur every time an un-marked-as-not-prime is encountered, |
====Display==== | ====Display==== | ||
Line 59: | Line 62: | ||
https:// | https:// | ||
+ | |||
=====Submission===== | =====Submission===== | ||
+ | |||
+ | In order to submit the game file, our " | ||
+ | |||
+ | //Of course, if you are using the TIC-80 application on your Pi then the file will exist there when saved.// | ||
+ | |||
+ | To submit this project using the **submit** tool, run the following command at your lab46 prompt: | ||
+ | |||
+ | <cli> | ||
+ | lab46: | ||
+ | Submitting DESIG project " | ||
+ | -> GAMENAME.tic(OK) | ||
+ | |||
+ | SUCCESSFULLY SUBMITTED | ||
+ | </ | ||
+ | |||
+ | NOTE: " | ||
+ | |||
I'll be looking for the following: | I'll be looking for the following: | ||