Teaching

04/21/08

Home
About Me
Teaching
Research Activities
Photo Gallery
Feedback

 

This page is designed for students in my lab tutorials. You will find many useful materials in this page. Please go through them carefully. However, please note that the materials posted in this section must be credited when used in a program or supplied as supplementary materials to friends or students of another section.

CPSC 335 - Information Structures II

You may need Acrobat Reader (PDF) for the following materials.

IMPORANT NOTICE: The scoring has officially started at 12:00am 04/14/2008. All previous scores has been deleted. Early games are still available for viewing (but they wont count). The Scoring is over on 04/17/2008. The final result has been posted.

FINAL OFFICIAL SCORE MATRIX

FINAL SCORE MATRIX during unofficial time (until 17th April)

Current Assignment Grades

bullet T01: Grades up to Assignment 5 (Posted 04/21/2008)

Useful links and materials

bulletHuffmann Coding - A Wikipedia explaination of the huffman Coding.
bulletTRIE Slides - A number of PPT slides (in PDF format) explaining this organization and application of this tree structure.
bulletTRIE Additional material - An good illustration of TRIE and a basic C++ implementation (code).
bulletTRIE WIKIPEDIA Definition and explanation - A detailed description of the TRIE tree structure and how a spell checking is performed.
bullet AVL Tree Animation - An animated overview of the dynamics involved to maintain an AVL tree.
bullet AVL Trees Cases - A simple representation of the possible cases in an AVL tree.
bulletAVL Trees - A description of the balanced AVL trees.
bulletA Youtube B-Tree Video!!!!! - This "super hot" animated video is a fun way to learn B-Trees!!!
bullet A Java B-Tree Demo - A java applet that visually demonstrates the insertion of elements into a B-Tree.
bulletB-Trees Illustrated - An excellent source I found online that illustrates a B-Tree construction.
bulletB-Trees Introduction (WIKI) -  Basic idea on a B-tree. Has links to other B-Tree related materials.
bullet Java JDK with netbeans - This link will allow you to download and install JDK with Netbeans 6.0. Netbeans is an excellent visual interface for java coding. Once you have used it you wouldn't want to go back to text based. It makes Java programming a breeze with auto-complete and class explorer etc. It will significantly cut down your development time.
bulletDr. Marina Gavrilova - The official website of the course instructor Dr. Marina L. Gavrilova
bullet Jagoda Walny - The course website of the other TA in this course. Her website has useful course materials (always worth checking).
bulletIntroduction to Hash Table - An introduction to hashtables and different forms of hashing techniques (WIKIPEDIA).
bullet Extendible Hashing - A brief description of the Extendible Hashing Technique.
bulletThe Original Extendible Hashing - This is the original paper that introduced the popular extendible hashing technique. Please note that the students does not require to implement this extact method for assignment 1. Nevertheless, it is an excellent paper to read!
 

Sample Programs and solutions

bullet Game Viewer - A Windows application that allows you to connect to the game server and download and view games. Sorry! no linux/mac version.
bullet GameClient - A Java program that implements a random move TicTacToe AI. You MUST NOT MODIFY any of these files except game.java. Please contact me if you have any questions.
bulletHuffmann Decompressor - This is an executable binary for Windows. NOW IT IS ALSO AVAILABLE AS MAC AND LINUX BINARIES/EXECUTABLES. You can use this to decompress the file you compressed with your java code. If your code is correct then this program will regenerate the source file. The zip file contains a sample compressed file containing the message "Hello". Usage: c335 -d source.335 target.txt.
bulletHuffmann C335 Tester - This sample java code uses the LEDataInputStream from the package below to read through a C335 file format! This will definately get you started with the assignment 4. Although this program doesnt implement compression or decompression, it provides a class called BitField, which you will find really useful for this assignment. IMPORTANT: THERE WAS A BUG IN Bitfield.java. THIS IS UPDATED ON FRIDAY 03/28/2008.
bulletLittle Endian Data Stream Package - This package provide source codes to read and write binary files in little endian format (Intel x86). The package contains documentation and sample programs. It is a very useful code.
bulletText File Parser - This is particularly handy for Assignment 3. This will parse a text file and load all the words (either dictionary or spellcheck file). Then you can access every word and their starting row & col in the file by using a simple index. Students are allowed to reuse code from this sample.
bulletJava Accurate Performance Measurement - This sample program shows you a way to measure time accurately in java. Students can reuse code from Timer.java for their assignments. The significance of this program is that it allows sub-millisecond accuracy!!!... All time returned by the Timer class is in milliseconds.
bulletPacking strings and splitting based on hash function - This simple program shows you a way to represent packed string buffers containing multiple words along with their lengths. Later, we show how a split can be performed based on the hash function. This program can be compiled and run.
bulletA Hash Function Implementation - This shows how to construct a hash function that converts a string into a 32 bit hash key. The program uses "long" data type to store bit sequences. Please note that it may be easier to store bit sequence as a "string". Students are cautioned not to confuse this approach with the bit-string based approach. This program can be compiled and run.
bulletA Simple Hash Function - This is another simple example of a hash function. This code is also not an executable. However, it will give the students some ideas.
bulletA Simple Bucket Code - This is a starter for Assignment 1. The code example is compilable, but not executable. The code shows an attempt to create a Bucket class in Java.

 

 

 

