Code reading skills LEVEL GAME.  Skeleton has error messages.  Notice the red lines on right slider. Click… you’ll go to an error.  pieces = levels.getPieces();

Slides:



Advertisements
Similar presentations
CS12230 Introduction to Programming Tying things together.
Advertisements

Written by: Dr. JJ Shepherd
1 Java Programming Basics SE-1011 Dr. Mark L. Hornick.
Java Planning our Programs Flowcharts Arithmetic Operators.
Python Magic Select a Lesson: Why Learn to Code? Basic Python Syntax
MPI Program Structure Self Test with solution. Self Test 1.How would you modify "Hello World" so that only even-numbered processors print the greeting.
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.
Program design example Task: Develop an algorithm expressed in pseudocode for a specified problem specified problem.
SE320: Introduction to Computer Games Week 8: Game Programming Gazihan Alankus.
Options for User Input Options for getting information from the user –Write event-driven code Con: requires a significant amount of new code to set-up.
20 Questions Assignment Intro James Wei Professor Peck March 19, 2014 Slides by James Wei.
Java: Chapter 1 Computer Systems Computer Programming II Aug
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Chapter 4 Code Editor Goals and Objectives Program more efficiently? How can you speed up your development process? Do you want to learn useful shortcuts.
Noadswood Science,  To know the basics of Python coding and decoding Monday, September 07, 2015.
Coding Methodology How to Design Code. © 2005 MIT-Africa Internet Technology Initiative Pay Attention to Detail When implementing or using APIs details.
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
Java: Chapter 1 Computer Systems Computer Programming II.
General Programming Introduction to Computing Science and Programming I.
Iteration. Adding CDs to Vic Stack In many of the programs you write, you would like to have a CD on the stack before the program runs. To do this, you.
Introduction to Matlab & Data Analysis
CPSC1301 Computer Science 1 Chapter 11 Creating Classes part 1.
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
While Loops Indefinite Iteration. Last lesson we looked at definite loops using the ‘For’ statement. The while loop keeps going while some condition is.
Method Overriding Remember inheritance: when a child class inherits methods, variables, etc from a parent class. Example: public class Dictionary extends.
Class Usability Experience User slides are in BLUE.
Georgia Institute of Technology Creating Classes part 1 Barb Ericson Georgia Institute of Technology Oct 2005.
By the end of this session you should be able to...
BACS 287 Programming Logic 1. BACS 287 Programming Basics There are 3 general approaches to writing programs – Unstructured – Structured – Object-oriented.
Making Decisions uCode: October Review What are the differences between: o BlueJ o Java Computer objects represent some thing or idea in the real.
CSC1401 Classes - 1. Learning Goals Computing concepts Identifying objects and classes Declaring a class Declaring fields Default field values.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops Barb Ericson Georgia Institute of Technology August 2005.
Discussion 4. Labs public MyPoint(double xInit, double yInit ) { MyPoint p = new MyPoint(0, 0); } ClassProblem.java recursive java.lang.StackOverflowError.
Daniel Gagnon’s Final Project Number Guessing Game Widget By: Daniel Gagnon.
Code reading skills LEVEL GAME.  Common scenario:  Students raise hand. Point to code, say they don’t understand why it’s not working.  public void.
CHECKWRITER Q & A Q. I printed checks but forgot to load any check stock in my printer. A. These checks would all be considered “missing” and you’d process.
Understand the difference between applets and applications Identify meaningful applet resources for academic subjects Create and demonstrate a basic Java.
Introduction Chapter 1 8/31 & 9/1 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
CreatingClasses-SlideShow-part31 Creating Classes part 3 Barb Ericson Georgia Institute of Technology Dec 2009.
Computer Science I Recap: variables & functions. Images. Pseudo-random processing.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
CIT 590 Intro to Programming Lecture 13. Some Eclipse shortcuts CTRL + SHIFT + F – format file (proper indentation etc). Please do this before you submit.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Catie Welsh March 23,  Lab 6 due Friday by 1pm 2.
Written by: Dr. JJ Shepherd
GameDevClub CODE CHEAT SHEET NOTE: ALL OF THE CODE IS CASE-SENSITIVE AND THE SYNTAX IS STRICT SO A LOT OF YOUR ERRORS WILL PROBABLY COME FROM TYPOS If.
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Lecture 2 Debugging,
Interfaces, Classes, Collections School of Engineering and Computer Science, Victoria University of Wellington COMP T2 Lecture 3 Marcus Frean.
Chomp. How is the game played Human player goes first choose a square, all to the right and down are “eaten” computer takes a turn whoever is forced to.
Logical Operators.  Quiz  Let's look at the schedule  Logical Operators 2.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
Notices Assn 2 is due tomorrow, 7pm. Moodle quiz next week – written in the lab as before. Everything up to and including today’s lecture: Big Topics are.
IF STATEMENTS AND BOOLEAN EXPRESSIONS. BOOLEAN EXPRESSIONS Evaluate to a value of true or false Use relational or equivalence operators Boolean operators.
World of Wokcraft The very best in Single pan cooking themed fantasy gaming!
Shlomo Hershkop Basics overview. Shlomo Hershkop Basic Review - Overview Practice coding Practice coding finger guessing game finger guessing.
COP 3275 – Finishing Loops and Beginning Arrays Instructor: Diego Rivera-Gutierrez.
More about comments Review Single Line Comments The # sign is for comments. A comment is a line of text that Python won’t try to run as code. Its just.
Arrays & Functions Lesson xx
An Introduction to VEX IQ Programming with Modkit
Introduction to TouchDevelop
Data and Flowcharts Session
Building Java Programs
Data and Flowcharts Session
Building Java Programs
Presentation transcript:

