CS12020 for CGVG. Practical 2. Jim Finnis

Size: px
Start display at page:

Download "CS12020 for CGVG. Practical 2. Jim Finnis"

Transcription

1 CS12020 for CGVG Practical 2 Jim Finnis (jcf1@aber.ac.uk)

2 This week Solution to last week and discussion Global variables and the model The Main Loop pattern States and the State Machine pattern Random numbers Debounced user input

3 The previous worksheet A common solution: loop() Go left using for.. loop Go right using for.. loop

4 A good first solution, but... Difficult to modify Each inner loop has to have its own copy of some of the code Clear-draw-swap In more complex programs this gets really nasty When adding new stuff it's easy to forget to add some of that framework code.

5 Don't repeat yourself If you write code that does something, don't just copy and paste it to do that thing again. Make the thing into a function. If you want to do a slightly different thing, make that function take arguments to change its behaviour. This makes your code much easier to modify and extend.

6 Use variables Instead of writing code that just does one thing (move left eight steps, for example), write one piece of code that does one thing several different ways using variables. Be lazy don't write it five times, each slightly different. Write it just once, a bit more cleverly.

7 The Simplest Thing But don't be too clever always think What's the simplest thing that can possibly work? And one piece of code is always simpler than five.

8 void setup(){ AberLED.begin(); } void loop(){ int x; for(int x=0;x<8;x++){ AberLED.clear(); AberLED.set(x,4,RED); AberLED.swap(); delay(300); } for(int x=7;x>=0;x ){ AberLED.clear(); AberLED.set(x,4,RED); AberLED.swap(); delay(300); } } void setup(){ AberLED.begin(); } int x=0; int dx=1; void loop(){ AberLED.clear(); AberLED.set(x,4,RED); AberLED.swap(); } x = x+dx; if(x==0 x==7){ dx = dx; } delay(300);

9 Global variables Are bad. Unless you're storing data which is genuinely global which the whole program needs access to Such as the game state - the data about the game's world - also called the model. Object-oriented languages like C++ and Java have helpful ways of dealing with global data.

10 The Model Your game models (makes an abstract picture of) a virtual world this is true of all games. This world might be very complex, with hundreds of entities made up of moving parts, as in a modern AAA title Or it might be very simple, like noughts and crosses. But there's always a model the game's representation of the world as data.

11 The Model First-person shooters The environment, consisting of 3D shapes, some of which may be free to move Enemies and other creatures, which have a position and some internal state (pose data, weaponry, ammo, alert status, velocity) Objects in the environment, such as ammo packs, quest items etc. You and equipment you're carrying/wielding

12 Simpler models Chess An 8x8 grid A set of pieces Noughts and crosses (Tic-Tac-Toe) A 3x3 grid Each part of which can be marked X, O or empty

13 Step 1 in game development: define the model What is your environment (the unchanging parts of the world, the game board )? What are your entities (things in the world)? How should you represent them as data? Variables, arrays, structures...

14 An example Chess is a fairly simple game, model-wise How would you represent the state of the game inside the computer?

15 Possible models 8x8 array of characters, each encoding a piece (e.g. p for pawn and q for queen, using upper and lower case for black and white) Two arrays of piece structures, one for each player, each containing Whether the piece has been taken X,Y position if not taken The index of the piece in the array determines its type, e.g. whitepieces[0] is the white king, and so on.

16 Which is best? It's a good idea to design your model so that invalid states are impossible to represent. This really helps prevent bugs. The second example is more complex, but does this quite well. On the other hand, it should be easy to perform the operations on the model which the game requires moving pieces, etc. On the third hand, it should be easy to display the model to the user to render it. For those who know chess: what is the problem with the second model? It's all about compromises.

17 Making it move: the Main Loop Pretty much every game has one of these, even if it's hidden inside the engine It's an example of a design pattern a particular way of solving a problem, more general than an algorithm. You'll see more design patterns in your second year. This pattern is very specific to real-time graphics (games etc.) (many engines hide the main loop from you)

18 The Main Loop Read input and update model accordingly e.g. player presses FIRE, so create new missile heading in the player's direction e.g. for all entities, add the velocity to the position, and do collision checks Update model for time step e.g. Clear buffer Draw environment Scan through entities and draw them Draw HUD Flip buffers Render model

19 Main Loop: handling user input Read switches and other inputs. Process these inputs by modifying the model. Must not block that is, it must not wait for anything (e.g. user input). It runs as fast as it can. delays are blocking. We'll talk about these later. As an aside, all console games will fail product testing if the screen freezes for more than a fraction of a second.

20 Main loop: updating Change the game model (i.e. the game data variables) in other ways than user input changes. Typically these are changes due to time or game AI. Examples: Moving objects (player, enemy, bullets..) through the world by adding their velocity to their position See if any of the enemies have noticed the player and change their behaviour if so

