CS 104: Introduction to Game Programming

Spring 2020

Welcome to Introduction to Game Programming!

All the homework/labs/lectures will be distributed on Moodle.

We meet MW, 10 – 11:50 am, RISC 462.

Course Description

Course Description
This class is an introduction to computer science through game programming. Games are a growing part of the interactive entertainment industry, achieving $134.9 billion in revenue in 2018 (reported by GamesIndustry.biz, 12/18/2018) . Games are also a fun way to learn to program a computer. In this class, you will learn the basic tools and techniques for programming in Processing and Java, and create several computer games. This class also introduces you to computer science, a discipline that impacts our daily lives through a variety of technologies. By programming games, you will begin your exploration of the power of algorithms for solving problems in computer science.

This class is a studio class. Each class will involve a series of activities interwoven with lecture. You must bring your computer to every class. You will learn by doing computer programming; interacting with your professor, teaching assistant and other students; and engaging in learning activities with other students in a lightweight team. Since your learning of the material is an integral part of the class process, it is essential that you attend class.

This class includes a Mentored Study Group led by your teaching assistant. The Mentored Study Group Meetings are a time when you can gather with your classmates and a more senior student in Computer Science to discuss course materials, study and complete your homework. There is ample evidence that changing up how you study Computer Science will help you to learn. Reading the books, doing assignments, and participating in class and your Mentored Study Group are some of the ways you can change up your approach. Your brain will learn better if you look at this subject from a variety of perspectives.

Game Components We Will Study
Game Organization and Control


Game Physics: Creating Physical Laws for Imagined Worlds




Interaction with People and Between Objects



Instructor Information(back up↑)

    • Instructor: Dr. Joann J. Ordille
    • Email: ordillej at lafaytte.edu
    • Office: 565 RISC
    • Office Phone: (610) 330-5416
    • Office Hours: MW 4-5:30 pm, T 4-5 pm. Please email me if you would like to meet at any other time. Also, if my door is open, feel free to drop in.
    • Teaching Assistant and Mentored Study Group Leader: Xinran Zhang
    • Email: zhanxinr at lafayette.edu

Useful Links

Useful Links and Resources(back up↑)

    • Mentored Study Group with Xinran Zhang
      Xinran is a Sophomore Computer Science Major, and will be holding several Mentored Study Group Sessions during the term. The schedule for the sessions will be announced in class as soon as they are set.
    • Download Processing
      Here you can download the processing IDE to your personal computer.
    • Instructions for installing Processing
      Here are some instructions for installing processing. Chapter 2 of Shiffmann covers this as well.
    • Processing Reference Website
      You should use this page often as a reference when using new functions.
    • Processing examples
      Head on here to see some examples of what can be done with processing.
    • The Learning Processing Website (website for your textbook)
      The book’s website, including the code from the book, solutions, and video tutorials. The tutorials received good reviews from previous students.
    • CodingBat.com for JAVA
      Use this site to practice coding. It automatically determines if your code is correct. It also provides lots of examples of how to create test cases for your code.
    • Java documentation
      Once we transition into Java, this will be where you will go for a reference.

Course Information

Course Information(back up↑)

      • Web Page: http://sites.lafayette.edu/ordillej/teaching/cs-104-introduction-to-game-programming-syllabus-fall-2020
      • Textbooks:
        • learningprocessingbig
        • Learning Processing : A Beginner’s Guide to Programming Images, Animation, and Interaction, 2nd Edition, by Daniel Shiffman. ISBN 9780123944436, Morgan Kaufmann. This book is also available for free online if you are an ACM Member. ACM Membership costs students $19 per year and gives you access to many useful computer science books for free, including the O’Reilly line of books. ACM is the professional association for computer science. It publishes a monthly magazine about new things in the field and hot topics, and a monthly magazine specifically for students. It also publishes research papers and sponsors conferences. Recently, it developed quite a good program of free tutorials and books online. You can learn more about the ACM on the ACM website and in the flyer that encourages students to join. You can join as a student using this online application form. In addition, existing ACM members can win prizes if they recruit others to join. See the ACM Embassador’s Page for more information.
        • digitalworldbig
        • Understanding the Digital World: What You Need to Know about Computers, the Internet, Privacy, and Security, by Brian W. Kernighan. ISBN: 9780691176543, Princeton University Press.
        • Troubleshooting Basics, by Frank Vahid and Roman Lysecky. Zyante (zybooks.com), 2016. This is a free interactive online book available from zybooks.com. Information on accessing the book will be distributed in class via Moodle.
      • Prerequisite: Students are required to have completed PHIL 200 (Logic) or to be co-registered in MATH 141 (Differential Calculus and Economic Modeling) or MATH 161 (Calculus I) in order to take this class. No previous programming experience necessary. If you have a lot of programming experience and want to explore new areas, set up a meeting with me and I will adapt some assignments to your interests.

