EVENT DRIVEN SCRIPTING Andrew Williams. Robot Scripting Language  In the lab we looked at some very simple examples of Robot Scripting Language (RSL)

Slides:



Advertisements
Similar presentations
Welcome Back to School!!! Mr. Sortina.
Advertisements

How is a Dictionary Organized?
It’s time to own it tonight
Present Tenses Present Simple Present Continuous Present Perfect
What is a robot?? By: Kyle M..
Writing Effective Requests for Proposals (RFPs)
RTL Design Introduction Decoder Encoder Multiplexer Tri-state Buffer
A look at interrupts What are interrupts and why are they needed.
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Getting to know all about… STRANGERS and ACQUAINTANCES … and learning how to stay safe around them.
Study Skills Use the study timetable at the end of this power point to get ready for Christmas test.
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
How do games work? Game Workshop July 4, Parts Sprites/pictures Map/background Music/sounds Player character Enemies Objects.
Announcements 11/23/10 Prayer Exam 3 review session: Monday 5 - 6:30 pm, room C261 Exam 3 starts Tuesday after break Lab 10 due Tuesday after break.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
Announcements 4/1/11 Prayer Labs 9, 10 due tomorrow Exam 3 starts tomorrow “So, Dr. Colton, what’s on the exam?”
1 Psych 5500/6500 The t Test for a Single Group Mean (Part 5): Outliers Fall, 2008.
Mr Barton’s Maths Notes
A quick guide to success
Perceptions of the Role of Feedback in Supporting 1 st Yr Learning Jon Scott, Ruth Bevan, Jo Badge & Alan Cann School of Biological Sciences.
Wed/Fri Week 2 Functions! What are they? What do they look like in JavaScript? What are they good for? How do I use them? Some examples… Mini-Lab 1!!!
Lesson 4: Percentage of Amounts.
Variables in Java Part 2. ICS-3M1 - Mr. Martens - Variables Part 2 Recall the “int” Data Types When you divide one integer by another – you always get.
Physical Science CP Chapter 1
What is the output generated by this program? Please assume that each executed print statement completes, e.g., assume that each print is followed by an.
Introduction to Embedded Systems
CS 0004 –Lecture 1 Wednesday, Jan 5 th, 2011 Roxana Gheorghiu.
Chapter 5 Being a Web App. Very few servlet or JSP stands alone Many times in our application, different servlets or JSPs need to share information 
Practice Examples 1-4. Def: Semantics is the study of Meaning in Language  Definite conclusions Can be arrived at concerning meaning.  Careful thinking.
QUESTION NOT AT ALL RARELY SOME- TIMES INSTRUCTIONS: For each question, circle the # in the column that most applies. OFTEN VERY OFTEN 1. Are the tasks.
Learning the skills for programming Advanced Visual Programming.
CS329e – Elements of Visual Programming Implementing Programs Mike Scott (Slides 2-2)
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Robert Crawford, MBA West Middle School.  Explain how the binary system is used by computers.  Describe how software is written and translated  Summarize.
What makes good academic writing?. Essay writing Problem 1 – an essay assignment evaluates how well students can produce a particular piece of writing.
I understand my rights and responsibilities in the school. I understand the need for rules in society and why we have the rules we do in school. If I don’t.
Intermediate 2 Software Development Process. Software You should already know that any computer system is made up of hardware and software. The term hardware.
Current Assignments Homework 2 is available and is due in three days (June 19th). Project 1 due in 6 days (June 23 rd ) Write a binomial root solver using.
University of Windsor School of Computer Science Topics in Artificial Intelligence Fall 2008 Sept 11, 2008.
Game Maker – Getting Started What is Game Maker?.
1 How will execution time grow with SIZE? int array[SIZE]; int sum = 0; for (int i = 0 ; i < ; ++ i) { for (int j = 0 ; j < SIZE ; ++ j) { sum +=
1 CS161 Introduction to Computer Science Topic #9.
Teach GCSE Maths Discrete and Continuous Data. © Christine Crisp Discrete and Continuous Data "Certain images and/or photos on this presentation are the.
WATERFALL DEVELOPMENT MODEL. Waterfall model is LINEAR development lifecycle. This means each phase must be completed before moving onto the next!!! WHAT.
 In this packet we will look at:  The meaning of acceleration  How acceleration is related to velocity and time  2 distinct types acceleration  A.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
Copyright © 2007 by Curt Hill Interrupts How the system responds.
Distinct in My Reactions February 21. Think about it … What are some ways people typically handle interruptions? We are often interrupted with demands.
Lecture 3 CSE 341 – Microprocessors Lecture 3 Md. Omar Faruqe UB 1228
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
BIT 115: Introduction To Programming Professor: Dr. Baba Kofi Weusijana (say Doc-tor Way-oo-see-jah-nah, Doc-tor, or Bah-bah)
Introduction to TouchDevelop Lesson 3 – Comments & Lists Created by S. Johnson
A. 8 YEARS + B. 6-8 YEARS C. 4-6 YEARS D. 2-4 YEARS E. 0-2 YEARS *The purpose of asking whether the student has attended the Santa Monica district is to.
Lecture 3 Page 1 CS 236 Online Security Mechanisms CS 236 On-Line MS Program Networks and Systems Security Peter Reiher.
Journal 9/8/15 Is there anything in your life that you are 100% certain about? Anything you know for sure? Objective Tonight’s Homework To learn about.
The Extended Project. During this year the whole school will be working on an Extended Project During this year the whole school will be working on an.
Chapter 6 Limited Direct Execution Chien-Chung Shen CIS/UD
In today’s lesson we will be looking at: what we mean by the software development lifecycle the phases in the lifecycle We will focus particularly on testing:
Chapter 13 The Function of Operating Systems
Introduction to Event-Driven Programming
CIS 488/588 Bruce R. Maxim UM-Dearborn
Interrupts, Tasks and Timers
Processor Fundamentals
Lecture 24 Logistics Last lecture Today HW7 due today
BIC 10503: COMPUTER ARCHITECTURE
Lecture 21 Logistics Last lecture Today HW7 due Wednesday
Lecture 24 Logistics Last lecture Today HW7 due today
Lesson 13 – Social Skill: Apologizing.
Presentation transcript:

EVENT DRIVEN SCRIPTING Andrew Williams

Robot Scripting Language  In the lab we looked at some very simple examples of Robot Scripting Language (RSL)  Today we will be looking at a bit of the theory  Specifically, we will be looking at event driven scripting  If you have ever done Visual Basic programming, you will have done event-driven programming/scripting

Events  What is an event?  A party  My birthday  A wedding  A football match  These are all events but not really what I mean  On the next slide I will give a definition that is more useful

What is an event?  An event is something that happens  This begs a question, “what sort of something”?  In the context of Robot Battle, some events are:  Initialisation – a robot has just been loaded  A robot gets hit by a missile  A robot bumps into something  A robot detects another robot  A robot is pinged by another robot

RSL scripting  When you are scripting in RSL, you are deciding how you want to handle the various events that can occur.  What do you want to do if you are hit by a missile?  What should you do if you detect an enemy robot?  What should you do if you detect a friendly robot?  What do you want to do if you bump into a wall?  Etc  But first of all, how does Robot Battle know what you want to do when you are (eg) pinged?

Event handlers  The answer to my question is that you must register an event handler  An event handler is a piece of a script that handles an event  You register your event handler to tell robot battle what you want to happen when the event occurs  Most of the time you will register your event handlers when your robot is first loaded up. ie in the initialization section

Million-dollar question  What is the initialization event handler called?

Init  All RSL scripts have an Init section  This defines various information that is general to the Robot  Registering the event handlers  Whether the gun rotates with the radar dish  Whether to handle certain events (eg wall collisions)  Init runs once when the robot is loaded  (You can force it to run again if you like)

Registering event handlers  Suppose we want to run a section called pinged each time our robot is pinged by another robot  What does “pinged” mean in this context?  The command is: regping(name_of_event_handler, priority)  So in our case, it is: regping(pinged, 1)  (We will come to priorities in a while)

Registering event handlers  Suppose our program looks like this: init { regping(pinged, 1) } pinged { # run away! } This is a comment

Registering event handlers  Our program registers the section we want to use to handle events  This section is called pinged  The section itself doesn’t actually do anything yet (it turns out that running away is tricky, as most of you saw last week)  It has a comment which tells us what we intend to do.  We will (presumably) work out the details later…

What if no events occur?  We presumably don’t want the robot to just sit there while no events are occurring – we saw the consequences of that last week  While robot battle is running, each robot in the arena gets a “turn” (it is all happening so quickly, it seems continuous, but it is actually a series of discrete events).  So how do we register an event handler for the “it’s your turn” event?

regcore(handler)  We register a handler for the “it’s your turn” event using regcore(…) init { regcore(myturn) # no priority - lowest } myturn { bodyleft(5) }

The “it’s my turn” handler  This event handler does not need a priority regcore(myturn)  It always runs with the lowest priority  Why do you think this is?  Answer: This handler deals with situations when nothing is going on. When something does happen, you want to deal with that first. You can go back to routine tasks once you’ve dealt with the important stuff.

What does this do? init { regcore(myturn) clipmoves(false) regcldwall(hitwall, 1) } myturn { ahead(100) } hitwall { bodyleft(90) }

Event handler priorities  1 is the highest priority  Suppose you register several event handlers  On a particular turn, several events might occur  A robot bumps into a wall  A robot gets hit by a missile  A robot gets pinged  The priority determines the order in which these events are handled  Generally, a lower priority handler can be interrupted by a higher priority handler