CPSC 453 - Computer Graphics

You will need Acrobat Reader (PDF) for the following materials.

Current Assignment Grades

bulletTutorial 2: Fall 2007

Useful links and materials

bulletU of C Graphics Jungle Wiki - A Wiki that has some useful materials including quick 'How to' to get you started with CPSC 453.
bulletOnline OpenGL Tutorials - This is a rich resource for sample OpenGL codes.
bullet The official course Website - This website contains core course materials and assignment descriptions.
bullet Petra's 453 TA Page - Petra is another TA for the course 453. In her website you will find valuable examples, guidelines and hints for assignments and OpenGL programs. 
bullet Peter Broz's QT Tutorial - This is an excellent way to start your learning experience in QT. The more you use it you'll be in love with it.
bullet Additional Source for QT - Thanks to Petra, I am posting this link from her website. I saw many useful lessons in this site.
bullet Compiling For Windows - This should help you to compile your project at home. I will test this around the weekend and let you guys know next week.
bullet Quake 2 File Format (*.MD2) - This is a fantastic resource to learn and understand MD2 file format. Please note that if you use code segments from this website, make sure to credit it. Try your best to write your own code. If it turns out that most of your code are "Borrowed" you will receive significant penalty even if you mention proper credit.
bullet OpenGL Lighting Tutorial - This is a resourceful link describing the OpenGL lighting mechanism.
bullet Materials for OpenGL - This gives you the ambient, diffuse, specular and shininess values for a bunch of materials. Looks pretty realistic and definately worth trying in your applications.
bullet The Phong Shading Model - Actually this is the description of the Phong reflection model used to compute the intensity of an object at a given point. This is a must read for anyone who's considering implementing a raytracer.
bullet Ray Tracing Basics - Another must read for people wanting to implement a raytracer.
bullet Ray Tracing Primitives and Collision - Discusses how each classes of objects can be implemented.

Sample Programs and solutions

bulletFirst OpenGL Tutorial - This guides you through the very first OpenGL program. This short tutorial will set you up with the lab environment. To save time, you can download the program by clicking here.
bulletThe Basic Draw Program - Shows you some techniques to how to setup a glut application and how to draw on the screen. Some concepts about animations. Click here for the second version.
bulletThe Plasma Fractal - One of the most spectacular fractal display from a very simple fractal program.
bulletThe vector module - This module is extremely useful for computer graphics since it incorporates vector math functions and operators. Students are welcome to use it for the CPSC453 course, but it may not be distributed or used for any commercial use without my consent.
bulletThe Game Template - This module will will get you started with the new paranoid game being developed in the tutorial. This game is somewhat simplified and a toned down version of the original. But it will teach you many concepts of interactive graphics programming. Click here for a second version.
bulletThe Game Template V0.3 - This is an intermediate version of the game. The ball now moves and bounces off of the walls and the paddle. Moreover, lives can be lost and the game over is possible. The brick objects are created, and rendered on the screen. The collision detection is only partially implemented (actually fully implemented but commented out).
bulletThe Wave Generator - This is a cool 3D demo showing a sinusoidal wave propagating. The program comes in two modes, which the user can change by pressing s. The program shows the remarkable difference in rendered quality between face normals and vertex normals.
bulletThe Phantom Hand - Another awesome demo of an animated hand. Shows how to develop joints and joint kinetics using the matrix stack operation. Invaluable tool to teach the basics of character animation.
bulletThe OpenGL Lighting Tutorial - This is a simple program that shows the concept of lighting and surface tessellation. One can see how profoundly lighting quality is affected by tessellation level by regulating the resolution of the surface.
bulletThe Fractal Terrain Generator - This Tutorial is an extension of the lighting tutorial. It uses code from the Plasma example and uses it as a triangulated height field rendered as a Digital Elevation Model (DEM). The program uses flat shading normals.
bulletThe Fractal Terrain V2.0 - This is a significant improvement over the previous example. Shows the concept of smooth shading, normal precomputation, normal visualization, triangle stripping and vertex arrays. This example is over 100 times faster than the previous given the same amount of detail.
bulletThe Texture Tutorial - This is a valuable demo with reusable code that the students may find handy. The demo includes an opengl texture class that can be easily used to load bmp and pcx files as textures. User can also select texture modes and states. This demo can be also used to benchmark and observe the difference between different kinds of texture filtering.
bulletOpenGL Picking (Selection) - This demo shows you how to label objects in OpenGL and select them using the mouse. The demo has a number of spheres and teapots in a room and user can drag them and move them around. The user drag anywhere else to manipulate the camera. The demo also includes FPS calculation!
bulletMD2 Animated Character - This program is a working version of the MD2 assignment which implements everything except the QT user interface (for compatibility). It can be compiled either in linux or windows. Linux makefile is included.
bulletSphere Mesh Generator - Use this example and instruction given in class to generate Triangulated Torus (Donuts) or other surfaces of revolution.
bulletSimple Phong Shader - This is a rudimentary raytracer that barely works. Inputs a *.in and Generates a ppm image file. You can view the ppm file using IRFANVIEW free image viewer (download from the internet).
bulletMy Raytracer - A simple raytracer code that has reflection and shadow mapping! The code uses my own scene format. Please be aware that some things are intentionally done differently from Assignment 3 so that a simple copy paste would not work. You can use this to understand the raytracing techniques but should not reuse a significant part of it.

 

