CMPS-3350 Software Engineering
Lab-1
Overview:
In this lab, you will:
Setup your 3350 course directory: setup dir
Log on to the Odin server. Change to your 3350/1 folder. Get some source code... cp /home/fac/gordon/p/3350/code/lab1/lab1.cpp . Compile and run the program: g++ lab1.cpp -Wall -lX11 -lGL -lGLU -lm -o lab1 ./lab1 We will modify this program together on the big-screen at Step-4.
Create your git repository on Odin for this lab. 1. Change to your 3350 directory. cd cd 3350 2. Create a bare repository: git init lab1.git --bare You just created a bare git repo that will hold your lab-1 assignment. 3. Change back to your 3350/1 folder 4. Create a (not bare) repository there: git init git add lab1.cpp git add Makefile git commit -m "my first commit" git log 5. Push your project to the bare repository. Enter the following git push ../lab1.git master Your git repository is now ready to be cloned remotely. note: The files in your 3350/1 folder will no longer be used, 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/lab1.git You will be asked for your password. A lab1 directory should now be on your local computer's Desktop. Gordon will look for this directory. 3. Change to lab1, and enter the following: ls -al You should see your files and also the .git folder. When ready, build and run the lab1 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/lab1.git The tilde ~ takes you to your home directory.
Together we will modify the lab1.cpp program. 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 lab1.cpp git commit -m "my changes during lab class" git push origin master
What to do... 1. Create your personal account on Github. Please make this a public account. 2. Create a bare repository on Github named lab1. 3. Push your lab1.git repo to Github. DETAILS . Clone your lab1.git to your Desktop. Do the steps below from your Desktop/lab1 folder. (change to your lab1 folder) . Remove the .git folder rm -r .git . Create a new repo git init git add * git commit -m "my first commit for lab-1" . Set the remote origin (command provided by github) . Push the repo up to your lab1 repository. git push origin master . Github website has clear instructions on how to get this done. 4. So that Gordon can clone your lab1 repository, you must provide your Github account name. Do it like this... a. Go to your Odin 3350/1 folder. b. Create a text file named: my_github.txt c. Enter the URL of your github account. Enter just 1-line into the file. The string you enter will be used in a git clone command. Gordon will append the /lab1, not you. You can test this yourself. git clone (your string)/lab1 Gordon will clone your repository this way.
Modify the lab1.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 red. As the box bounces less frequently, make the color turn blue. 2. If the window width becomes smaller than the box width, there will be no bouncing, so make the box disappear. There are many different ways to code a solution to this.