5 Pages

4l06

Course: CPS 004, Fall 2009
School: Duke
Rating:
 
 
 
 
 

Word Count: 735

Document Preview

Plan Applets The Applets & Video Games Demo on making and running a simple applet from scratch Demo on making and running a simple application from scratch Measurements Frame rates Threads Video Games CompSci 4 Applets & Video Games 6.1 CompSci 4 Applets & Video Games 6.2 Applets Definition From the Java 5.0 API An applet is a small program that is intended not to...

Register Now

Unformatted Document Excerpt

Coursehero >> North Carolina >> Duke >> CPS 004

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Plan Applets The Applets & Video Games Demo on making and running a simple applet from scratch Demo on making and running a simple application from scratch Measurements Frame rates Threads Video Games CompSci 4 Applets & Video Games 6.1 CompSci 4 Applets & Video Games 6.2 Applets Definition From the Java 5.0 API An applet is a small program that is intended not to be run on its own, but rather to be embedded inside another application. Definition Differences from applications Download process Use of html Use of jar files Example The name Applet is derived from the name Application. CompSci 4 Applets & Video Games 6.3 CompSci 4 Applets & Video Games 6.4 Applet vs. Application Applets Run in web browser Often downloaded from untrusted site Restricted from file system access Restricted from outside network communication Applications Run independently Typically obtained through trusted source Allow creation and modifications of files Allow outside network communication Must have a main method Running an Applet 1. 2. 3. Load a web page with an <applet> tag embedded in the HTML Load the compiled applet from website to local machine Run the compiled applet on the local machine CompSci 4 Applets & Video Games 6.5 CompSci 4 Applets & Video Games 6.6 HTML for Applet <applet code=pong/Pong.class archive=pong.jar width=200 height=200></applet> code is the name of the class that extends JApplet archive is the name of the jar file containing all classes Jar files Jar is short for Java Archive Compresses files and directories into a single file Can be executed in compressed format Files and directories can be extracted Can contain any combination of source code, byte code, and other files CompSci 4 Applets & Video Games 6.7 CompSci 4 Applets & Video Games 6.8 Demo Applet Demo Make an applet in Eclipse Make the html in composer Save both to network drive View from the web Application Demo Make an application in Eclipse Run in Eclipse Video Games Simulation Measurement units Discrete/Continuous Monitor frame rate limitation Model frame rate limitation User interaction rate Threads overview CompSci 4 Applets & Video Games 6.9 CompSci 4 Applets & Video Games 6.10 Video Game as Simulation Video games are simulations of the real world and worlds that do not exist. These simulations are built for our pleasure, but may serve other purposes as well. Examples Flight simulator Oregon trail Pinball Measurement Units Initial in setup coordinate system with origin at top left and (1, 1) at bottom right Allows simple scaling to varying screen resolutions Can be done hierarchically Distances in pixels Time in seconds Velocity in pixels/second CompSci 4 Applets & Video Games 6.11 CompSci 4 Applets & Video Games 6.12 Discrete vs. Continuous Time Discrete Used to approximate continuous Simple conceptually for good rough estimates Causes problems when modeling continuous functions with too coarse grain estimates Continuous Requires abstract representation or infinite precision Requires analytical reasoning Conceptually difficult to model directly Monitor Frame Rate Why 75-85 Hz (Frames/second)? Because we dont actually visually process continuously Smooth fast movement? Consider a rate of 1 pixel a second would take more than 8 seconds to move across the screen. For fast movement there must be jumps in location. CompSci 4 Applets & Video Games 6.13 CompSci 4 Applets & Video Games 6.14 Model Frame Rate Model is continuous. Frame rate is discrete. The granularity of frame rate is too coarse for our continuous model. How do we solve this problem? Two separate rates: User Interaction Rate Devices such as the keyboard and mouse must also be polled at regular intervals. At what rate should they be polled? Depends on: Available compute power Monitor frame rate Model frame rate In contention with monitor frame rate In contention with model frame rate Which thread has priority CompSci 4 Applets &a...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Duke - CPS - 004
Looping StructuresCompSci 4Iteration10.1The PlanWhile not everyone understands: 1. Motivate loops 2. For loops 3. While loops 4. Do-while loops 5. Equivalence 6. Application of Simulated Collision 7. Practice ProblemsCompSci 4Iteration
Duke - CPS - 004
Applets &amp; Video GamesCompSci 4Applets &amp; Video Games6.1The PlanAppletsDemo on making and running a simple applet from scratch Demo on making and running a simple application from scratchVideo GamesMeasurements Frame rates ThreadsCom
Duke - CPS - 004
CollectionsCompSci 4Collections11.1The Plan Why use collections? What collections are available? Accessing the elements of a collection? Examples PracticeCompSci 4Collections11.2Why use collections?Consider the code below. What
Duke - CPS - 004
Introduction to Jams Video Game PackageCompSci 4Game Package4.1The Plan Scope of Video Game Package Basic Design of the Video Game Package Steps to making a game How the Pong was madeCompSci 4Game Package4.2Scope of the Video Gam
Duke - CPS - 004
Playing Against the Computer Recursion &amp; the Minimax AlgorithmKey to Acing Computer Science If you understand everything, ace your computer science course. Otherwise, study &amp; program something you don't understand, then see Key to Acing Computer Sci
Duke - CPS - 001
becker.robotsClass Robotjava.lang.Object | +-becker.robots.Sim | +-becker.robots.Thing | +-becker.robots.Robot Direct Known Subclasses: RobotSE public class Robot extends Thing Robots exist on a rectangular grid of roads and can move, turn left ni
Duke - CPS - 001
Todays topicsProgramming Recursion Invariants Reading Great Ideas, p. 180-186 Brookshear, Section 5.5 6.3 Upcoming Copyrights, patents, and digital media SecuritySolving Problems Recursively!Recursion is an indispensable tool in a programmers t
Duke - CPS - 001
Today's topicsParsing Java Programming Reading Great Ideas, Chapter 3 &amp; 4Robots!Java: Learning to Program with Robots &quot; Based on Rich Pattis' Karel the Robot &quot; Teaches basic Java concepts in the context of graphical world Objects and methods
Duke - CPS - 001
The Oracle of BaconSix Degrees of Kevin Bacon Link people to Kevin Bacon based on movies they have been in togetherMorgan Freeman was in Se7en with Brad Pitt Brad Pitt was in Sleepers with Kevin Bacon Morgan Freeman has a Bacon number of 2 Who
Duke - CPS - 001
How does Hearing Work? Introduction to Processing Digital Soundsadapted from: Barb Ericson Georgia Institute of Technology Sept 2005 The outer ear catches sounds The eardrum vibrates The inner ear translates the vibrations to nerve impulses for
Duke - CPS - 001
Todays topicsDigital Intellectual Property IssuesWhat is digital?!Whats the difference between &quot; Rolex and Timex? &quot; VCR tape and DVD? How is ripping to a mp3 different from recording to a tape? &quot; Reproduction: immediate and future &quot; Distributio
Duke - CPS - 110
CompSci 110 Fall 2001 Final Exam Name:_RULES: Resources: This exam may be done with open book and open notes, including lecture notes. This must be an individual effort. Time allowed: 3 hours. Put your name on each sheet. For each multiple choice qu
Duke - CPS - 110
COMPSCI 110 Fall 2001 Midterm Name:_README: Individual effort only, closed book and notes, time allowed: 75 minutes. Put your name on each sheet in case the pages get separated. Be brief, but show your work for partial credit in case your answer may
Duke - CPS - 140
Section: LL Parsing LL(k) Parser: top-down parser - starts with start symbol on stack, and repeatedly replace nonterminals until string is generated. predictive parser - predict next rewrite rule rst L of LL means - read input string left to right
Duke - CPS - 140
Section: Turing Machines Review Regular Languages FA, RG, RE recognize Context Free Languages PDA, CFG recognize1DFA:input tape a tape head current state 0 5 4 3 1 2 b b a bhead moves2Turing Machine:input tape a tape head current state
Duke - CPS - 140
CPS 140 - Mathematical Foundations of CS Dr. S. Rodger Section: Turing Machines - Building Blocks (handout)Combining Turing Machines We will dene notation that will make it easier to look at more complicated Turing machines 1. Given Turing Machines
Duke - CPS - 140
recursively enumerable languages context-free languages regular languages
Duke - CPS - 237
Fall 2001 Handout 2: Basics regarding expectations and the probabilistic methodCMSC 858S: Randomized Algorithms1 Some basic properties of the expectationHere, we will assume for simplicity that all random variables X that we consider take on val
Duke - CPS - 140
CPS 140 - Mathematical Foundations of CS Dr. S. Rodger Section: LR Parsing (handout)LR PARSING LR(k) Parser bottom-up parser shift-reduce parser L means: reads input left to right R means: produces a rightmost derivation k - number of lookahea
Duke - CPS - 237
Randomized incremental constructionSpecial sampling idea: Sample all except one item hope nal addition makes small or no change Method: process items in order average case analysis randomize order to achieve average case e.g. binary tree for s
Duke - CPS - 140
Section: LR Parsing LR PARSING LR(k) Parser bottom-up parser shift-reduce parser L means: reads input left to right R means: produces a rightmost derivation k - number of lookahead symbolsLR parsing process convert CFG to PDA Use the PDA and
Duke - CPS - 234
CPS234 Computational Geometry1 November 2005Lecture 18: Random SamplingLecturer: Pankaj K. Agarwal Scribe: Amber Stillings18.1 Lecture SummaryThis lecture will show motivating reasons for using random sampling. An algorithm for nding the medi
Duke - CPS - 102
CPS102- Homework 1Due on September 15, 2005 Questions may continue on the back. Please write clearly. What I cannot read, I will not grade. Typed homework is preferable. A good compromise is to type the words and write the math by hand. The Duke Com
Duke - CPS - 097
Today's TopicsArt of Lego Design Notes from Jason Geist, Carnegie Mellon University Differential Drive Notes from Zachary Dodd, Harvey-Mudd CollegeMindstorms2.1Goals:Build better robots Minimize mechanical breakdowns Build robots th
Duke - CPS - 230
Meeting 7September 20, 2005Red-Black TreesBinary search trees are an elegant implementation of the dictionary data type, which requires support for item void void S EARCH (item ), I NSERT (item ), D ELETE (item ),aaba borb ab b c a
Duke - CPS - 230
Meeting 12October 6, 2005Solving Recurrence RelationsRecurrence relations are perhaps the most important tool in the analysis of algorithms. We have encountered several methods that can sometimes be used to solve such relations, such as guessin
Duke - CPS - 230
Homework Assignment 1September 13, 2005Homework on Design TechniquesWrite the solution to each problem on a single page. The deadline for handing in solutions is September 22.Problem 1. (20 = 12 + 8 points). Sort a linear array A[1.n] with B U
Duke - CPS - 230
Meeting 10September 29, 2005Heaps and HeapsortA heap is a data structure that stores a set and allows fast access to the item with highest priority. It is the basis of a fast implementation of selection sort. On the average this algorithm is a
Duke - CPS - 230
Meeting 3September 6, 2005Prune-and-SearchWe use two algorithms for selection as examples for the prune-and-search paradigm. The problem is to nd the i-smallest item in an unsorted collection of n items. We could rst sort the list and then retu
Duke - CPS - 108
Working as part of a groupsee McCarthy, Dynamics of Software Developmentestablish a shared vision what was/is Freecell? what can we add? harmonious sense of purpose develop a creative environment the more ideas the better, ideas are infectious don
Duke - CPS - 102
The Zebra PuzzleCarlo Tomasi Computer Science Duke University1IntroductionIn the class textbook, the Zebra puzzle is offered as an exercise for Section 1.1 on logic (Exercise 61, page 20). Here is the puzzle: Five men with different nationalit
Duke - CPS - 108
multi-platform, multi-os client/serverSuppose we send data between clients and servers Architectural issues impact client/server code Little-endian/Big-endian issues 0xabcd is a 32-bit value, which is MSB? How is this stored?How big is an int? 32
Duke - CPS - 230
Meeting 11October 4, 2005Fibonacci HeapsThe Fibonacci heap is a data structure implementing the priority queue abstract data type, just like the ordinary heap but more complicated and asymptotically faster for some operations. We rst introduce
Duke - CPS - 234
CPS234 Computational GeometrySeptember 22nd, 2005Lecture 8: Orthogonal Range SearchingLecturer: Pankaj K. Agarwal Scribe: Mason F. Matthews8.1 Range SearchingThe general problem of range searching is as follows: Given input S, a set of n poin
Duke - CPS - 110
Xen&amp;LinuxKernel ProgrammingAddingaSystemCallIonutConstandacheWhatisXen? Avirtualmachinemonitor(VMM)forx86compatiblecomputersRunmultipleinstancesofOSessimultaneously ProvidesisolationbetweenGuestOSes DoesnothidevirtualizationfromtheGues
Duke - CPS - 196
X v IhtIdV`RP Hw U sXTY Y tIIdIVuVg 7d7IdY v eUeUUT E WUTU vTY sQ g HXQ WP IGt7VT dGIU dVT UgT WY WUY GV7Q `VIG5I7ddRP X v I`V7IGf HWX 7 HwY v f&quot;xR&quot;c R&quot; xi r&quot; x dr f Rc xcxcR fd &quot; Ri9 rx&quot;f hd f RccR
Duke - CPS - 250
Duke UniversityDepartment of Computer Science CPS 250: Numerical Analysis Spring, 2007Time: 11:40am 12:55pm TuTh Instructor: Xiaobai Sun Oce Location: D107 LSRC Email: xiaobai@cs.duke.edu Prerequisites:Class location: D243 LSRC TAs: Mingyu Guo
Duke - CPS - 296
Sponsored Search: a Brief HistoryYahoo! Inc. 3333 Empire Ave. Burbank CA 91504 USA (818) 524-3000Daniel C. FainYahoo! Inc. 701 First Ave. Sunnyvale CA 94089 USA (408) 439-3300Jan O. Pedersenfaind@yahoo-inc.com ABSTRACT4. 5.jpederse@yahoo-
Duke - CPS - 296
Distortion Estimation Techniques in Solving Visual CAPTCHAsGabriel Moy, Nathan Jones, Curt Harkless, and Randall PotterAret Associates e Sherman Oaks, CA 91403 Email: {moy,jones,harkless,potter}@arete.comAbstract This paper describes two distorti
Duke - CPS - 296
L e a r n i n g t o C o o r d i n a t e A c t i o n s i n M u l t i - A g e n t SystemsGerhard WeiB I n s t i t u t fur l n f o r m a t i k , Technische Universitat Miinchen Arcisstr. 2 1 , 8000 Miinchen 2, Germany weissg@informatik.tu-muenchen.de
Duke - CPS - 049
Discussion Report: The Anatomy of a Large scale Hypertextual Web Search EngineAzbayar Demberel Department of Computer Science asic@cs.duke.edu1The World Before GoogleWith the birth of the World Wide Web (WWW), the usage of the Internet has gro
Duke - CPS - 296
Peekaboom: A Game for Locating Objects in ImagesLuis von Ahn, Ruoran Liu and Manuel Blum Computer Science Department, Carnegie Mellon University 5000 Forbes Avenue, Pittsburgh PA 15213 {biglou, royliu, mblum}@cs.cmu.eduABSTRACTWe introduce Peekab
Duke - CPS - 049
CPS 49S Google: The Computer Science Within and its Impact on Society - Spring 2007 Homework 4 Due date: Wednesday, April 18, 2007, 11.59 PM. Late submissions will not be accepted (unless there are documented excuses from the dean). Submission: In
Duke - CPS - 049
Chapter 9: Google Goes Public Chapter 10: Google Today, Google Tomorrow Neel Vora Discussion Report: 3/29/07Should Google go Public?Chapter Nine of The Search: How Google and Its Rivals Rewrote the Rules of Business and Transformed Our Culture foc
Duke - CPS - 140
CPS 140Project 1 Project Due: Thursday, Feb. 8, 11:59pm 30 pointsSpring 2007An elementary school would like to have a simple animation program to teach kids a little bit about computer science, in particular how programming works. Many of the k
Duke - CPS - 049
Discussion Report: The Anatomy of a Large scale Hypertextual Web Search Engine (part 2)Azbayar Demberel Department of Computer Science asic@cs.duke.edu January 24, 200711.1System designData structuresA good search engine is not just a clever
Duke - CPS - 296
Quantifying Incentive Compatibility of Ranking SystemsAlon Altman Moshe Tennenholtz 15th March 2006Abstract Reasoning about agent preferences on a set of alternatives, and the aggregation of such preferences into some social ranking is a fundamenta
Duke - CPS - 296
Truthful Auctions for Pricing Search Keywords Gagan Aggarwal Google Inc. Ashish Goel Stanford University March 12, 2006 Rajeev Motwani Stanford UniversityAbstract We present a truthful auction for pricing advertising slots on a web-page assumin
Duke - CPS - 049
CPS 49S Google: The Computer Science Within and its Impact on Society - Spring 2007 Homework 1 Due date: Tuesday, Jan 30, 2007, in class (2.50 PM). Late submissions will not be accepted (unless there are documented excuses from the dean). Submissi
Duke - CPS - 001
Todays topicsNetworks &amp; the Internet Basic HTML The basis for web pages Almost programming Upcoming Connections Algorithms Reading Internet history readings Great Ideas Chapters 1 Computer Science, Chapter 4CompSci 001 2.1NetworksNeed to communi
Duke - CPS - 001
Outline of implementationRSA algorithm for key generation select two prime numbers p, q compute n = p q v = (p-1) (q-1) select small odd integer k such that gcd(k, v) = 1 compute d such that (d k)%v = 1 RSA algorithm for encryption/decryption encryp
Duke - CPS - 001
1 WHAT YOU SHOULD KNOW (and More) FOR THE LAB FINALExplanation of JavaWhat is an object? o An object is a value of a class type o An example is: String, Sound or a Robot What is a primitive type? o A primitive type is a number type or Boolean typ
Duke - CPS - 001
Todays topicsBinary Numbers Brookshear 1.1-1.6 Slides from Prof. Marti Hearst of UC Berkeley SIMS Upcoming Networks Interactive Introduction to Graph Theoryhttp:/www.utm.edu/cgi-bin/caldwell/tutor/departments/math/graph/introDigital ComputersWh
Duke - CPS - 001
Normalize Sounds Make the whole sound as loud as possible How loud can it be? The max positive value is 32767 The max negative value is -32768Creating a Sound Clip To clip the This out of This is a test. Determine where it starts and stops U
Duke - CPS - 001
Today's topicsRevisiting numbers &amp; text Methods Loops Arrays Reading Great Ideas, Chapter 4Types for NumbersThe type String is not a built-in type, technically it's a class There are many numerical types in Java We'll use two int, represents inte
Duke - CPS - 001
Welcome!Principles of Computer Science CompSci 1 LSRC B101 M, W, F 10:20-11:10 Professor Jeff ForbesTodays topicsWhat is this course about? How are we going to learn that? Who is this guy talking to us? Where do we go from here? An overview of co
Duke - CPS - 170
Historical Perspective I Logic IntroCPS 170 Ron Parr Logic was one of the classical foundations of AI Dream: A Knowledge-Based agent Tell the agent facts Agent uses rules of inference to deduce consequences Example: prolog Distinction between
Duke - CPS - 170
Why Study Games? Many human activities can be modeled as games Negotiations Bidding TCP/IP Military confrontations Pursuit/EvasionGamesCPS 170 Ron Parr Games are used to train the mind Human game-playing, animal play-fightingWhy Are Gam
Duke - CPS - 270
COMPSCI 270 - Articial Intelligence Project I Playing the Game of OthelloDue date: September 291DescriptionIn this programming project you will design and implement an Othello playing program. If you are unfamiliar with the rules of Othello th
Duke - CPS - 271
9/11/2007What Makes a Good Prediction? Obviously: One that gives best performance in the future, but how do we pick this in advance?Choosing PredictorsCPS 271 Ron ParrRegression figures provided by Christopher Bishop and 2007 Christopher Bish
Duke - CPS - 296
Lecture notes 4: DualityVincent Conitzer1Introductionmaximize 3x1 + 2x2 subject to 4x1 + 2x2 16 x1 + 2x2 8 x1 + x2 5 x1 0; x2 0Let us again consider the linear program for our original painting problem instance:We already know that the