Screen Shot Gallery

The colorful Dragon Fractal

This is an example of how color can be integrated with a fractal code to generate remarkable patterns.

The Dragon Fractal 2

Another colorful example of the Dragon Fractal

The Fern

This is another fractal generatated by my program. The natural looking green fern actually has saddle color variation that makes it very realistic!

The Paranoid Game

This is basically the re-enactment of the classic most addictive game called paranoid. I spents days in the lab playing this game instead of any real work! So I decided to remake it as a part of our lab activities. Neat huh?

The wave generator

This interesting program generates a face/smooth shaded animated object. Neat!

The Plasma Fractal

In my opinion one of the most visually appealing fractal ever created. Yet the code is so simple! Fantastic!

The Hand animation

Uses matrix stack to produce joint movements!

OpenGL Lighting

A Simple Lighting tutorial based on a tessellated surface.

Fractal Terrain V1.0

This is a simple flat shaded fractal terrain model.

Fractal Terrain V2.0

A much more improved version with material and smooth shading.

The Texture Tutorial

A demo showing the difference between different kinds of texture mapping in OpenGL

My Raytracer

A simple raytracer with Reflection mapping and Shadows

 

 

CPSC 231 - Introduction to Computer Science

You will need Acrobat Reader (PDF) for the following materials.

Current Assignment Grades

bulletTutorial T12
bulletTutorial T18

Supplementary Reading Materials

bulletBasic Introduction - Provides some background on the working environment of the lab.
bulletUnix/Linux Commands - Discusses various shell commands, how to install secure shell to work from home, emacs etc.
bulletNumber Systems - Decimal and binary conversion, number formats and logic operations.
bulletIntroduction to Programming - Basics on programming, variables, flowcharts, formatting etc.
bulletProgramming guidelines - Important details on how to code programs and avoiding common malpractices.
bulletDecision making in Pascal - A detailed overview of selection statements in Pascal, if/else, nested if/else, case etc.
bulletGreat Way to Learn Pointers - This is the famous Binky and Pointer fun video created by the Stanford CS Education Library. It is absolutely hilarious and teaches you a very important concept about pointers. Please right click on the link and select Save Target As.

Sample Programs and solutions

