User Tools

Site Tools


Sidebar

projects

wcp1 (due 20240828)
btt0 (due 20240904)
wcp2 (due 20240904)
pct0 (bonus; due 20240905)
pct1 (bonus; due 20240905)
pct2 (due 20240905)
abc0 (due 20240906)
msi0 (due 20240911)
pct3 (bonus; due 20240911)
wcp3 (due 20240911)
msi1 (due 20240918)
pct4 (due 20240918)
wcp4 (due 20240918)
dsr0 (due 20240926)
pct5 (bonus; due 20240926)
wcp5 (due 20240926)
gfo0 (due 20241002)
pct6 (due 20241002)
pnc0 (due 20241002)
wcp6 (due 20241002)
dsr1 (due 20241009)
pct7 (bonus; due 20241009)
wcp7 (due 20241009)
bwp1 (bonus; due 20241016)
pct8 (due 20241016)
pnc1 (due 20241016)
wcp8 (due 20241016)
pct9 (bonus; due 20241023)
pnc2 (due 20241023)
wcp9 (due 20241023)
gfo1 (due 20241030)
mag0 (due 20241030)
pctA (due 20241030)
wcpA (due 20241030)
mag1 (due 20241106)
pctB (bonus; due 20241106)
wcpB (due 20241106)
mag2 (due 20241113)
pctC (due 20241113)
wcpC (due 20241113)
pctD (bonus; due 20241120)
wcpD (bonus; due 20241120)
bwp2 (bonus; due 20241204)
gfo2 (due 20241204)
pctE (bonus; due 20241204)
wcpE (bonus; due 20241204)
EoCE (due 20241216)
haas:fall2024:discrete:projects:dsr0

Corning Community College

CSCS2330 Discrete Structures

PROJECT: Discrete Skills Review (dsr0)

OBJECTIVE

Influenced by the unix/usr0 'urev' skills review activity, create a program that does the same but for powers of 2 base math and conversions.

This does not have to be written for Vircon32, nor does it specifically have to be in C.

EDIT

You will want to go here to edit and fill in the various sections of the document:

dsr0

powers of two base math

Base 2^1 is 2 2^2 is 4 2^3 is 8 and so on and so forth.

Along with the conversions game mode, other modes should include addition, subtraction, and multiplication. These should all be in the same base already, as a conversion on top of that would be hectic.

powers of two base conversions

For powers of two base conversion, or any type of conversions in bash scripts, it would behoove one to make use of the ibase / obase commands. With them, they can make the conversions of numbers for you. This is helpful for generating prompts and keys alike.

The goal of the conversions game mode should be for the player to be prompted with a number in one base, and be instructed to find the answer in another base (also prompted).

Can use shuf -i alongside an array to randomly generate a base

checking time

By using “date +%r” in the command line you can get the current time which you can use later.

date +%r will give you the time in this format: HH:MM:SS AM/PM

date +%s will give you the time in seconds since the Unix epoch. If you want to use date +%s to get the current minutes, you can divide the output of date +%s by 60; if you want to use date +%s to get the current seconds, you can use the modulus operation (%60).

state file: keeping score across sessions

The best way to keep track of a users score across sessions is to use a file. For simplicity let's call it “info.txt” and assume we are doing this in BASH.

You can either create this file manually for every new user or have the program do it for you! Here is an example of the program doing it:

if [[ ! -f "info.txt" ]] ; then
    touch info.txt
fi

So that may be a lot at once to take in, so let's break it down. This line checks if the file exists, and when combined with an if statement it will do what is in the if statement if the file DOES NOT EXIST*.

    ! -f "info.txt"

This line will make the file

    touch info.txt

Too make our future selves happy lets set up where the data will be put in the file. Things we need:

  • An access time for the next session
  • Amount played
  • Amount right
  • Amount wrong

You can make the code do this by “echoing” into your text file. Here is an example of how to do that (tip: put this in your previous if statement):

    echo "Access Time:" >> info.txt
    echo "Amount Played:" >> info.txt
    echo "Amount Right:" >> info.txt
    echo "Amount Wrong:" >> info.txt

Again let's break that down. Here we are redirecting the output of “echo” to our file info.txt with the «.

    echo "Access Time:" >> info.txt

Inside your program you can use commands like grep, sed, cat, cut, tr, and head to name a few in order to write to and replace the text in info.txt. And don't forget that in BASH you can use | to pipe/connect commands together!

 

SUBMISSION

To be successful in this project, the following criteria (or their equivalent) must be met:

  • Project must be submit on time, by the deadline.
    • Late submissions will lose 33% credit per day, with the submission window closing on the 3rd day following the deadline.
  • Executed programs must display in a manner similar to provided output
    • output formatted, where applicable, must match that of project requirements
  • Processing must be correct based on input given and output requested
  • Output, if applicable, must be correct based on values input
  • Code must be nicely and consistently indented
  • Code must be consistently written, to strive for readability from having a consistent style throughout
  • Code must be commented
    • Any “to be implemented” comments MUST be removed
      • these “to be implemented” comments, if still present at evaluation time, will result in points being deducted.
      • Sufficient comments explaining the point of provided logic MUST be present
  • No global variables (without instructor approval), no goto statements, no calling of main()!
  • Track/version the source code in your lab46 semester repository
  • Submit a copy of your source code to me using the submit tool by the deadline.

Submit Tool Usage

Let's say you have completed work on the project, and are ready to submit, you would do the following:

lab46:~/src/SEMESTER/DESIG/PROJECT$ submit DESIG PROJECT file1 file2 file3 ... fileN

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.

RUBRIC

I'll be evaluating the project based on the following criteria:

130:dsr0:final tally of results (130/130)
*:dsr0:supports powers of two base math problems [26/26]
*:dsr0:supports powers of two base conversion problems [26/26]
*:dsr0:keeps score and track of correct and incorrect responses [26/26]
*:dsr0:shows onscreen base table for earlier problems [26/26]
*:dsr0:serves 12 problems every 4 hours and 20 minutes [26/26]

Pertaining to the collaborative authoring of project documentation

  • each class member is to participate in the contribution of relevant information and formatting of the documentation
    • minimal member contributions consist of:
      • near the class average edits (a value of at least four productive edits)
      • near the average class content change average (a value of at least 1024 bytes (absolute value of data content change))
      • no zero-sum commits (adding in one commit then later removing in its entirety for the sake of satisfying edit requirements)
    • adding and formatting data in an organized fashion, aiming to create an informative and readable document that anyone in the class can reference
    • content contributions will be factored into a documentation coefficient, a value multiplied against your actual project submission to influence the end result:
      • no contributions, co-efficient is 0.50
      • less than minimum contributions is 0.75
      • met minimum contribution threshold is 1.00

Additionally

  • Solutions not abiding by spirit of project will be subject to a 50% 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 or otherwise maintaining consistency in code style and presentation will be subject to a 25% overall deduction
  • Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction
haas/fall2024/discrete/projects/dsr0.txt · Last modified: 2024/09/22 15:16 by 127.0.0.1