Code reading skills LEVEL GAME

 Skeleton has error messages.  Notice the red lines on right slider. Click… you’ll go to an error.  pieces = levels.getPieces(); // a statement with an error  Double click on pieces  Select Search->Declarations->project. Eclipse will take you to where this is defined.  From the declaration, try Search->References->Project. This will help you figure out how/where this data is used. ECLIPSE CAN HELP

 Your first task … is to read the code in the provided skeleton.  How many of you went on to read the assignment details?  From employers: code reading is critical skill that most students have not yet acquired fully. HOW DOES GAME ENGINE WORK?

 How about main?  Creates a Game Engine  Calls playGame  playGame includes:  Code to determine if game is over  Calls setupLevel to get ready for next level  Calls doOneLevel  After the while loop, some final messages and exit WHERE TO BEGIN?

 Checks if level over  Displays the board  Gets the player’s option  Moves the player  If player moved, interact with other pieces and let other pieces move  Pseudo code: informal, high-level description  Productive strategy when writing code: write pseudocode as comments, fill in the details DO ONE LEVEL

 Prints the player (oh, symbol is P)  Displays space if nothing at that location  Tells object to draw itself  How can we be sure pieces know how to draw themselves? private Drawable [] pieces;  Pieces is an array of Drawable!  But wait, what does that mean? How can that be?  It means that EVERY object in the array must IMPLEMENT Drawable  Drawable is an interface. It has exactly one method: draw() DISPLAY BOARD

 Anything that implements Drawable must have a draw method  We don’t care what type of thing it is, as long as it can draw itself.  BumbleBee? Sure!  DoorMat? Sure!  Kangalo? Sure! else pieces[i].draw();  Can I add new types? Yes!!  Do I need lots of if/else statements? No!! THE POWER OF THE INTERFACE

public interface Moveable extends Drawable{ public void move(Drawable[] pieces, int playerLocation); } public interface InteractingPiece extends Drawable { public InteractionResult interact( Drawable [] pieces, int playerLocation); } SO WHAT IS THIS EXTENDS?

 Start slow  You can figure out you need a LevelEngine  LevelEngine needs some data structures (lists of pieces, moveable pieces, interacting pieces).  Set these to null  Create ONE game piece  Make it as simple as possible (like my DoorMat)  Can you get it to display?? Woo hoo! FEELING UNSURE?* * Of course you are. It’s like working with legacy code… lots to figure out before you can even begin to code.