User Tools

Site Tools


notes:discrete:fall2021:projects:pnf0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:discrete:fall2021:projects:pnf0 [2021/09/01 06:03] – Added new 'input' section, also fixed section spacings smalik3notes:discrete:fall2021:projects:pnf0 [2021/09/05 12:05] (current) – [Submission] wedge
Line 81: Line 81:
   * Lower bound: 2   * Lower bound: 2
   * Upper bound: <m>sqrt{n}</m>   * Upper bound: <m>sqrt{n}</m>
 +     * If taking unoptimized route, upper bound can just be //n - 1//.
  
 Both of these bounds may be confusing, let me explain... Both of these bounds may be confusing, let me explain...
Line 93: Line 94:
   * How can we test if a number divides cleanly by //n//?   * How can we test if a number divides cleanly by //n//?
      * Hint: remainder "%"      * Hint: remainder "%"
-  * How can we square root in our code for the upper bound?+  * How can we implement a square root in our code for the upper bound?
   * How do we deal with testing the numbers 0 and 1?   * How do we deal with testing the numbers 0 and 1?
  
Line 99: Line 100:
  
 The `print` function can be used to print text on the screen, but it also returns the width of the text. For example, `local string=print("Hello, World!",0,0,12)` would not only print the text on the screen, but it would also give the local variable `string` a value equal to the width of "Hello, World!" in pixels. This is especially helpful if you want to display a sprite after a string, but you don't feel like counting out how much space you need manually. The `print` function can be used to print text on the screen, but it also returns the width of the text. For example, `local string=print("Hello, World!",0,0,12)` would not only print the text on the screen, but it would also give the local variable `string` a value equal to the width of "Hello, World!" in pixels. This is especially helpful if you want to display a sprite after a string, but you don't feel like counting out how much space you need manually.
 +
 +Additionally, text can be appended to `print` alongside variables without the need for two separate lines of code/statements using `..`. For example, if you wanted to print "Times iterated: " and then a number contained within a variable, instead of doing two `print`s for the text and variable individually, you could do `print("Times iterated: "..variable,0,0,12)'.
  
 The `time` function returns the current run-time of the program in milliseconds. This is useful in a variety of circumstances; having something happen at a specific timestamp, having things refresh at a certain interval, etc. For pnf0, specifically, expertly utilizing `print()` alongside `time()` would display the current run-time in seconds, which is a requirement. The `time` function returns the current run-time of the program in milliseconds. This is useful in a variety of circumstances; having something happen at a specific timestamp, having things refresh at a certain interval, etc. For pnf0, specifically, expertly utilizing `print()` alongside `time()` would display the current run-time in seconds, which is a requirement.
Line 105: Line 108:
  
 https://github.com/nesbox/TIC-80/wiki https://github.com/nesbox/TIC-80/wiki
 +
 +http://lua-users.org/wiki/MathLibraryTutorial
 +
 +=====Submission=====
 +To submit, provide your tic file using the **submit** tool on lab46.
 +
 +I'll be looking for the following:
 +
 +<code>
 +65:pnf0:final tally of results (65/65)
 +*:pnf0:no errors, program runs in TIC-80 [13/13]
 +*:pnf0:user can specify lower and upper bounds at runtime [13/13]
 +*:pnf0:specified algorithms are implemented and functional [13/13]
 +*:pnf0:timing information is displayed [13/13]
 +*:pnf0:project page contributions as per project specifications [13/13]
 +</code>
 +
 +Additionally:
 +  * Solutions not abiding by **SPIRIT** of 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 **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
notes/discrete/fall2021/projects/pnf0.1630476197.txt.gz · Last modified: 2021/09/01 06:03 by smalik3