21 Main loop: rendering Drawing things to the screen representing the model. Doesn't change the model

22 Keep everything separate The update and user input code shouldn't do any rendering The rendering code shouldn't do any updating This helps keep your code easy to maintain You know where the code which draws stuff will be You know where the code which changes stuff will be

23 An example framework for a Main Loop application. You need to add: Model data Set-up code Input, update and rendering code void setup(){ AberLED.begin();... // set up initial state } void handleinput(){... } void update(){... } void render(){ AberLED.clear();... AberLED.swap(); } // do not modify below here void loop(){ handleinput(); update(); render(); }

24 Timers You shouldn't ever use delay() - why not? The millis() function will return the number of milliseconds since the program started. You can use this to find the number of milliseconds since something happened.

25 Timers Here's some code that will make something happens 2 seconds after something else: as a global (part of your model): unsigned long eventtime=0l; starting the timer: eventtime = millis()+2000; somewhere else: if((0l!= eventtime) && (millis() > eventtime)){ eventtime=0l; // reset the timer do something }

26 States Your game will probably have several different phases: menu, gameplay, winning/losing screen, high score table, etc... In each of these, render(), update() and handleinput() need to do something completely different. The code for this can get very messy.

27 State Machines We use the idea of a state machine to deal with this. Each different phase of the program is called a state The state machine can be in one of states, and can move to other states.

28 State Machines Have a variable (usually an int) with the current state Code in the main loop can then look at the state variable (using if or switch) to decide what to do The main loop update can change the state under well-defined conditions Like Main Loop, it's another design pattern

29 Show the states, and how states move to other states State Diagrams On OK pressed FADE UP On fade up complete START Shows only the menu MENU Show both menu and game GAME Shows only the game On fade down complete FADE DOWN On game exit

30 State machine code A #define for each state Global state variable initially invalid (-1) gotostate(int s) goes to state s (by setting the state variable to s), and stores the current time GetStateTime() returns the current time minus the time of the last call to gotostate() You add switches and conditional code to update() etc. which uses the state variable to decide what to do This code is provided on the worksheet. Work through an example

31 Random Numbers Are very important in games! random(max) returns a random number from 0 to max-1 So random(10) returns 0,1,2,3,4,5,6,7,8 or 9 Note that you get numbers up to max-1, not max! What would you use to simulate a six-sided dice?

32 Random Numbers Performing an event sometimes, but not always: random(10) will return 0 one time in ten So if(0==random(10)) { } will run the code in the brackets one time in ten This is useful for doing things at random intervals in your update You'll find this handy for the assignment

33 A Bit More User Input Finding out when a button has been pressed You need to compare the previous state of the button with the current state But buttons are bouncy!

34 Debouncing Button on We want to ignore all these Button has been down for long enough for it to count Button off

35 getbuttondown(int n) Luckily I've written code which does this for you! Call getbuttondown(int b) to find out whether a button has gone down since the last interrupt, and has been down for at least 20 consecutive interrupts.

36 The assignment You should now know everything you need to do the assignment Design your model Structure the main loop as described: handleinput(), update() and render() functions all called from loop() Use a state machine and switch statements inside your main loop functions Don't use a delay use getstatetime() or millis() (see this week's worksheet)

CS12020 for CGVG. Practical 1. Jim Finnis

