Archive for March, 2019

Free gift!

Friday, March 29th, 2019

You may have noticed that the syllabus mentions a 50-point writing assignment due Feb. 28th. I never assigned this, since it turned out we had enough work to do without it. I have therefore simply awarded everyone the 50XP for it. Happy Friday!

Don’t let Stephen crush your dreams

Thursday, March 28th, 2019

To clarify: it is perfectly okay to design your Zork++ engine to work with an enhanced .zork (and .sav) file format. You may add entirely new sections, to represent the dungeon’s monsters, character choices, weapons, spells, levels, hyperspace jump points, or anything else you wish.

The only requirement is that if such sections are missing, your game engine should silently tolerate that fact, rather than blowing up with a "illegal zork file format: missing 'Weapons:' section!" type of message.

Sample UC descriptions

Tuesday, March 26th, 2019

From today’s class, the sample use case descriptions, both good and bad.

Mark your calendars!

Tuesday, March 26th, 2019

Friday, April 12th is the 7th Annual UMW Computer Science Department Programming Contestâ„¢! Free pizza, snacks, and drinks will be provided, and teams will begin the contest at precisely 7pm. Normally the fun lasts until about midnight, when the leading teams bear down for a hair-raising neck-and-neck finish.

Note: If you’re a Computer Science major, and/or want to pursue a career in software development, there is pretty much no good reason for you to not be there. (If you find yourself not wanting to come to this, ask yourself why?)

To sweeten the pot even further, I’m offering a guaranteed +2XP and a total of up to +10XP for participating. Here are the rules:

  1. Your team may have two or three students, who do not all have to be CPSC 240 students this semester.
  2. You may code in Java, or any other programming language. (Check with Ian first if it’s something exotic, though, so he can be sure that his contest software will work with it.)
  3. You get +2XP for showing up, eating pizza, and doing your best.
  4. Ian tells me he has eight problems in his super secret set of programming challenges. You and your teammates will receive an additional +1XP for each one you get right.
  5. And heck, for whichever team wins the CPSC 240 category, I’ll even throw in another +5XP to celebrate.

Form your team and get excited! (If you would like to be put on a team, email me well in advance and let me know that as well.)

Second team programming assignment (Zork++ phase 1) posted!

Friday, March 22nd, 2019

The first phase of your team’s Zork++ project has been posted, and is due in just over a week. Dive in! Do not delay! Communicate early and often!

Also, as before, if your team was not able to complete Zork III successfully, you have permission to use my Zork III (in the git bundle “stephenIII.git” in the Files tab on Canvas) as a starting point for your Zork++ project.

Zork II dungeon winner!

Thursday, March 21st, 2019

Congratulations (and two bonus XP) to the author of The Crime Scene, our winning Zork II dungeon!

Quiz #4 is posted!

Thursday, March 21st, 2019

Quiz #4 has been posted to Canvas, and is due at midnight on Monday, March 25th. This quiz is open-book, open-notes, closed-Java, closed-other-Websites, and timed at 45 minutes. It must be taken completely on your own, without any help from others.

Good luck!

Zork hints: ALWAYS start small

Saturday, March 16th, 2019

Just to reiterate a piece of advice I’ve tossed at you a few times, but which is worth tossing again: always, always write the smallest bit of working code you can possibly write, making whatever temporary assumptions are necessary to make that small part work, get it completely compiled and working, and only then move on to the next, more complicated thing.

Here’s a few places where that should play out for Zork III:

  • The player can type “take dvdPlayer” or “take all“, with very different results. When you first start coding TakeCommand, just forget about the “all” option for the time being. Get it working with taking a single item first, and only after that’s working move on to handle “all“.
  • Oh, and of course the player might try to take an object that’s in the current room…or one that’s not. In the latter case, you need to return a “There's no ukulele here” type of message. But just skip this part at first. Make the assumption that the item will be a valid item in the current room. Only after you’ve got that working, then code the error message part.
  • The “initState” variable dictates to the Dungeon constructor whether it should put the items in their original locations or not. But to start off, just assume it’s true! Don’t worry about having to handle both cases at the beginning.
  • Items can have aliases in addition to their primary name. But at first, just skip that part. Assume there are no commas in the first line of an item, and get items working with just a primary name. Then, you can add the part that deals with aliases.
  • Etc.

Learn to make this approach second-nature. Whenever you encounter a programming task, no matter what it is, code it bit by bit, starting with handling only the simplest possible case and gradually making it more generally applicable, until you’re done.

Your git config and mine

Saturday, March 16th, 2019

To change your git configuration settings, you can either specify individual settings on the command line, for instance:

$ git config --global difftool.prompt false

or you can edit your entire git configuration through vim, by typing:

$ git config -e --global

If you’re interested in my own (very few and simple) git configuration settings, they are reproduced below. (You can copy/paste this into vim but remember it’s vim you’re dealing with, so make sure you’re in insert mode before you paste!)


[user]
    email = putyouremailhere@umw.edu
    name = Stephen
[push]
    default = simple
[format]
[diff]
[merge]
    tool = vimdiff
[core]
    editor = vim
[difftool]
    prompt = false
[alias]
    beam = checkout
    unstage = reset HEAD --
    quick-stats = ! /usr/local/bin/git-quick-stats
[diff]
[format]
    pretty = (%h) %Cblue%an%Creset: %Cgreen%s %Creset(%ad)
[diff]
    tool = vimdiff
[log]
    date = short

Sick of typing your github username/password?

Friday, March 15th, 2019

If you get tired of typing your github username/password every time you do a push or pull, follow these well-written instructions to avoid it in future. (Note that you have to click on the blue text links to drill-down and get information on that topic. Note also that you need to be following the “Linux” version of the instructions on these pages. And you’ll be typing all the Linux commands in your Google Cloud instance, not on your local machine. In other words, you must connect remotely to Google Cloud before typing stuff like “ls -al .ssh” and “ssh-keygen blah blah...“.)

Short version: you use the same public/private key technology that you did in CPSC 225 (for Linux/Mac or Windoze) to accomplish this. In this case, however, your client will be your Google Cloud instance, not your own local machine, which is why you’ll be following the “Linux” instructions on that page.

Note: if you originally cloned your team’s repo with the HTTPS option (i.e. a URL starting with “https://...” you will need to change this to use the SSH option instead (a URL starting with git@github.com...). Here’s how:

  1. Log on to your Google Cloud instance and cd to your local repo.
  2. Carefully type the following command:
    $ git remote set-url origin git@github.com:UMWComputerScience/240-spr2019-teamN.git
    

    replacing “N” with the number of your team. You should then be able to push and pull without typing your password.

Whew!