CMPS-3350 Software Engineering
Lab-2
Overview:
In this lab, you will:
Setup your lab-start script... Log on to Odin server then do the following...cd cp /home/fac/gordon/p/3350/lab-start.sh . cp /home/fac/gordon/p/3350/lab-fix.sh .(note the space before the period) now do the following..../lab-start.sh
At the beginning of each lab, execute the lab-start.sh script. Execution of lab-fix.sh script is not always necessary.
Change to your 3350/2 folder and get source code from last week...cd 3350/2 cp ../1/lab1.cpp lab2.cppCompile and run your program...g++ lab2.cpp -Wall -lX11 -lGL -lGLU -lm -o lab2 ./lab2
Create your git repository on Odin for this lab. 1. Change to your 3350 directory.cd cd 33502. Create a "bare" repository:git init lab2.git --bareYou just created a bare git repo that will hold your lab-2 assignment. 3. Change back to your 3350/2 foldercd 24. Create a (not bare) repository there:git init git add lab2.cpp git add Makefile git commit -m "my first commit" git log5. Push your project's master branch to the bare repository.git push ../lab2.git masterYour git repository is now ready to be cloned remotely. note: The files in your 3350/2 folder are no longer needed, but you may leave them in-place.
Do your lab coding on your local computer. 1. Go to the Desktop folder on your classroom computer. (Open a terminal and change to Desktop.) 2. Enter the following...git clone yourname@odin:/~yourname/3350/lab2.gitYou will be asked for your password. A lab2 directory should now be on your local computer's Desktop. Your instructor will look for this directory. 3. Change to lab2, and enter the following:ls -alYou should see your files and also the .git folder. When ready, build and run the lab2 program.
Note: You can clone your repo from home or other off-site location by using the complete Odin address. For example...git clone yourname@odin.cs.csub.edu:/~yourname/3350/lab2.gitThe tilde ~ takes you to your home directory.
Together we will modify the lab2.cpp program. We already did some of this in class. 1. Create a Makefile 2. Refactor the program
This step is done anytime during class, or when the lab is complete. From your local machine, update your git repository:git add lab2.cpp git commit -m "my changes during lab class" git push origin masternote: Do not execute: git add * <----- no
What to do... 1. Create your personal account on Github. Please make this a public account. 2. Create a bare repository on Github named lab2 3. Push your lab2.git repo to Github... DETAILS . Clone your lab2.git to your Desktop. Do the steps below from your Desktop/lab2 folder. (change to your lab2 folder) . Remove the .git folder. Create a new repocd Desktop cd lab2 pwd rm -ri .git. Set the remote origin (command provided by github)git init git add * git commit -m "my first commit for lab-2". Push the repo up to your lab2 repository.(different for each student). Github website has clear instructions on how to get this done. 4. So that Gordon can clone your lab2 repository, you must provide your Github account name. Do it like this... a. Go to your Odin 3350/2 folder. b. Create a text file named: my_github.txt c. Enter the URL of your github account. When you are at the home page of your github account, copy the URL in the address field. Enter just 1-line into your file. No blank lines. No extra stuff. The string you enter will be used in a git clone command. Gordon will append the /lab2, not you. You can test this yourself.git push origin masterGordon will clone your repository this way. Do not put the /lab2 in your my_github.txt file.git clone your-string/lab2
Modify the lab2.cpp program.Add the following functionality... 1. Make the color of the moving box change based upon the rate at which it is bouncing off the left and right walls. You can change the bounce-rate by changing the window size using the mouse. As the box bounces more frequently, make the color turn more red. As the box bounces less frequently, make the color turn more blue. 2. If the window width becomes smaller than the box width, there will be no bouncing, so make the box disappear. 3. Make the box go slightly up or down when it moves. Make it bounce off the floor and ceiling of the window. 4. Designate a key-press that will slow-down and speed-up the animation. There are many different ways to code a solution to these things.