Course Goals and Outcomes

Course Goals and Outcomes(back up↑)
Course Goals: The goals of this course are to convey:

      • How to develop algorithms. When we create an algorithm in computer science, we transform a problem statement into a set of steps that can be executed by a computer.
      • How to write code to implement these algorithms using the Processing and Java languages.
      • How to program games and useful game algorithms.

Course Outcomes: After successfully completing this course, students will be able to:

      • Analyze a complex computing problem and to apply principles of computing and other relevant disciplines to identify solutions (ABET Outcome 1).
        • Understand programming language constructs, and be able to learn new languages.
        • Pick the correct constructs to meet the requirements of the solution.
        • Understand how different types of games are used to address real world problems.
        • Develop algorithms for different types of games.
      • Design, implement, and evaluate a computing-based solution to meet a given set of computing requirements in the context of the program’s discipline (ABET Outcome 2).
        • Read and understand computing requirements.
        • Design, implement and debug Processing/Java programs to meet the requirements.
        • Reason logically about program execution, e.g. where might the program error be?
      • Employ the fundamental elements of the scientific method in the physical and natural world by identifying and evaluating a testable scientific hypothesis (Common Course of Study NS1).
        • Identify and/or formulate a testable scientific hypothesis.
        • Generate and evaluate evidence necessary to test and/or revise a hypothesis.
        • Understand how the evaluation of the program hypothesis is inherently incomplete and why testing may not uncover all errors.
        • Understand why testing may not identify the source of error.
        • Understand the iterative process for refining tests to isolate errors.
      • Create and evaluate descriptions and representations of scientific data via equations, graphs, tables, and/or models (Common Course of Study NS2).
        • Interpret the results from testing the hypotheses for a computer program.
        • Measure and evaluate a computer program.
        • Measure and evaluate the performance of users in games.

Assignment Types

(back up↑)Assignment Types

Class Attendance: Since your learning of the material occurs as an integral part of the studio class process, it is essential that you attend class. For every unexcused absence, you will lose 0.5 points from your final grade up to a total of 2 points. If you have a dean’s excuse or a coach’s letter for a particular day, you will be excused from class.

Class Participation: Class participation includes asking or answering questions, expressing an opinion about a topic of discussion, meeting with me during office hours, participating in your team and reporting on activities in a team project or other activity. All sincere efforts to participate are admired, so don’t worry, just speak up. You are even welcome to express an opinion different than mine. All types of participation count except participation that shows you failed to prepare for class. For example, asking: “Who is Ada Lovelace?” when the assignment was to read the Countess of Lovelace’s biography would not count as class participation. But, it’s always better to ask than to sit there in the dark.

Lightweight Team Participation: Research has shown that students learn better in a community with their peers. We hope to help you form that community by creating lightweight teams that will collaborate in various class activities. The teams are lightweight, because they are for learning collaboratively without a lot of grade stress. Your contribution to your team counts for 2% of your grade. This team is different from your optional two person team for the final project.

Mentored Study Group Participation: The Mentored Study Group will meet twice per week at a time your MSG Leader, Xinran Zhang, will arrange with you. You are encouraged to attend the MSG as often as you can, and you are required to show Xinran your completed assignment in order to skip the MSG and still receive full credit. Otherwise, I will deduct 5% from your assignment’s grade. So, if you are not yet done the assignment due after the MSG, I’m asking you to attend the MSG and finish the assignment in our class community. If you have finished the assignment, you might attend the MSG to hear what’s happening and to lend a hand.

Quizzes: Our class is not only hands-on, it is collaborative. So, you will have an opportunity to work with your classmates to learn the material. Learning from the perspectives of others and helping others learn is a great and fun way to master programming. For this model to work, you must prepare for class. To encourage you to prepare for class, there will be unannounced quizzes. The quizzes will test whether you completed the assigned reading or other preparation for the class. Other quizzes will test your knowledge of the previous week. The intention here is to encourage you to review the material each week in preparation for the next week’s discussions. Some quizzes may include both kinds of questions.

Homework: Learning computer programming is much like learning to play a sport or musical instrument, or speak another language. Practice is important. The homework as well as the labs and projects are meant to help you practice and gain proficiency. Homework includes completing assigned problems in Shiffman. These are skill building problems. Homework also includes assignments that will be distributed occasionally through Moodle, or assigned on the website CodingBat.com. These will be small assignments to reinforce your learning and help you prepare for the written exams. You will receive the points for a problem that you complete in an acceptable way. There will be no partial credit. Notice that you will be able to determine the correctness of many of the homework problems on your own, through the Learning Processing Website or running your solution on the computer. However, it’s best to simulate the exam environment by doing the questions first without a computer and then testing your results later. If you do obtain outside assistance in completing the problem, be sure that you do NOT copy the answer. Rather, learn from the outside assistance, and then do the problem on your own. Directly copying an answer would constitute cheating.

Labs: Labs are projects to write a program according specifications supplied in class. In them you will get to implement the game techniques we discuss in class and see how they really work. Lab assignments will be given weekly, and some of our class time will be dedicated to working on these assignments. We will discuss common issues or interesting observations from work on the lab. Notice that class time will often not be enough to actually complete the lab. This means that you should plan on working on them outside of class. A good place to do this work is in your Mentored Study Group. Do not wait until the last day.

Final Project: There is a final team project in this class to build a working game of your choice or one from a list that I will provide. You are encouraged to do this project in teams of two students, but individual projects will be allowed with prior permission. This project will require your team to propose the game to be written, design the game, and then implement and test it. It will be similar to our labs but will involve extensive design, and demand developing your own algorithms using the techniques taught during class. You will be required to submit one or more intermediate solutions as you develop your full game. You will have approximately three weeks for the final project. During the last class, you will be asked to demonstrate your game.

Exams: We will have two midterms. One will be a written exam in class. The second will be an in class lab exam with the use of your computer. This exam requires you to code your answers and test them. The final exam will be a comprehensive written exam. Exam absences will receive a score of zero for the exam (unless a dean’s excuse is given). Before the exam begins, you are required to close your course materials, and put them and your phone in the front of the class to avoid the temptation look at them during the exam.


(back up↑)Submission

For labs and projects:

      • All tasks are individual, except for the final project which will be done in a two person team.
      • All submissions should be made on the Moodle Website.
      • You should zip (compress) the project’s folder and submit the zipped results.
      • Labs assignments are usually due the following Sunday at 11:59 pm.
      • If your lab does not work as described in the assignment you are required to hand in an additional text document which specifies what does not work.
      • Submit your labs and project on time. You have one pass to submit a project up to 3 days late. Other late submissions will be subject to a penalty of 5% of the grade per day. Again, all submissions should be via Moodle. Submissions made in other ways (for example, via email) will not be graded. If you cannot finish before the deadline, please make sure to submit what you have before the deadline (with the required written description of what works and what doesn’t work). Note that you can submit work in completion of an assignment multiple times on Moodle up until the deadline. Each new submission replaces the previous submission.

For homework:

      • You are allowed to collaborate with others, especially your lightweight team or mentored study group, to increase learning and allow you to complete the homework.
      • You must write your homework yourself in your own words. You can not copy an answer from someone or somewhere else, even with minor variations.
      • Submit your homework on time. You have one pass to submit homework up to 3 days late. Other late submissions will be subject to a penalty of 5% of the grade per day. All submissions should be via Moodle or on paper handed in at the beginning of the class. Submissions made in other ways (for example, via email) will not be graded.

Intellectual Honesty:

What is cheating on projects and labs?

      • Sharing code: copying, retyping, looking at, supplying file.
      • Describing code: verbal description of code from one person to another.
      • Helping write code line by line.
      • Searching the web for solutions.

What is not cheating on projects and labs?

      • Talking about general concepts or high level design.
      • Lending a hand in finding a bug.
      • I encourage you to collaborate in the two ways mentioned above with your lightweight team and mentored study group.

What is cheating on homework?

      • Directly copying an existing answer
      • Copying an existing answer with minor variations

What is not cheating on homework?

      • Learning from others or the web, and then doing the problem yourself

Statement: All students are expected to adhere to the college policy on academic honesty as listed in the Student Handbook.

“To maintain the scholarly standards of the College and, equally important, the personal ethical standards of our students, it is essential that written assignments be a student’s own work, just as is expected in examinations and class participation. A student who commits academic dishonesty is subject to a range of penalties, including suspension or expulsion. Finally, the underlying principle is one of intellectual honesty. If a person is to have self-respect and the respect of others, all work must be his/her own.”

Discussion of concepts with others is encouraged, and you are encouraged to avail yourself of the mentored study group and your lightweight team for such discussion. On the other hand, labs and projects must be done by yourself or your own team as specified in the requirements for each assignment. If you use any source other than the Shiffman book in completing a lab or project, reference it/him/her, whether it is a person, a book, a solution set, a web page or whatever. You MUST write up your labs and projects in your own words. In the case of homework problems, you are permitted to collaborate with each other. Collaboration in your mentored study group and lightweight team is encouraged. You still MUST write up your solution to the homework in your own words or code. The write up for your solution should not match or match with slight variations any other student’s solution, past or present, or answers supplied online.


(back up↑)Grading

Graded Material:
The course grade is based on the materials listed below graded on a 100 point scale, with each item contributing a specified percentage to the overall score. As specified in the student handbook, A will reflect excellent work, B will reflect good work, C will reflect acceptable work, and D will reflect passing work.

Class Attendance and Participation 2%
Lightweight Team Participation 2%
Quizzes 2%
Homework 3%
Labs (averaged) 17%
Lab Exam 21%
Final Project 10%
Mid-Term 17%
Final Exam 26%

Grading Scale:
Typically, grades are assigned as follows from your final numerical grade:

A: 93-100 B+: 87-89 C+: 77-79 D+: 67-69 F: 0-59
A-: 90-92 B: 83-86 C: 73-76 D: 63-66
B-: 80-82 C-: 70-72 D-: 60-62

Assignment Grading:
Your submitted programs (for labs, the final project, and exams) would be graded based on:

      • Correctness: Correctness is an objective criterion, which means that the program behaves according to the requirements explained in the assignment in all possible cases.
      • Good Style: Good style refers to the way the program text looks. This includes commenting and correct indentation. We will discuss different aspects of good programming style as we learn how to program.
      • Good Design: Good design is a harder criterion to describe. It affects both the execution of the program and its readability. Characteristics of a good design will be illustrated throughout the course.

Tentative Schedule

(back up↑)Tentative Schedule*



S: 18.6 to paragraph starting “With this technique”

Wk. Dy. Date Topic

Readings (S:Shiffman)
(Z: Zybooks)
1 M 1/27
Introduction to Games and Processing
S: 1,2
Lab 1: Drawing
W 1/29
Interaction, Variables, Learning CS
S: 3, 4
2 M 2/3
Variables, Arithmetic
S: 4
K: Intro
Lab 2: Graph Game
W 2/5
Conditionals, Game Control
S: 5
3 M 2/10
Conditionals, Debugging
S: 11
Z: 1-2.3
K: Part I
W 2/12
Sound, Functions, Testing
K: 1
S: 7, 12, 20-1
4 M 2/17
Functions, Scope, Testing
S: 7, Z: 2.5
K: 2
Lab 3: Functions and Testing
W 2/19
I/O, Interaction, Loops
S: 6
K: 3, Wrap-up
5 M 2/24
Loops, Arrays, Scope
S: 9-2 to 9-6
Z: 2.4, 2.6 to end
Lab 4: Shooting or

Rebounding Game

W 2/26
Strings, Arrays of Characters, File I/O
S: 17-17.4
S: 18-18.2, 18.4
S: 18.6 to end of giveMeTextBetween() function
6 M 3/2
Arrays and Functions, Nested Loops
S: 13-12 to Example 13-11
W 3/4
Nested Loops, 2 Dimensional Arrays, Review
S: 13-12 to Example 13-11
7 M 3/9
Written Midterm
Lab 5: Convert Lab 4
to Classes
W 3/11
Classes and Objects, PImage
S: 8, 9-1, 9-7 to 9-10, 13-12, 15-1
8 M 3/16
Spring Break
W 3/18
Spring Break
9 M 3/23
More Classes and Objects, Complexity
K: Part II, 4
W 3/25
Design, Java Classes
K: 5
Lab 6: Minesweeper
Final Project: Team Formation and Proposal
10 M 3/30
Static and Final, Aliasing
K: 6
W 4/1
Encapsulation, Inheritance and Polymorphism
S: 22,
K: 7, Wrap-up
11 M 4/6
More Inheritance, Polymorphism, Exceptions
S: 23-6
W 4/8
Exercises, Review
K: 8
Final Project: Design
12 M 4/13
Lab Exam
W 4/15
Full Java, Java I/O
K: 9
Final Project: First Iteration
13 M 4/20
Java I/O
K: 10
W 4/22
K: 11
14 M 4/27
K: 12
Final Project: Second Iteration
W 4/29
K: 13
15 M 5/4
W 5/6
Final Project Presentation
Final Project Due: 5/10

*Tentative schedule, subject to change. Check Moodle for the most up to date information.

**No travel arrangements should be made until the final exam schedule has been issued


Additional Information

(back up↑)Additional Information

SM&RT (SMART) Advisor: Advisors in the Sexual Misconduct & Resource Training Program, formerly SASH, seek to prevent sexual and gender based violence and harassment. They also provide services to those who have suffered from such violence or harassment. I am an SMART Advisor, and am available through appointment to assist you or your friends if you experience sexual misconduct.

Respect for classmates, colleagues and team members: All students are expected to show respect and courtesy to each other. Mutual respect is a high ideal in academic, business, and personal life. It is central to learning well together. Disagreements over ideas or constructive criticism of someone’s work is in keeping with this ideal. Attacking or disparaging someone is not, and will not be tolerated. In group projects, mutual respect also includes reliably contributing to the project and keeping your commitments to the group.

We follow the College Diversity Statement which says in part:

All members of the College community share a responsibility for creating, maintaining, and developing a learning environment in which difference is valued, equity is sought, and inclusiveness is practiced.

To learn more about how these principles are followed in the computing industry, view the Google video:

Diversity at Google (https://youtu.be/_3RoQRN65AI)

and the eBay video:

Diversity Workshop at eBay, Europe (https://player.vimeo.com/video/159767606)

Privacy: Moodle contains student information that is protected by the Family Educational Right to Privacy Act (FERPA). Disclosure to unauthorized parties violates federal privacy laws. Courses using Moodle will make student information visible to other students in this class. Please remember that this information is protected by these federal privacy laws and must not be shared with anyone outside the class. Questions can be referred to the Registrar’s Office.

Equal Access: In compliance with Lafayette College policy and equal access laws, I am available to discuss appropriate academic accommodations that you may require as a student with a disability. Requests for academic accommodations need to be made during the first two weeks of the semester, except for unusual circumstances, so arrangements can be made. Students must register with the Office of the Dean of the College for disability verification and for determination of reasonable academic accommodations.

Important Dates:

      • Normal Add/Drop deadline: February 7th
      • Spring Break: March 16th – 20th
      • Last day to Withdraw (WD): April 20th
      • Classes end: May 8th
      • Final Exams: May 11th – 18th

Federal credit hour statement: The student work in this course is in full compliance with the federal definition of a four credit hour course. Please see the Registrars Office Website for the full policy and practice statement.

Credits: Some sections adapted from the CS 105 Syllabus by Professor Sadovnik, 2016. In the Organization Section, the rogue maze image is courtesy of Artoftransformation under the Creative Commons license. In the Interaction Section, the flappy bird video is a capture of the execution of the program available at https://github.com/sidonath/processing-flappy-bird-clone. Photo of Learning Processing Textbook Copyright © Morgan Kaufmann. Photo of Understanding the Digital World Textbook Copyright © Princeton University Press. Photo of Troubleshooting Basics © Zyante Inc.