bulletAssignment 2 (Binary thinking) Solution - This will help you prepare for the midterm.
bulletHello world Program - An example of how to write a simple pascal program. Features input & formatting.
bulletFormatting program - This will help you to understand formatted output generation in Pascal.
bulletASCII Conversion - A program to convert ASCII codes of characters.
bulletCPSC 231 Practice Midterm Example 1 - This covers topics from basic computer science, number theory and Pascal programming upto Logic and decision making
bulletCPSC 231 Practice Midterm Example 2 - This is similar to Example 1, but I have gathered some of the questions from online resources.
bulletAgetalk Program - This is a sample program that demonstrate decision based flow control in a program using If/Else statements and Case statements in Pascal. The program also demonstrates how to format and comment your code.
bulletAlphabet Program - This is another program on decision (IF/ELSE) making and flow control. It also shows you the relationship between characters and integers and how to use the ORD function to get the ASCII value of a character.
bulletNumber Compare Program - This program will find the maximum number given three integers. The program shows the difference between optimized and unoptimized code. Decision making can be optimized by using INFORMATION OF BRANCH (see "Decision making in Pascal"). The program also demonstrates proper formatting and commenting style.
bulletBasic Looping Example - This program shows you how to write a simple FOR loop in Pascal. It also shows how the value of the counter variable changes during each repetitions.
bulletNested Loop Example - This program uses nested for loops to show how repetitions are multiplied in the inner loops.
bulletDifferent kinds of loops - Shows how to construct different looping mechanism in Pascal. Note: Requires some basic knowledge of procedure.
bulletGenerating Grade Histogram - The program shows how to generate and display a histogram of different grades. It first shows how to input and count grades into different category. Then it uses loops to display histogram bars for each category.
bulletRandom distribution - This is an interesting program that demonstrates how to generate and use random numbers in Pascal (using the RANDOM function). In This program the user takes a number of black, white and red balls in a basket and then picks one ball at random. However, since there are different number of each kind of balls, the probability of picking a ball of a certain color may be different from picking a ball of different color. The program shows how this can be done correctly using Pascal.
bulletAssignment 4 Solution - I have provided a basic solution to assignment 4. You can compare your own program with this solution to understand your mistakes. This may also guide you in future assignment. The code shows proper formatting which you can use as an example for future assignments. Note: There are many possible ways to solve this problem. Click Here for the problem description.
bulletGuessing Game - This is an example program that shows you how to use a loop to implement basic game loop and implement game rules. Please click here to see the first version of the game, and click here to see the same game implementation using repeat/until loop.
bulletAssignment 5 Solution - I have provided a basic solution to assignment 5. You can compare your own program with this solution to understand your mistakes. This may also guide you in future assignment. I have also added a modular version of the same assignment (click here). This version shows the use of procedures and functions to solve the same assignment.  Note: There are many possible ways to solve this problem. Click Here for the problem description.
bulletFactorial & Fibonacci Program - An program to generate the Factorial of n (n!) and generates the first n fibonacci sequence (i.e. 1 1 2 3 5 8 13 21 ...). Click here to see a recursive version of Fibonacci. Click here to see a recursive version of Factorial.
bulletThe ARRAY Test V1.0 - A simple program that shows the use of arrays and scanning to process arrays. Also shows how to pass array as a parameter. Click here to see another array example.
bulletAssignment 6 Solution - I have provided a working solution to assignment 6. You can compare your own program with this solution to understand your mistakes. Please note the use of the Type keyword to define String200. This is to avoid the warning message while compiling. It is not required. Note: There are many possible ways to solve this problem. Click Here for the problem description.
bulletThe ARRAY Test V2.0 - This is a modified version of the first array program. This version features variable sized array (or the illusion of it), adding elements, displaying in compact form, searching for an element and array copying.
bulletThe Mapping Program - This is a 2D array example given by Dr. James Tam in 2005. The example shows how to manipulate and display a Map like array containing free land, Trees, Towns and Water. Shows the use of row/col scanning (for walls).
bulletAlice in the Wonderland V0.1 - Under development. First increment shows the construction of the array, how to initialize and display it. The goal in the game is to reach Wonderland (W) by moving Alice (A). Watch out from walls (*).
bulletAlice in the Wonderland V1.0 - This is the finished version of the game. Several changes. Initialize is now more complex and puts random obstacles. Check for valid move and game win condition is added.
bulletA Simple Record Example - This Example shows how to define records and array of records. Each record in this example is a 2D point with x and y coordinates. The array contains 10 points (randomly generated).
bulletA simple File Input Example - This program shows how to read from a file. Click here to download the required data file. Please enter use the data filename when the program asks you to enter a filename.
bulletA simple File Output Example - Shows how to write to a file.
bulletA Student Record Program - Reads the data file (click here to download the data file) containing records of some students and setup an array of records with the information. It then displays the records.
bulletAssignment 7 Solution (LITE) - Click on the left to download the optimized and simplest solution to the assignment 7. This is a Tic Tac Toe game that is designed to work with any grid size. Just replace  the SIZE constant and recompile. Also, click here for a more funky version (and more complex) of the game. Click here for the assignment description.
bulletWord Extraction - This program will ask the user to enter a sentence/line. It will then extract each word from that sentence and display them. It will also extract integers when a numerical value is found.
bulletAssignment 8 Solution - This shows how to solve the Winter 07, Assignment 8. The program reads from a constitution file (Click here to download) and generates a report (click here to see a sample) by scanning information into an array of records. Click here for a description of the problem.
bulletPointer Example 1 - A simple example to work with pointers.
bulletPointer Example 2 - An example provided by Dr. James Tam.
bulletPointer Example 3 - Yet another Pointer Example provided by Dr. James Tam.
bulletLink List Example 1 - A simple example to construct a linked list.
bulletLink List Example 2 - A more refined example of how to utilize link list in Pascal.

Home | About Me | Teaching | Research Activities | Photo Gallery | Feedback

This site was last updated 04/21/08