SC‐Homework‐01 - TheEvergreenStateCollege/upper-division-cs-23-24 GitHub Wiki
Software Construction, Spring 2024
Homework 01
Setup
Follow this Software Setup to get a working GitPod workspace on a school computer, or your own personal laptop.
This homework has three parts.
- Git-Tac-Toe
- Reading
- Rustlings
Do the Git-Tac-Toe
part first while you are in lab, since it requires a partner and it is easiest to do when you are both together.
The other parts can be done offline and by yourself, although you are welcome to discuss and collaborate with others as well.
Each student will be checked off and asked about their work individually.
Part 1. Git-Tac-Toe
From the morning session, you'll be assigned a partner to play a tic-tac-toe game by editing text files in one of the game-xx
repositories following the instructions below.
In lab, you'll be randomly assigned one of the game-xx
repositories by Winston or Paul, where xx
will be a number from 01
to 15
You can go to the repository for that game by visiting a URL like
https://github.com/TheEvergreenStateCollege/game-xx
where you'll replace xx
with your assigned number.
Play A First Game
- Both partners should sit at neighboring computers and both login, starting up their GitPod workspaces or development environment.
- If one or both partners doesn't have a GitPod account yet,
- Decide which of you will be
X
orO
. Flip a coin to decide who will go first (call them Partner 1, and the other Partner 2) - In their respective GitPod workspaces, both partners will change to the corresponding directory
cd sc-24sp/git-games/game-xx
- Repeat until one Partner has won. Keep track of your moves starting with Move 1.
- Partner 1, on their dev environment, will
git pull
to retrieve any changes (usually ingame.txt
), and merge any conflicts. - Partner 1 will then edit the file
game.txt
by placing their moveX
orO
. - Partner 1 will commit and push their move on
main
branch to the remote repo.git add -u .
- `git commit -m "Make move ."
git push
- Partner 2, on their dev environment, will
git pull
to retrieve any changes (usually ingame.txt
), and merge any conflicts. - Partner 2 will then edit the file
game.txt
by placing their moveO
orX
. - Partner 2 will commit and push their move on
main
branch to the remote repo.git add -u .
- `git commit -m "Make move ."
git push
- Partner 1, on their dev environment, will
Play a Second Game, Revising the Past
If one player won, discuss the earliest past move where one player could have changed the outcome of the game.
View the commit history in your git game repo, again substituting your game number for xx
in this repo URL.
https://github.com/TheEvergreenStateCollege/game-xx/commits/main/
Let's the earliest past move has commit hash abcdef1
where Player Y made a particular move.
Player Y (with the other player's permission of course) will now redo the move to one where they think they have a chance to change the outcome of the game.
git checkout abcdef1
git checkout -b redo
Then repeat the procedure, pulling and pushing, as in the first game starting from this new move, until the game ends again.
Questions
Consider the following questions for your checkoff.
- Is there always a winning strategy?
- Under what conditions?
- If not, give a counterexample.
- If there is a winning strategy, how would you describe it in English?
- Is there a way to express this strategy in pseudo-code?
Part 2. Reading
Read and do the exercises in The Rust Interaction Book for the first four chapters:
Rust Book: Chapter 01 - Getting Started
Rust Book: Chapter 02 - Guessing Game
Rust Book: Chapter 03 - Concepts
Rust Book: Chapter 04 - Ownership
Part 3. Rustlings
In your GitPod workspace, change into the sc-24sp/rustlings
directory and run the command
rustlings watch
You can open another terminal and change to the same sc-24sp/rustlings
directory to run the command
rustlings hint <exercise_file_name>
as needed.
As shown in the screenshot below, complete the Rustlings exercises by typing into the files
00-intro
01-variables
02-functions
03-if
04-primitive-types
05-vecs
06-move-semantics
In GitPod, your files are autosaved as you type, and the rustlings watch
terminal will automatically recompile
and let you know whether your current exercise file is complete, or the compile error in the next file if you remove the
comment line // I AM NOT DONE
Do not add or commit your rustlings
work. The rustlings
directory is gitignore
'd and you'll be checked off in-person.
Checkoff
There is nothing to submit online for this assignment. You'll be checked off in-person by Paul during the Monday afternoon session.
Do your best and ask questions if you get stuck.
Use the same browser (school computer or your own laptop) where you solved the exercise in order to save your answers.