This is an old revision of the document!
Corning Community College
CSCS2330 Discrete Structures
Using the TIC-80 fantasy console simulator on your pi, implement a program that performs a sprite-based animated count of a set of LEDs (a minimum of 9) in binary from 0 through the maximum value able to be represented therein.
The three approaches I'd like for you to implement are those of:
The universal restriction: you must not have 2^number of LEDs if statements, one per potential number. That is NOT a feasible way to carry out this approach.
You may want work out these approaches by hand on paper to understand their details and steps of progression, then to implement it.
Additionally, the entire class will be participating in documenting and filling out this project page. It is the responsibility of EACH class member to:
In this method, which is at its core a conversion from base 10 to base 2, the input number is repeatedly divided and rounded down by the base until each of the binary digits are obtained and the input becomes 0.
Since this method relies on repetition until some condition is met, it will occur within a loop after declaring the output variable (which will be a string for this example):
out = "" while (input != 0):
Within this loop, the first step will be to obtain the smallest binary digit from the input number, which we can do via modulo:
... // Insert the smallest obtainable digit at the start of out out = (input % 2) + "" + out // And truncate input, removing the lower obtained portion input = roundDown(input / 2);
By performing that operation until input reaches 0, digits will be successively added until the full binary representation is ascertained.
In terms of display, the basics are as such: two sprites should exist, one which represents an off state (this could also be a blank / no sprite), and one which represents an on state. By showing either of these two sprites as part of some ordered set, a binary number can be represented as if it were 1s and 0s.
I'll be looking for the following:
78:fom0:final tally of results (78/78) *:fom0:no errors, program runs without issue in TIC-80 [13/13] *:fom0:specified algorithms are implemented and functional [39/39] *:fom0:display of sprite based, animated count [13/13] *:fom0:project page contributions as per project specifications [13/13]
Additionally: