This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:discrete:fall2021:projects:saf0 [2021/09/22 17:17] – display ideas aholmes9 | notes:discrete:fall2021:projects:saf0 [2021/10/06 23:47] (current) – Fixed minor typo smalik3 | ||
---|---|---|---|
Line 7: | Line 7: | ||
=====Objective===== | =====Objective===== | ||
- | Using the TIC-80 fantasy console simulator on your pi, implement a program that performs | + | |
+ | Using the TIC-80 fantasy console simulator on your pi, implement a program that performs sorting of a randomized list of values, both displaying an animation of the sort, along with timing and keeping track of the approximate number of steps needed to accomplish the task for variable numbers of non-animated runtimes. | ||
The sorting algorithm I'd like for you to produce is that of a naive approach: | The sorting algorithm I'd like for you to produce is that of a naive approach: | ||
Line 13: | Line 14: | ||
* not looking up anything about sorting algorithms, how would you implement an algorithm to take an arbitrary list of values and cause them to be arranged in order from least to greatest? | * not looking up anything about sorting algorithms, how would you implement an algorithm to take an arbitrary list of values and cause them to be arranged in order from least to greatest? | ||
- | In future projects we will be looking at the specifics of established, | + | In future projects, we will be looking at the specifics of established, |
Additionally, | Additionally, | ||
Line 19: | Line 20: | ||
* ask copious, clarifying questions (so you can better add content) | * ask copious, clarifying questions (so you can better add content) | ||
* craft a coherent and organized document, with information located under pertinent headings | * craft a coherent and organized document, with information located under pertinent headings | ||
- | * explain the fundamentals of the process, conceptual background, algorithmic approach, and you can even suggest particulars related to TIC-80 (certain functions that might prove useful- individual, unrelated snippets to do things like capturing time, or displaying text, etc.) | + | * explain the fundamentals of the process, conceptual background, algorithmic approach, and you can even suggest particulars related to TIC-80 (certain functions that might prove useful- individual, unrelated snippets to do things like capturing time or displaying text, etc.) |
* to get full credit, each individual that submits must perform no fewer than 4 changes to this document (as viewable from the wiki revision system). Failure to do so will result in documentation penalties being applied. | * to get full credit, each individual that submits must perform no fewer than 4 changes to this document (as viewable from the wiki revision system). Failure to do so will result in documentation penalties being applied. | ||
Line 25: | Line 26: | ||
====Process==== | ====Process==== | ||
+ | |||
+ | ==Randomness within Lua== | ||
+ | |||
+ | The function `math.random()` within Lua generates a pseudo-random integer within a set bound (if there are no arguments, it defaults to 0-1). This can be used to generate your list of numbers if you want the numbers themselves to be random. The generated integer can be stuck within an array (or just a bunch of fixed integers, your choice) and BOOM, there' | ||
+ | |||
+ | To maintain unique values one must constantly be checking if a randomized value //already// exists in the list. Completely random and mostly random have different visuals for your animations, they are both worth trying out to see how that affects the animations. Whichever one you stick with is up to you, but try them both. | ||
+ | |||
+ | Surprisingly, | ||
+ | |||
+ | Random values do not just have their usage with random values in an array, but may be used to randomize the algorithm used depending on how the game will work. | ||
==A Sort Synopsis== | ==A Sort Synopsis== | ||
- | Broadly, to " | + | Broadly, to " |
Imagine (or physically use) a deck of cards, Ace through Ten. Shuffle them, and arrange them (in the random order produced) in a straight line. Taking a slight detour back into the theoretical realm, understand that a computer is only really capable of " | Imagine (or physically use) a deck of cards, Ace through Ten. Shuffle them, and arrange them (in the random order produced) in a straight line. Taking a slight detour back into the theoretical realm, understand that a computer is only really capable of " | ||
- | To illustrate the idea of a swap more clearly:\\ | + | To illustrate the idea of a swap more clearly: |
< | < | ||
Original: [5, | Original: [5, | ||
Line 39: | Line 50: | ||
Swapped : [1, | Swapped : [1, | ||
</ | </ | ||
+ | |||
+ | |||
====Display==== | ====Display==== | ||
- | **Among** the many possibilities for display, the classic example of variably-sized bars tends to come to mind, and, using the scaling techniques that may have been employed in pnf3, this can be accomplished relatively simply by defining the size and position of some rectangles based on the stored value of array positions and their offsets and scaling them to the size of the screen. After that is initially determined, the scaling value may be applied | + | **Among** the many possibilities for display, the classic example of variably-sized bars tends to come to mind, and, using the scaling techniques that may have been employed in pnf3, this can be accomplished relatively simply by defining the size and position of some rectangles based on the stored value of array positions and their offsets and scaling them to the size of the screen. After that is initially determined, the scaling value may be applied to allow the user to experience the wonders of the TIC80 sorting program (this should be recalculated once per frame with the current state of the array). |
+ | |||
+ | Another idea, perhaps more similar to the approaches that many seem to explore in pnf3, would be to arrange the numbers on the screen in some order representing their positions in the array. This can simply be done by having a function print the array indices in order after every swap. In this print function - one can also have some if statements that variably determine the spacing in between the numbers, depending on the size of the randomly generated list. This allows fewer numbers to fill the screen more and allows for more numbers to fit on the screen. | ||
+ | |||
+ | If scaling is not your forte, then numbers can be generated from the lowest pixel position possible to the highest pixel position possible. This is essentially the equivalent of scaling since numbers cannot be represented by pixel positions higher than the bounds of the screen. Both scaling and non-scaling algorithms are fine, and lead to essentially the same thing; one may bring more variation over the other though (scaling). | ||
- | Another idea, perhaps more similar to the approaches that many seem to explore in pnf3, would be to arrange the numbers on the screen in some order representing their positions in the array. | ||
=====References===== | =====References===== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | https:// | ||
+ | |||
+ | https:// | ||
+ | |||
+ | http:// | ||
=====Submission===== | =====Submission===== | ||
+ | |||
+ | 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: | ||
Line 58: | Line 99: | ||
Additionally: | Additionally: | ||
- | * Solutions not abiding by **SPIRIT** of project will be subject to a 25% overall deduction | + | * Solutions not abiding by **SPIRIT** of the project will be subject to a 25% overall deduction |
* Solutions not utilizing descriptive why and how **COMMENTS** will be subject to a 25% overall deduction | * Solutions not utilizing descriptive why and how **COMMENTS** will be subject to a 25% overall deduction | ||
* Solutions not utilizing **INDENTATION** to promote scope and clarity will be subject to a 25% overall deduction | * Solutions not utilizing **INDENTATION** to promote scope and clarity will be subject to a 25% overall deduction | ||
* Solutions lacking **ORGANIZATION** and are not easy to read (within 90 char width) are subject to a 25% overall deduction | * Solutions lacking **ORGANIZATION** and are not easy to read (within 90 char width) are subject to a 25% overall deduction | ||
+ | |||
+ | **How Do?** | ||
+ | |||
+ | In your pi's home directory, you can " | ||
+ | |||
+ | "find . -name *.tic" | ||
+ | |||
+ | This lists the paths for these files, enabling you to copy(cp) them into the location of your choice (possibly in SEMESTER/ | ||
+ | |||
+ | From there, you can add and commit this file into your repository, making it available to access on the lab46 servers. Once you push it from the pi and pull it from lab46, you can submit that .tic file in all of its original glory. |