Honors 304.503 Lecture -1 – Short course description
This class will unite the disciplines of creative writing, design, music, and computer science into the craft of game development. Students will cluster into small 4- or 5-person game development startup companies. In the fall semester these companies will design and develop some small games using Inform and the Unity game engine. They will also […]
CS 145 Lecture 13 – PrintWriter and Patterns
Agenda PrintWriter and snowpeople the so-far pattern doing a word count the fencepost pattern prompting for a valid file So-far (Cumulative) pattern We can only work on one thing at a time. When problems require processing of a set or list, we’ll have to apply the so-far pattern: Fencepost pattern Suppose we want to print […]
CS 330 Lecture 20 – File I/O and Quiz
Agenda writing a WAV file the characteristics of imperative Code mucis.c N.B. The fwrite calls below have their middle arguments transposed. Element size comes before the number of elements. #include <stdio.h> #include <stdlib.h> #include <math.h> /* ————————————————————————- */ const int SAMPLES_PER_SECOND = 22050; const int BEATS_PER_MINUTE = 200; const float PI = 3.14159f; /* ————————————————————————- […]
CS 330 Lecture 19 – Abstracting a GUI
Agenda the libexpat API slurping a file in C adding a GUI abstraction layer using XML TODO Why we chunk-read: http://java.sun.com/developer/technicalArticles/Programming/PerfTuning/ C file I/O: http://en.wikibooks.org/wiki/A_Little_C_Primer/C_File-IO_Through_Library_Functions Code parse_xml.c #include <expat.h> #include <stdio.h> #include <stdlib.h> /* typedef parser_t * XML_Parser; */ /* ————————————————————————- */ void start(void *data, const char *tag, const char **attributes) { printf(“data: %d\n”, *((int *) data)); […]
CS 145 Lecture 12 – File I/O
Agenda program this nested loops printf reverse engineering reading from a file with Scanner writing to a file with PrintWriter TODO Read chapter 5. Reverse Engineering Code Bored.java package preexam2; public class Bored { public static void main(String[] args) { for (int r = 1; r <= 8; ++r) { for (int c = 1; […]
CS 330 Lecture 18 – Callbacks and XML
Agenda we need a chairperson OpenGL game loops in GLUT hello, XML push parsing with Expat a GDB primer TODO Read the first three pages of http://www.ibm.com/developerworks/xml/tutorials/xmlintro/index.html. Code torus.c #include <stdio.h> #include <stdlib.h> #include <GL/glut.h> /* ————————————————————————- */ int x_angle = 0; int y_angle = 0; /* ————————————————————————- */ void draw_callback() { glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); glRotatef(x_angle, 1.0f, […]
CS 145 Lecture 11 – Finalizing the big three
Agenda nesting printf Mr. Right leap exam TODO Read sections 4.2 and 4.3. Reverse Engineering Code MrRight.java public class MrRight { public static boolean getTrue() { System.out.println(“true”); return true; } public static boolean getFalse() { System.out.println(“false”); return false; } public static void main(String[] args) { // boolean b = getTrue() && getFalse(); // boolean b […]
CS 330 Lecture 17 – Higher-order functions
Agenda program this the strategy pattern enums in C function pointers GLUT callbacks Expat callbacks TODO http://www.json.org/xml.html http://www.codinghorror.com/blog/2008/05/xml-the-angle-bracket-tax.html http://c2.com/cgi/wiki?XmlSucks Program This With a neighbor, write a short C function that chooses a random number between 0 and 100 and lets a computer player guess until it picks the right answer. Code guess_a_number.c #include <stdio.h> #include […]
CS 330 Lecture 16 – Assembly
Agenda a little peek at GNU Assembly code transformation to preprocessed to assembly to object code to linked executable variables? no, registers %ebp and %esp on call and return local variables %eax for return values passing arguments to functions arrays pointers conditional statements loops Code ls.c #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <sys/types.h> int […]
CS 145 Lecture 10 – Logical operators and if
Agenda logical operators: && || if statements interval checking clamping a value getting someone’s title Code IntervalCheck.java package preexam1; public class IntervalCheck { public static boolean isInInterval(int lo, int hi, int givenPointX) { return lo <= givenPointX && givenPointX <= hi; } public static void main(String[] args) { System.out.println(false == isInInterval(0, 10, -5)); System.out.println(true == […]