CS12020 for CGVG. Practical 1. Jim Finnis CS12020 for CGVG Practical 1 Jim Finnis (jcf1@aber.ac.uk) About me 20 years in the games industry (more or less) Windows, PS2, Xbox, Gamecube, Wii development experience DirectX (more than I like to think

More information

D - Tic Tac Toe. Let's use our 9 sparkles to build a tic tac toe game! 2017 courses.techcamp.org.uk/ Page 1 of 9

D - Tic Tac Toe. Let's use our 9 sparkles to build a tic tac toe game! 2017 courses.techcamp.org.uk/ Page 1 of 9 D - Tic Tac Toe Let's use our 9 sparkles to build a tic tac toe game! 2017 courses.techcamp.org.uk/ Page 1 of 9 INTRODUCTION Let's use our 9 sparkles to build a tic tac toe game! Step 1 Assemble the Robot

More information

CS12020 (Computer Graphics, Vision and Games) Worksheet 1

CS12020 (Computer Graphics, Vision and Games) Worksheet 1 CS12020 (Computer Graphics, Vision and Games) Worksheet 1 Jim Finnis (jcf1@aber.ac.uk) 1 Getting to know your shield First, book out your shield. This might take a little time, so be patient. Make sure

More information

The Stack, Free Store, and Global Namespace

The Stack, Free Store, and Global Namespace Pointers This tutorial is my attempt at clarifying pointers for anyone still confused about them. Pointers are notoriously hard to grasp, so I thought I'd take a shot at explaining them. The more information

More information

BEGINNER PHP Table of Contents

BEGINNER PHP Table of Contents Table of Contents 4 5 6 7 8 9 0 Introduction Getting Setup Your first PHP webpage Working with text Talking to the user Comparison & If statements If & Else Cleaning up the game Remembering values Finishing

More information

Sprite Multiplexing. on Nintendo DS. Daniel -MsK`- Borges 2007/03/15 0.1

Sprite Multiplexing. on Nintendo DS. Daniel -MsK`- Borges 2007/03/15 0.1 Sprite Multiplexing on Nintendo DS Daniel -MsK`- Borges 2007/03/15 0.1 I. The beginning I'm currently developing a shooting game on Nintendo DS. I like shooting games with tons of bullets on screen to

More information

Static Methods. Why use methods?

Static Methods. Why use methods? Static Methods A method is just a collection of code. They are also called functions or procedures. It provides a way to break a larger program up into smaller, reusable chunks. This also has the benefit

More information

Slide 1 CS 170 Java Programming 1 Multidimensional Arrays Duration: 00:00:39 Advance mode: Auto

Slide 1 CS 170 Java Programming 1 Multidimensional Arrays Duration: 00:00:39 Advance mode: Auto CS 170 Java Programming 1 Working with Rows and Columns Slide 1 CS 170 Java Programming 1 Duration: 00:00:39 Create a multidimensional array with multiple brackets int[ ] d1 = new int[5]; int[ ][ ] d2;

More information

Intro. Speed V Growth

Intro. Speed V Growth Intro Good code is two things. It's elegant, and it's fast. In other words, we got a need for speed. We want to find out what's fast, what's slow, and what we can optimize. First, we'll take a tour of

More information

Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website:

Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website: Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website: https://users.wpi.edu/~sjarvis/ece2049_smj/ We will come around checking your pre-labs

More information

Today in CS161. Lecture #12 Arrays. Learning about arrays. Examples. Graphical. Being able to store more than one item using a variable

Today in CS161. Lecture #12 Arrays. Learning about arrays. Examples. Graphical. Being able to store more than one item using a variable Today in CS161 Lecture #12 Arrays Learning about arrays Being able to store more than one item using a variable Examples Tic Tac Toe board as an array Graphical User interaction for the tic tac toe program

More information

Linked Lists. What is a Linked List?

Linked Lists. What is a Linked List? Linked Lists Along with arrays, linked lists form the basis for pretty much every other data stucture out there. This makes learning and understand linked lists very important. They are also usually the

More information

Slide 1 CS 170 Java Programming 1

Slide 1 CS 170 Java Programming 1 CS 170 Java Programming 1 Objects and Methods Performing Actions and Using Object Methods Slide 1 CS 170 Java Programming 1 Objects and Methods Duration: 00:01:14 Hi Folks. This is the CS 170, Java Programming

More information

MITOCW watch?v=0jljzrnhwoi

MITOCW watch?v=0jljzrnhwoi MITOCW watch?v=0jljzrnhwoi The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

More information

MITOCW watch?v=zm5mw5nkzjg

MITOCW watch?v=zm5mw5nkzjg MITOCW watch?v=zm5mw5nkzjg The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

More information

Note Takers: Chau, Bao Kham (cs162-bb) and Quang Tran (cs162-bc) Topic: Real time system

Note Takers: Chau, Bao Kham (cs162-bb) and Quang Tran (cs162-bc) Topic: Real time system Note Takers: Chau, Bao Kham (cs162-bb) and Quang Tran (cs162-bc) Topic: Real time system A system in which clock time matters - Real time system. Normally, in a computer system, time is virtual. For example:

More information

P1_L3 Operating Systems Security Page 1

P1_L3 Operating Systems Security Page 1 P1_L3 Operating Systems Security Page 1 that is done by the operating system. systems. The operating system plays a really critical role in protecting resources in a computer system. Resources such as

More information

Hi everyone. Starting this week I'm going to make a couple tweaks to how section is run. The first thing is that I'm going to go over all the slides

Hi everyone. Starting this week I'm going to make a couple tweaks to how section is run. The first thing is that I'm going to go over all the slides Hi everyone. Starting this week I'm going to make a couple tweaks to how section is run. The first thing is that I'm going to go over all the slides for both problems first, and let you guys code them

More information

Minecraft Due: Mar. 1, 2015

Minecraft Due: Mar. 1, 2015 CS1972 Topics in 3D Game Engine Development Barbara Meier Minecraft Due: Mar. 1, 2015 Introduction In this assignment you will build your own version of one of the most popular indie games ever: Minecraft.

More information

Minecraft Due: March. 6, 2018

Minecraft Due: March. 6, 2018 CS1950U Topics in 3D Game Engine Development Barbara Meier Minecraft Due: March. 6, 2018 Introduction In this assignment you will build your own version of one of the most popular indie games ever: Minecraft.

More information

An array is a type of variable that is able to hold more than one piece of information under a single variable name.

An array is a type of variable that is able to hold more than one piece of information under a single variable name. Arrays An array is a type of variable that is able to hold more than one piece of information under a single variable name. Basically you are sub-dividing a memory box into many numbered slots that can

More information

A function is a named piece of code that performs a specific task. Sometimes functions are called methods, procedures, or subroutines (like in LC-3).

A function is a named piece of code that performs a specific task. Sometimes functions are called methods, procedures, or subroutines (like in LC-3). CIT Intro to Computer Systems Lecture # (//) Functions As you probably know from your other programming courses, a key part of any modern programming language is the ability to create separate functions

More information

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet. Mr G s Java Jive #2: Yo! Our First Program With this handout you ll write your first program, which we ll call Yo. Programs, Classes, and Objects, Oh My! People regularly refer to Java as a language that

More information

Robotics and Electronics Unit 5

Robotics and Electronics Unit 5 Robotics and Electronics Unit 5 Objectives. Students will work with mechanical push buttons understand the shortcomings of the delay function and how to use the millis function. In this unit we will use

More information

School of Computer Science CPS109 Course Notes Set 7 Alexander Ferworn Updated Fall 15 CPS109 Course Notes 7

School of Computer Science CPS109 Course Notes Set 7 Alexander Ferworn Updated Fall 15 CPS109 Course Notes 7 CPS109 Course Notes 7 Alexander Ferworn Unrelated Facts Worth Remembering The most successful people in any business are usually the most interesting. Don t confuse extensive documentation of a situation

More information

[ the academy_of_code] Senior Beginners

[ the academy_of_code] Senior Beginners [ the academy_of_code] Senior Beginners 1 Drawing Circles First step open Processing Open Processing by clicking on the Processing icon (that s the white P on the blue background your teacher will tell

More information

Post Experiment Interview Questions

Post Experiment Interview Questions Post Experiment Interview Questions Questions about the Maximum Problem 1. What is this problem statement asking? 2. What is meant by positive integers? 3. What does it mean by the user entering valid

More information

A lot of people make repeated mistakes of not calling their functions and getting errors. Make sure you're calling your functions.

A lot of people make repeated mistakes of not calling their functions and getting errors. Make sure you're calling your functions. Handout 2 Functions, Lists, For Loops and Tuples [ ] Functions -- parameters/arguments, "calling" functions, return values, etc. Please make sure you understand this example: def square(x): return x *

More information

1 of 5 5/11/2006 12:10 AM CS 61A Spring 2006 Midterm 2 solutions 1. Box and pointer. Note: Please draw actual boxes, as in the book and the lectures, not XX and X/ as in these ASCII-art solutions. Also,

More information

C - Colour Mixing. Let's use the Sparkle module and some switches to make a colour mixer! 2018 courses.techcamp.org.

C - Colour Mixing. Let's use the Sparkle module and some switches to make a colour mixer! 2018 courses.techcamp.org. C - Colour Mixing Let's use the Sparkle module and some switches to make a colour mixer! 2018 courses.techcamp.org.uk/ Page 1 of 7 INTRODUCTION Let's use the Sparkle module and some switches to make a

More information

Clickteam Fusion 2.5 Creating a Debug System - Guide

Clickteam Fusion 2.5 Creating a Debug System - Guide INTRODUCTION In this guide, we will look at how to create your own 'debug' system in Fusion 2.5. Sometimes when you're developing and testing a game, you want to see some of the real-time values of certain

More information

So on the survey, someone mentioned they wanted to work on heaps, and someone else mentioned they wanted to work on balanced binary search trees.

So on the survey, someone mentioned they wanted to work on heaps, and someone else mentioned they wanted to work on balanced binary search trees. So on the survey, someone mentioned they wanted to work on heaps, and someone else mentioned they wanted to work on balanced binary search trees. According to the 161 schedule, heaps were last week, hashing

More information

XP: Backup Your Important Files for Safety

XP: Backup Your Important Files for Safety XP: Backup Your Important Files for Safety X 380 / 1 Protect Your Personal Files Against Accidental Loss with XP s Backup Wizard Your computer contains a great many important files, but when it comes to

More information

Appendix: Common Errors

Appendix: Common Errors Appendix: Common Errors Appendix 439 This appendix offers a brief overview of common errors that occur in Processing, what those errors mean and why they occur. The language of error messages can often

More information

Chapter 1. Data types. Data types. In this chapter you will: learn about data types. learn about tuples, lists and dictionaries

Chapter 1. Data types. Data types. In this chapter you will: learn about data types. learn about tuples, lists and dictionaries Chapter 1 Data types In this chapter you will: learn about data types learn about tuples, lists and dictionaries make a magic card trick app. Data types In Python Basics you were introduced to strings

More information

Pong in Unity a basic Intro

Pong in Unity a basic Intro This tutorial recreates the classic game Pong, for those unfamiliar with the game, shame on you what have you been doing, living under a rock?! Go google it. Go on. For those that now know the game, this

More information

Table of Contents 1.1. Introduction Installation Quick Start Documentation Asynchronous Configuration 1.4.

Table of Contents 1.1. Introduction Installation Quick Start Documentation Asynchronous Configuration 1.4. Table of Contents Introduction 1 Installation 2 Quick Start 3 Documentation Asynchronous Configuration Level Streaming Saving And Loading Slot Templates 1.1 1.2 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1

More information

Dynamic Programming. See p of the text

Dynamic Programming. See p of the text Dynamic Programming See p. 329-333 of the text Clicker Q: There are some situations in which recursion can be massively inefficient. For example, the standard Fibonacci recursion Fib(n) = Fib(n-1) + Fib(n-2)

More information

Programming Project 1

Programming Project 1 Programming Project 1 Handout 6 CSCI 134: Fall, 2016 Guidelines A programming project is a laboratory that you complete on your own, without the help of others. It is a form of take-home exam. You may

More information

Who am I? I m a python developer who has been working on OpenStack since I currently work for Aptira, who do OpenStack, SDN, and orchestration

Who am I? I m a python developer who has been working on OpenStack since I currently work for Aptira, who do OpenStack, SDN, and orchestration Who am I? I m a python developer who has been working on OpenStack since 2011. I currently work for Aptira, who do OpenStack, SDN, and orchestration consulting. I m here today to help you learn from my

More information

Android Programming Family Fun Day using AppInventor

Android Programming Family Fun Day using AppInventor Android Programming Family Fun Day using AppInventor Table of Contents A step-by-step guide to making a simple app...2 Getting your app running on the emulator...9 Getting your app onto your phone or tablet...10

More information

Topic 3: Fractions. Topic 1 Integers. Topic 2 Decimals. Topic 3 Fractions. Topic 4 Ratios. Topic 5 Percentages. Topic 6 Algebra

Topic 3: Fractions. Topic 1 Integers. Topic 2 Decimals. Topic 3 Fractions. Topic 4 Ratios. Topic 5 Percentages. Topic 6 Algebra Topic : Fractions Topic Integers Topic Decimals Topic Fractions Topic Ratios Topic Percentages Duration / weeks Content Outline PART (/ week) Introduction Converting Fractions to Decimals Converting Decimals

More information

CSE 142/143 Unofficial Commenting Guide Eric Arendt, Alyssa Harding, Melissa Winstanley

CSE 142/143 Unofficial Commenting Guide Eric Arendt, Alyssa Harding, Melissa Winstanley CSE 142/143 Unofficial Commenting Guide Eric Arendt, Alyssa Harding, Melissa Winstanley In Brief: What You Need to Know to Comment Methods in CSE 143 Audience o A random person you don t know who wants

More information

Let s Make a Front Panel using FrontCAD

Let s Make a Front Panel using FrontCAD Let s Make a Front Panel using FrontCAD By Jim Patchell FrontCad is meant to be a simple, easy to use CAD program for creating front panel designs and artwork. It is a free, open source program, with the

More information

PROFESSOR: Last time, we took a look at an explicit control evaluator for Lisp, and that bridged the gap between

PROFESSOR: Last time, we took a look at an explicit control evaluator for Lisp, and that bridged the gap between MITOCW Lecture 10A [MUSIC PLAYING] PROFESSOR: Last time, we took a look at an explicit control evaluator for Lisp, and that bridged the gap between all these high-level languages like Lisp and the query

More information

Eventually, you'll be returned to the AVD Manager. From there, you'll see your new device.

Eventually, you'll be returned to the AVD Manager. From there, you'll see your new device. Let's get started! Start Studio We might have a bit of work to do here Create new project Let's give it a useful name Note the traditional convention for company/package names We don't need C++ support

More information

Crafting Simulated Worlds of Interactive Text: The Basics of Twine for History, English, and Language Teachers

Crafting Simulated Worlds of Interactive Text: The Basics of Twine for History, English, and Language Teachers Crafting Simulated Worlds of Interactive Text: The Basics of Twine for History, English, and Language Teachers Version 1.0: 1/9/2017 Jeremiah McCall: gamingthepast.net @gamingthepast jmc.hst@gmail.com

More information

B - Broken Track Page 1 of 8

B - Broken Track Page 1 of 8 B - Broken Track There's a gap in the track! We need to make our robot even more intelligent so it won't get stuck, and can find the track again on its own. 2017 https://www.hamiltonbuhl.com/teacher-resources

More information

Welcome to Lab! You do not need to keep the same partner from last lab. We will come around checking your prelabs after we introduce the lab

Welcome to Lab! You do not need to keep the same partner from last lab. We will come around checking your prelabs after we introduce the lab Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website: http://users.wpi.edu/~ndemarinis/ece2049/ You do not need to keep the same partner from

More information

Example Program. public class ComputeArea {

Example Program. public class ComputeArea { COMMENTS While most people think of computer programs as a tool for telling computers what to do, programs are actually much more than that. Computer programs are written in human readable language for

More information

Introduction to Game Programming Lesson 4 Lecture Notes

Introduction to Game Programming Lesson 4 Lecture Notes Introduction to Game Programming Lesson 4 Lecture Notes Learning Objectives: Following this lecture, the student should be able to: Define frame rate List the factors that affect the amount of time a game

More information

Othello Game. First, to learn the rules of Othello and play online, you can go here:

Othello Game. First, to learn the rules of Othello and play online, you can go here: Othello Game As an example of implementing a computer player, let s use the game Othello as an example. We are not using Upthrust because that will be the topic for a homework assignment! First, to learn

More information

Tic Tac Toe Game! Day 8

Tic Tac Toe Game! Day 8 Tic Tac Toe Game! Day 8 Game Description We will be working on an implementation of a Tic-Tac-Toe Game. This is designed as a two-player game. As you get more involved in programming, you might learn how

More information

Asynchronous Programming

Asynchronous Programming Asynchronous Programming Turn-in Instructions A main file, called gui.py See previous slides for how to make it main I ll run it from the command line Put in a ZIP file, along with any additional needed

More information

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Announcements Did you miss the first lecture? Come talk to me after class. If you want

More information

There are a number of ways of doing this, and we will examine two of them. Fig1. Circuit 3a Flash two LEDs.

There are a number of ways of doing this, and we will examine two of them. Fig1. Circuit 3a Flash two LEDs. Flashing LEDs We re going to experiment with flashing some LEDs in this chapter. First, we will just flash two alternate LEDs, and then make a simple set of traffic lights, finally a running pattern; you

More information

Instructor: Craig Duckett. Lecture 04: Thursday, April 5, Relationships

Instructor: Craig Duckett. Lecture 04: Thursday, April 5, Relationships Instructor: Craig Duckett Lecture 04: Thursday, April 5, 2018 Relationships 1 Assignment 1 is due NEXT LECTURE 5, Tuesday, April 10 th in StudentTracker by MIDNIGHT MID-TERM EXAM is LECTURE 10, Tuesday,

More information

Lesson Seven: Holding Gestures

Lesson Seven: Holding Gestures Lesson Seven: Holding Gestures PAGE 01 Lesson Seven: Holding Gestures Overview In the previous lesson, we made our functions more useful by allowing them to output through the keyboard. By assigning different

More information

Create a memory DC for double buffering

Create a memory DC for double buffering Animation Animation is implemented as follows: Create a memory DC for double buffering Every so many milliseconds, update the image in the memory DC to reflect the motion since the last update, and then

More information

Smart formatting for better compatibility between OpenOffice.org and Microsoft Office

Smart formatting for better compatibility between OpenOffice.org and Microsoft Office Smart formatting for better compatibility between OpenOffice.org and Microsoft Office I'm going to talk about the backbreaking labor of helping someone move and a seemingly unrelated topic, OpenOffice.org

More information

Spell Casting Motion Pack 5/5/2017

Spell Casting Motion Pack 5/5/2017 The Spell Casting Motion pack requires the following: Motion Controller v2.49 or higher Mixamo s free Pro Magic Pack (using Y Bot) Importing and running without these assets will generate errors! Overview

More information

4 + 4 = = 1 5 x 2 = 10

4 + 4 = = 1 5 x 2 = 10 Beginning Multiplication Ask your child... "Have you ever seen a multiplication problem?" Explain: "Instead of a plus ( + ) sign or a minus ( - ) sign a multiplication sign ( x ) is used." Have child to

More information

Cybersecurity For The Small Business & Home User ( Geared toward Windows, but relevant to Apple )

Cybersecurity For The Small Business & Home User ( Geared toward Windows, but relevant to Apple ) Cybersecurity For The Small Business & Home User ( Geared toward Windows, but relevant to Apple ) Topics: Antivirus / DSSO/ Email Computer Backups Security On The Go Mobile Safety Your first line of defense

More information

An Illustrated Guide to Shell Magic: Standard I/O & Redirection

An Illustrated Guide to Shell Magic: Standard I/O & Redirection An Illustrated Guide to Shell Magic: Standard I/O & Redirection Created by Brennen Bearnes Last updated on 2015-03-03 05:15:07 PM EST Guide Contents Guide Contents Overview Input & Output Standard I/O

More information

7. Arrays, More Java Looping

7. Arrays, More Java Looping 7-1 7. Arrays, More Java Looping Review and Preview In the last class, we introduced the idea of looping repeating code blocks. In this class Java lesson, we look at another way to loop (the Java for loop)

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

AHHHHHHH!!!! NOT TESTING! Anything but testing! Beat me, whip me, send me to Detroit, but don t make me write tests!

AHHHHHHH!!!! NOT TESTING! Anything but testing! Beat me, whip me, send me to Detroit, but don t make me write tests! NAME DESCRIPTION Test::Tutorial - A tutorial about writing really basic tests AHHHHHHH!!!! NOT TESTING! Anything but testing! Beat me, whip me, send me to Detroit, but don t make me write tests! *sob*

More information

Blitz2D Newbies: Definitive Guide to Types by MutteringGoblin

Blitz2D Newbies: Definitive Guide to Types by MutteringGoblin Blitz2D Newbies: Definitive Guide to Types by MutteringGoblin Types are probably the hardest thing to understand about Blitz Basic. If you're using types for the first time, you've probably got an uneasy

More information

CS390 Principles of Concurrency and Parallelism. Lecture Notes for Lecture #5 2/2/2012. Author: Jared Hall

CS390 Principles of Concurrency and Parallelism. Lecture Notes for Lecture #5 2/2/2012. Author: Jared Hall CS390 Principles of Concurrency and Parallelism Lecture Notes for Lecture #5 2/2/2012 Author: Jared Hall This lecture was the introduction the the programming language: Erlang. It is important to understand

More information

(Refer Slide Time: 1:27)

(Refer Slide Time: 1:27) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 1 Introduction to Data Structures and Algorithms Welcome to data

More information

How to Program a Primitive Twin-Stick Shooter in Monogame 3.4

How to Program a Primitive Twin-Stick Shooter in Monogame 3.4 How to Program a Primitive Twin-Stick Shooter in Monogame 3.4 This is a tutorial for making a basic twin-stick style shooter in C# using Monogame 3.4 and Microsoft Visual Studio. This guide will demonstrate

More information

CS103 Spring 2018 Mathematical Vocabulary

CS103 Spring 2018 Mathematical Vocabulary CS103 Spring 2018 Mathematical Vocabulary You keep using that word. I do not think it means what you think it means. - Inigo Montoya, from The Princess Bride Consider the humble while loop in most programming

More information

Taking Control of Your . Terry Stewart Lowell Williamson AHS Computing Monday, March 20, 2006

Taking Control of Your  . Terry Stewart Lowell Williamson AHS Computing Monday, March 20, 2006 Taking Control of Your E-Mail Terry Stewart Lowell Williamson AHS Computing Monday, March 20, 2006 Overview Setting up a system that works for you Types of e-mail Creating appointments, contacts and tasks

More information

What's the Slope of a Line?

What's the Slope of a Line? What's the Slope of a Line? These lines look pretty different, don't they? Lines are used to keep track of lots of info -- like how much money a company makes. Just off the top of your head, which of the

More information

Case studies: Outline Case Study: Noughts and Crosses

Case studies: Outline Case Study: Noughts and Crosses I. Automated Banking System Case studies: Outline Case Study: Noughts and Crosses II. III. Library Noughts and Crosses Definition of the problem Game played on a 3x3 square board between two players. The

More information

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS

More information

MITOCW MIT6_172_F10_lec18_300k-mp4

MITOCW MIT6_172_F10_lec18_300k-mp4 MITOCW MIT6_172_F10_lec18_300k-mp4 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for

More information

1 Getting started with Processing

1 Getting started with Processing cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

(Refer Slide Time: 1:43)

(Refer Slide Time: 1:43) (Refer Slide Time: 1:43) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology, Madras Lecture - 27 Pattern Detector So, we talked about Moore

More information

MITOCW watch?v=se4p7ivcune

MITOCW watch?v=se4p7ivcune MITOCW watch?v=se4p7ivcune The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

More information

Lab 2: Conservation of Momentum

Lab 2: Conservation of Momentum 3 Lab 2: Conservation of Momentum I. Before you come to lab... II. Background III. Introduction A. This lab will give you an opportunity to explore the conservation of momentum in an interesting physical

More information

The for Loop. Lesson 11

The for Loop. Lesson 11 The for Loop Lesson 11 Have you ever played Tetris? You know that the game never truly ends. Blocks continue to fall one at a time, increasing in speed as you go up in levels, until the game breaks from

More information

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so!

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so! Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other electronic devices

More information

Networking Past, Present and Future

Networking Past, Present and Future Networking 1 Networking Past, Present and Future Networking is a crucial feature of many modern games Used (12+ years ago) to be mainly PC Halo 2 brought online to the consoles Core feature of all consoles

More information

Using X-Particles with Team Render

Using X-Particles with Team Render Using X-Particles with Team Render Some users have experienced difficulty in using X-Particles with Team Render, so we have prepared this guide to using them together. Caching Using Team Render to Picture

More information

Part 7 More fill styles and an effect

Part 7 More fill styles and an effect Part 7 More fill styles and an effect Introduction To break the uniformity of the grass fill style, this part will continue creating fill styles and adding sheets show how to copy fill styles show how

More information

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form

More information

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created. + Inheritance + Inheritance Classes that we design in Java can be used to model some concept in our program. For example: Pokemon a = new Pokemon(); Pokemon b = new Pokemon() Sometimes we need to create

More information

Lecturer: William W.Y. Hsu. Programming Languages

Lecturer: William W.Y. Hsu. Programming Languages Lecturer: William W.Y. Hsu Programming Languages Chapter 9 Data Abstraction and Object Orientation 3 Object-Oriented Programming Control or PROCESS abstraction is a very old idea (subroutines!), though

More information

MITOCW ocw f99-lec07_300k

MITOCW ocw f99-lec07_300k MITOCW ocw-18.06-f99-lec07_300k OK, here's linear algebra lecture seven. I've been talking about vector spaces and specially the null space of a matrix and the column space of a matrix. What's in those

More information

Shadows for Many Lights sounds like it might mean something, but In fact it can mean very different things, that require very different solutions.

Shadows for Many Lights sounds like it might mean something, but In fact it can mean very different things, that require very different solutions. 1 2 Shadows for Many Lights sounds like it might mean something, but In fact it can mean very different things, that require very different solutions. 3 We aim for something like the numbers of lights

More information

Sending s With Sendmail - Part 2

Sending  s With Sendmail - Part 2 CODECALL Programming Tutorials Linux Tutorials, Guides and Tips Sending Emails With Sendmail - Part 2 Started by, Aug 31 2009 04:55 PM form, Posted 31 August 2009-04:55 PM Ok, so now that you know how

More information

Declaring and ini,alizing 2D arrays

Declaring and ini,alizing 2D arrays Declaring and ini,alizing 2D arrays 4 2D Arrays (Savitch, Chapter 7.5) TOPICS Multidimensional Arrays 2D Array Allocation 2D Array Initialization TicTacToe Game // se2ng up a 2D array final int M=3, N=4;

More information

Floating Point. What can be represented in N bits? 0 to 2N-1. 9,349,398,989,787,762,244,859,087, x 1067

Floating Point. What can be represented in N bits? 0 to 2N-1. 9,349,398,989,787,762,244,859,087, x 1067 MIPS Floating Point Operations Cptr280 Dr Curtis Nelson Floating Point What can be represented in N bits? Unsigned 2 s Complement 0 to 2N-1-2N-1 to 2N-1-1 But, what about- Very large numbers? 9,349,398,989,787,762,244,859,087,678

More information

1 of 5 3/28/2010 8:01 AM Unit Testing Notes Home Class Info Links Lectures Newsgroup Assignmen [Jump to Writing Clear Tests, What about Private Functions?] Testing The typical approach to testing code

More information

DER GOBBLE. Good Secure Crypto Wallet Practices. What is your wallet?

DER GOBBLE. Good Secure Crypto Wallet Practices. What is your wallet? DER GOBBLE Good Secure Crypto Wallet Practices When it comes to crypto currencies and securing your money, the absolute best 99% guaranteed security for your wallets is YOU. You are the one that will expose

More information

the gamedesigninitiative at cornell university Lecture 13 Architecture Design

the gamedesigninitiative at cornell university Lecture 13 Architecture Design Lecture 13 Take Away for Today What should lead programmer do? How do CRC cards aid software design? What goes on each card? How do you lay m out? What properties should y have? How do activity diagrams

More information

the gamedesigninitiative at cornell university Lecture 12 Architecture Design

the gamedesigninitiative at cornell university Lecture 12 Architecture Design Lecture 12 Take Away for Today What should lead programmer do? How do CRC cards aid software design? What goes on each card? How do you lay m out? What properties should y have? How do activity diagrams

More information

BOREDGAMES Language for Board Games

BOREDGAMES Language for Board Games BOREDGAMES Language for Board Games I. Team: Rujuta Karkhanis (rnk2112) Brandon Kessler (bpk2107) Kristen Wise (kew2132) II. Language Description: BoredGames is a language designed for easy implementation

More information

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently.

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently. The Science of Computing I Lesson 4: Introduction to Data Structures Living with Cyber Pillar: Data Structures The need for data structures The algorithms we design to solve problems rarely do so without

More information