Archive for the ‘Programming’ Category

Captcha Your Imagination: Comatile Mom

Thursday, August 26th, 2010

Get Adobe Flash player

I've started making quick prototypes of games out of captchas, because really, "why not?"  A general post mortem follows.


HW2: Some Array Stuff

Thursday, November 5th, 2009

NOTE: Each line item in this homework should be its own function, but we won't talk about functions until week 4. So you should start this assignment and do each line item separately in the program as you are working, so that you can easily move them into functions.

  1. Create an Array with 100 numbers in it. Each number should be randomly generated, and somewhere between 100 and 200.
  2. Make a function that tells us the total of the array.
  3. Make a function that returns true if the array's total is prime.
  4. Calculate the average of the array.
  5. Generate a new array (using the same parameters as above) 100 times, and then return the average TOTAL of each array.
  6. Trace out the "word form" of each number in the array. That is, if the first three numbers in the array are 15, 90, and 22, you should trace out "fifteen, ninety, twenty two".
  7. Set each value in the array to it's negative version.
  8. Make a function that takes in an integer (this can be randomly generated, or entered by the user). This function returns true if the array contains the specified int.
  9. Sort the array (by hand, DO NOT USE the built in sort() function). We will discuss a method for doing this in class.
  10. Tell me the median of the array.
  11. Extra credit: Tell me the mode of the array.

GAD225: HW3

Thursday, October 22nd, 2009

I've decided to keep this as the HW assignment. You should be able to do all of it except for the entering of the character name, which we'll cover next week.

Text adventure time!

1. Allow the user to enter a character name.
1a. Once they do, automatically call a function that generates three stats for their character (you can make up whatever stats you want (let's say the range for each is 1-10).
2. Present them with a menu with Several options options. Selecting any option should call a function specific to that option, each of which is described below.
3. First option: Check status. This should print out their character's name, their 3 stats, and how much health they have left (all characters should start at 100 health), how much experience they have (and what level they are), and how much gold they have (useless for now).
4-6. The nextthree options are yours to make up. Each one should be focused on one (or more) of the character's stats. Each one should feature at least one possible success, and one possible failure, and the results should be random (modified by the appropriate stat, of course). For example, I could have an encounter that involved a hot dog eating contest against Kobayashi. Fortunately, my belly stat is 10. So some random generation happens, if I win, I gain 10xp, 50 gold. If I lose, I vomit, and lose 5 health.
7. 4th option: Use an item. The character has an inventory (array) with five ints in it. Each int represents how many of each item they have. Item[0] is a healing item. Item[1]-[3] are buff items, they should add a random amount to a specific stat for the next encounter. Item[4] is a loot item, that the user can sell for money. Remember, the array just contains integers telling the user how many of each item they have!
8. Last option: Shop. The user can sell any items they have, and buy new ones. This should have its own menu.
9. After any encounter, your program should automatically call a function that checks for leveling up. If the character has 100+ xp, they gain a level, (and lose 100 xp). When they gain a level, one stat randomly goes up by one point.
10. Make it so that the stat-using options above, in some successful cases, drop loot and money.

GAD235: Revisiting Critter Caretaker

Wednesday, July 15th, 2009

Here is an update of what you should have as your starting point for the Critter project in 2D Scripting. If you have a Critter from before, you may want to save it into a new file now with some stuff removed (for now). If you have no Critter, here's what you should make.

Introducing the Title Generator

Monday, March 23rd, 2009

I've been working on a little something for a bit now, and have gotten it to the state where I could put a little demo together for you. It generates random titles, and while the demo allows you to title yourself, it's main purpose is to generate titles for monsters found within the dungeon. Check it out!

GAD235: Sample Files Posted

Monday, January 19th, 2009

If you click over on the GAD235 page, I've uploaded the sample files we discussed in class this past week, as well as the Critter base stuff. I've deliberately left comments out of the critter files, as I think it would be a good exercise for you to go through the files and comment them yourself to figure out how it's working, either as a refresher from last quarter, or to bring you up to speed.

GAD225 HW5: Word Games

Monday, December 1st, 2008

For this project, present the user with the option to play any of the following three games:

1. Hangman, pick a word from your wordlist. Display it with dashes in place of the letters. Allow the user to guess letters (or the complete word as a separate option). Give them a finite amount of guesses. After it's over, allow them to play again with a new word, or go back to main menu.

2. Scramble, pick a word from your wordlist. Display it scrambled. Allow the user to guess the word. After it's over, allow them to play again with a new word, or go back to the main menu.

3. Mastermind. Generate a four digit number using only 1-6 for each digit. Allow the user to guess. Indicate how many numbers are correct, and how many are both correct AND in the right spot.

You can make additional combo options of the above for extra credit.

GAD225 HW: Cards and Decks

Wednesday, November 19th, 2008

As discussed in class on Monday, you need to create a Card object from scratch, as well as a Deck object from scratch. I have provided you with a test class that you are not allowed to change. It can be found here.

Details on the Card and Deck requirements are found below. I've added 2 small things that we didn't discuss in class, so check it out.


GAD225: HW3

Sunday, November 9th, 2008

Due Week 7!

Grab CalendarTester. Fill in the missing functions. There is a pretty good order to fill them in to make your code work with other parts of your code most conveniently, so try and make that happen by reading through all the functions you need first, and figuring out where dependencies lie.

Additionally, in a separate file, Allow the user to enter a number (called n). This is the length of an array for you to create, filled with random numbers between 0 and 2n.

Make functions to do the following:

  • Find the biggest number in the array
  • Find the smallest number in the array
  • Reverse the order of the numbers
  • Find the total of all the numbers
  • Find the Average of all the numbers
  • Extra Credit:  Sort the array, without using the built in sort.

GAD225: Midterm Study Guide

Tuesday, October 28th, 2008

Some key things to study:

  • Be comfortable writing loops.  Be able to look at an existing loop and know how many times it executes.  A good sample problem might be to take the stat generator from an earlier class, and make it loop to generate a specific number of stats.  Or loop until you get the roll you want.
  • Know random number generation.  The above sample problem would help with that too.
  • Be comfortable with the basic math and logic operators.  Know what each does, and their order of precedence.
  • Be able to use truth tables to dissect when a compound logic statement is true.  a && (b || !c) is true in what cases?
  • Be able to trouble shoot code for bugs.  Hopefully your homework has gotten you used to this, as there isn't much I can tell you to study directly.
  • Understand the way that functions work (including parameters and returning values), and be able to separate code out into a function.  CalendarTester will be useful for this.