User Tools

Site Tools


Sidebar

projects

wcp1 (due 20240828)
wcp2 (due 20240904)
pct0 (bonus; due 20240905)
pct1 (bonus; due 20240905)
pct2 (due 20240905)
abc0 (due 20240906)
gtf0 (due 20240911)
pct3 (bonus; due 20240911)
wcp3 (due 20240911)
dtr0 (due 20240918)
pct4 (due 20240918)
wcp4 (due 20240918)
pct5 (bonus; due 20240926)
stl0 (due 20240926)
wcp5 (due 20240926)
gfo0 (due 20241002)
pct6 (due 20241002)
stl1 (due 20241002)
wcp6 (due 20241002)
pct7 (bonus; due 20241009)
stl2 (due 20241009)
wcp7 (due 20241009)
bwp1 (bonus; due 20241016)
pct8 (due 20241016)
ptb0 (due 20241016)
wcp8 (due 20241016)
pct9 (bonus; due 20241023)
ptb1 (due 20241023)
wcp9 (due 20241023)
gfo1 (due 20241030)
pctA (due 20241030)
ptb2 (due 20241030)
wcpA (due 20241030)
pctB (bonus; due 20241106)
wcpB (due 20241106)
wus0 (due 20241106)
pctC (due 20241113)
wcpC (due 20241113)
wus1 (due 20241113)
pctD (bonus; due 20241120)
wcpD (bonus; due 20241120)
wus2 (due 20241120)
bwp2 (bonus; due 20241204)
gfo2 (due 20241204)
pctE (bonus; due 20241204)
wcpE (bonus; due 20241204)
EoCE (due 20241216)
haas:fall2024:c4eng:projects:gtf0

Corning Community College

ENGR1050 C for Engineers

PROJECT: Graphics To Figure-out (GTF0)

OBJECTIVE

As we start our journey into programming, despite not yet having learned much, let us see how our observational and pattern-matching and problem solving skills can still yield productive changes toward the solution of a task.

TASK

You are to modify provided code, once functionality and operations of it are understood, to produce, as image output, a scene containing the following characteristics:

  • confined within a square resolution of at least 1000×1000 pixels
  • contain at least:
    • 1 filled rectangle, no shorter than 32 pixels on any side
    • 1 unfilled rectangle, no shorter than 64 pixels on any side
    • 1 circle, diameter no smaller than 128 pixels
    • 1 ellipse
    • utilize at least 8 uniquely mixed colors
    • NOTE: background not a substitute for required filled rectangle above
  • annotate your image with your initials, ideally in some corner

EDIT

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

GTF0

GRABIT

Just typing in grabit will send you back an error, saying you need a designation and project. It it will then show you a list of designations. You will want c4eng. If you just type in “grabit c4eng” into the prompt, it will still pop back an error, but it will give you a list of projects to pick from. For this specific project, you will want to type in “grabit c4eng gtf0” into the prompt.

NOTE: Make sure you're in the correct directory before you move the files! In this case, you want to be in your repository.

REPOSITORY STEPS

No src? Type into the prompt “fixrepo”. This clones the repositories Matt set up for us this semester. Follow the instructs as they show up on the screen. No need to set up a passkey.

Now, a new directory will appear when you use the ls command, called src. Type in “cd src” to get into this new directory. If you use the command “ls” again, you will see two directories, fall2024 and unix. You will want to cd into fall2024, this is where your semester repository is stored. If you don’t have c4eng as an available directory when you use the ls command, type in “mkdir c4eng“ (mkdir stands for make directory). The cd into the new c4eng. You will keep all of projects here. Nothing is here yet, so you will have to use the grabit command.

BUILD THE CODE

In order to build the code you first need to follow the steps above labeled “grabit” in order to get the gtf0 project file into your repository. After retreiving the gtf0 project file, you should enter the file using the command “cd gtf0”. This command will change where you are in your repository to the gtf0 project file. Then if you use the command “ls”, you will see that there are two files inside of the gtf0 directory. The files are “Makefile” and “gtf0.c”. The “gtf0.c” file is the file that contains the code in which you will be editing and changing in order to complete the project. In order to access the file and to edit the code you use the command “vim gtf0.c” or “nano gtf0.c” depending on which text editor you would like to edit inside of.

RUN THE PROGRAM

In order to run the program we will run the command “make” while inside of the gtf0 directory. After using the “make” command use ”./gtf0“ and this command will create a png file for the gtf0.c code inside of the gtf0.c file which can then be moved and viewed.

VIEW THE IMAGE

in Lab46, ensure you are in the directory where you executed ” gtf0 “. Run the ” ls “ command, you should see ” gtf0.png “ in your current directory

Run the following move command ” mv gtf0.png ~/public_html “ to move the image file to a viewable website

Run the ” ls “ command, if ” gtf0.png “ is no longer in your current directory then it was successfully moved

In a web browser, navigate to the following URLhttps://lab46.g7n.org/~USERNAME/gtf0.png

replacing ” USERNAME “ with your lab46 username, make sure to keep the tilde ”~“

Your output image should be displayed

If you get a ” 404 not found “ error, run the following command in lab46 ” cd ~/public_html

Then run the command ” ls “, if the following ” gtf0.png “ is not listed as a file contained within the directory it was not successfully moved, review the first step

LIBGD FUNCTIONALITY

MIXING A COLOR
DRAWING A LINE

Use Function “gdImageLine (image, starting-X, starting-Y, terminating-X, terminating-Y, color);”

DRAWING A RECTANGLE

Use function “gdImageRectangle (image, top left-X, top left-Y, bottom right-X, bottom right-Y, outline color);”

FILLING AN ENCLOSED SPACE

Use code, “gdImageFill (image, x-coordinate, y-coordinate, color to fill);”

DRAWING A FILLED RECTANGLE

Use code, “gdImageFilledRectangle (image, x-coordinate, y-coordinate, final x-coordinate, final y-coordinate, color);”

DRAWING A CIRCLE

Use code, “gdImageArc (image, center x-coordinate, center y-coordinate, diameter x, diameter y, start angle, end angle, color of the outline);”

DRAWING AN ELLIPSE

Use code “gdImageArc (image, center x-coordinate, center y-coordinate, diameter x, diameter y, start angle, end angle, color);” (make sure the x and y diameters do not match - you WILL end up with a circle)

 

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.
  • All code must compile cleanly (no warnings or errors)
    • Compile with the -Wall and --std=gnu18 compiler flags
    • all requested functionality must conform to stated requirements (either on this document or in a comment banner in source code files themselves).
  • 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 explicit 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 (make submit on lab46 will do this) 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:

39:gtf0:final tally of results (39/39)
*:gtf0:modified code appropriately to accomplish task [13/13]
*:gtf0:commented code adequately to describe process [13/13]
*:gtf0:removed unused code [13/13]

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 256 bytes (absolute value of data content change))
      • near the class total content contribution average (a value of at least 1kiB)
      • 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/c4eng/projects/gtf0.txt · Last modified: 2024/08/26 14:18 by 127.0.0.1