This website was created by Patrick Hahn, Ali Schneider, and Zach Kaplan as our final project for COMP 426 (Advanced Web Programming) at UNC Chapel Hill. The user plays a simple board game against an AI opponent, which uses a minimax search algorithm with alpha-beta pruning to choose a move that maximizes its expected utility.
I'm not sure how long this link will continue to work, as our Codiad workspaces will likely be cleared at some point after the end of the course, but for now the site can be accessed at http://wwwp.cs.unc.edu/Courses/comp426-f15/users/phahn/Codiad/workspace/cs426/final/client-side/index.html
The code in the repository is stored online by GitHub, but you will create a local copy of the repository on your machine to work on. Each time you start working on the project, you will manually download the changes that were pushed by other team members since your last session, and you will "commit" (save) and "push" (upload to main repository) whenever you have a significant change.
To create a local copy of the repository that you can make changes to, open your terminal and move into the directory where you want to set up your local copy. There is no need to create a new directory, as the git clone
command will create the directory. Next, use the command
git clone https://github.com/patrickhahn/minimax-game.git
Now you should have a directory called 'minimax-game' which contains all the code from this repository.
The code in your local repository will not update automatically in response to changes by other team members. All changes are pushed to the remote repository on GitHub, so you must manually "pull" (download) these changes to your local repository. Each time you start working on the project or whenever a teammate makes changes, move into the 'minimax-game' directory and run
git pull
If you have made changes in your local repository since your last push, you will want to apply your changes on top of the ones you are downloading, so you should commit any uncommitted changes (more on that later) and run
git pull --rebase
instead, so your changes will be applied.
Whenever you have made a significant change you want to add, you must commit your changes, which 'saves' them to the repository along with a log message describing the changes. To commit, first make sure you are in your local 'minimax-game' directory and run
git status
to see which files were modified or added. If everything looks correct, you can stage all these changes for commit by running
git add -A
Now that everything is staged, you can run
git commit -m "INSERT COMMIT MESSAGE HERE"
and now all your changes are committed in the local repository. Before you push to the remote repository, you'll want to run git pull --rebase
to pull in any changes your teammates might have made while you were working to avoid any conflicts. Finally, run
git push
to push your changes to the remote repository. You can go on the github page and check the list of commits, and the commit you just made should now show up in the log, since it was pushed to the main repository.
My general workflow look something like this each time I sit down to work on the project:
-
Open terminal and navigate to 'minimax-game' directory
-
Run
git pull
or, if you have uncommitted changes left over from your last session, commit them and rungit pull --rebase
. If you don't want to commit the changes quite yet, you also have the option of doing agit stash
to hide your changes before pulling, then rungit pull'' followed by
git stash pop``` to get your changes back. -
Write code!
-
You have code you want to push
-
git status
, make sure everything looks right -
git add -A
to stage changes -
git commit -m "insert messge here"
to commit changes -
git pull --rebase
in case someone made changes while you were working. -
git push
to push changes to everyone. -
Return to step 3
If you are still confused about how to git, Codecademy has a short git course you could check out: https://www.codecademy.com/learn/learn-git
Also, you can refer to the official git documentation here: https://git-scm.com/documentation