Table of Contents

Corning Community College

CSCS1320 C/C++ Programming

Project: NUMBER GAME FUN (ngfX)

Objective

To create an increasingly detailed program logic that implements and displays a playing field of a defined number/logic game.

NOTE

Due to similar descriptions among the range of projects, I have condensed everything into one common project page. Where you see “ngfX” please substitute the particular project you are working on (ie “ngf0”, “ngf1”, etc.)

Abstraction

As an exercise in toning your abstraction abilities (literally seeing one thing, but understanding and using it as something else), there will be a number of 'generic' terms used throughout this (and other) documents throughout the course, requiring you to substitute in the pertinent information (else face confusion or error).

Some examples:

  • yourusername - where you see this (likely in a config file or command-line argument), you are NOT to literally type in y-o-u-r-u-s-e-r-n-a-m-e, but instead, substitute in YOUR lab46 username.
  • desig - different classes have different class designations. To make one universal document pertinent to ALL classes, specific examples will instead use 'desig', where you must substitute in the class desig of the class YOU are taking and acting upon in that moment. Example class desigs:
    • c4eng - ENGR1050 “C for Engineers”
    • cprog - CSCS1320 “C/C++ Programming”
    • unix - CSCS1730 “UNIX/Linux Fundamentals”
    • data - CSCS2320 “Data Structures”
    • discrete - CSCS2330 “Discrete Structures”
    • comporg - CSCS2650 “Computer Organization”
    • sysprog - CSCS2730 “Systems Programming”

This sort of abstraction is very similar to that we will find in our utilization of variables in programming, where we can have a “name”, but the data associated with it can change based on various conditions.

Do not be a literalist computer! Start to exercise your abstraction abilities.

2021/01/25 11:37

Locational Awareness

This document is written with TWO locations in mind:

  • lab46 (the system you may retrieve resources and SUBMIT projects)
    • identified in examples with the use of the lab46:~$ prompt
  • your pi (the system you will transfer resources to/from, and WORK ON/COMPLETE projects)
    • identified in examples with the use of the yourpi:~$ prompt

There are commands you can ONLY run on one system or the other. Pay attention to any prompt cues in the given examples (or section headings, context of language leading up to any examples).

For example:

  • YOU cannot install software on lab46. You don't have access.
  • projects CANNOT be SUBMITTED on your pi.

Please pay attention to your prompt, so you can perform the needed activity on the correct system.

2021/01/25 11:37

Reading

Please be sure to familiarize yourself with the pertinent content in:

Please familiarize yourself with the table of contents and or index of the various resources, and sample various content to connect yourself with deeper understanding into the concepts being called upon in the current activity.

On your pi

Develop and test this program on your pi. Only when done, verify that it compiles on lab46.

To utilize the needed functionality for this project, you will need to ensure you have the following packages installed:

NOTE: make sure you, for the purposes of your activities pertaining to this class, that you are using your SEMESTER repository.

Specifications

Your program should:

Grabbing project resources

To obtain project data, you will need to satisfy the following prerequisites:

If all those conditions are met, you can use the grabit tool to obtain the project, as follows:

lab46:~/src/SEMESTER/DESIG$ grabit DESIG ngfX
make: Entering directory '/var/public/SEMESTER/DESIG/ngfX'
'/var/public/SEMESTER/DESIG/ngfX/Makefile' -> '/home/USER/src/SEMESTER/DESIG/ngfX/Makefile'
'/var/public/SEMESTER/DESIG/ngfX/README' -> '/home/USER/src/SEMESTER/DESIG/ngfX/README'
'/var/public/SEMESTER/DESIG/ngfX/ngfX.c' -> '/home/USER/src/SEMESTER/DESIG/ngfX/ngfX.c'
'/var/public/SEMESTER/DESIG/ngfX/ref_ngfX.aarch64' -> '/home/USER/src/SEMESTER/DESIG/ngfX/ref_ngfX.aarch64'
'/var/public/SEMESTER/DESIG/ngfX/ref_ngfX.armv7l' -> '/home/USER/src/SEMESTER/DESIG/ngfX/ref_ngfX.armv7l'
'/var/public/SEMESTER/DESIG/ngfX/ref_ngfX.x86_64' -> '/home/USER/src/SEMESTER/DESIG/ngfX/ref_ngfX.x86_64'
'/var/public/SEMESTER/DESIG/ngfX/tttX.c' -> '/home/USER/src/SEMESTER/DESIG/ngfX/tttX.c'
make: Leaving directory '/var/public/SEMESTER/DESIG/ngfX'
lab46:~/src/SEMESTER/DESIG$ 

At which point you can change into the newly created and populated ngfX directory.

Compiling

Since the grabit brought in a Makefile, you can compile your code simply by typing: make

Any compiler errors will go into a text file called errors; you can view any of these generated compile-time messages by viewing the error files: cat errors or less errors

To do a full cleaning, run: make clean then make (or make debug)

If you'd like to see compiler messages as you compile (versus having them go into the errors file, run: make debug

When done and ready to submit, on lab46: make submit

Raspberry Pi command-line via SSH/MOSH

If you don't have a monitor, you likely are logging into your pi remotely (doable, and good intra-system practice)

Once your ngfX project files are 'hg' added to your repository on lab46, commit and push.

On your pi, to obtain those files there, be sure to be in your repository, and 'hg' pull and update.

NOTE: To avoid repository conflicts, ALWAYS check for any incoming pull/update transactions before doing a commit/push. Problems occur when you forget (this is an issue on both lab46 and your pi).

Compile:

lab46:~/src/SEMESTER/DESIG/ngfX$ make

and run your program:

lab46:~/src/SEMESTER/DESIG/ngfX$ ./ngfX.ARCH

Submission

To successfully complete this project, the following criteria must be met:

To submit this program to me using the submit tool, run the following command at your lab46 prompt:

lab46:~/src/SEMESTER/DESIG/ngfX$ make submit

Project backup process commencing

Taking snapshot of current project (ngfX)      ... OK
Compressing snapshot of ngfX project archive   ... OK
Setting secure permissions on ngfX archive     ... OK

Project backup process complete

Submitting DESIG project "ngfX":
    -> ../ngfX-DATESTAMP-HOUR.tar.gz(OK)

SUCCESSFULLY SUBMITTED
lab46:~/src/SEMESTER/DESIG/ngfX$ 

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.

What I'll be looking for:

SCORE:ngfX:final tally of results (SCORE/TOTAL)
*:ngfX:obtained via grabit by Sunday before deadline [#/#]
*:ngfX:program compiles successfully, no errors [#/#]
*:ngfX:program compiles with no warnings [#/#]
*:ngfX:program performs stated task/algorithm [#/#]
*:ngfX:program output conforms to formatting expectations [#/#]
*:ngfX:proper error checking and status reporting performed [#/#]
*:ngfX:code implements solution using relevant concepts [#/#]
*:ngfX:code updates committed/pushed to lab46 semester repo [#/#]
*:ngfX:code uses correct variable types and name lengths [#/#]
*:ngfX:project is submitted with relevant and complete source [#/#]
*:ngfX:project is submitted on lab46 using 'make submit' [#/#]
*:ngfX:project is submitted with pi and lab46 binaries [#/#]
*:ngfX:runtime tests of submitted program succeed [#/#]

Additionally:

project (ngfX) point item (#) total points (TOTAL)
ngf0 1 13
ngf1 2 26
ngf2 3 39
ngf3 4 52
ngf4 5 65
ngf5 6 78
ngf6 6 78