ROBOT
(we tried to make this an acronym, but couldn’t)
Eric Risser (PM)Ashish Gagneja (SI)
Soonhac Hong (V&T)Aurelien Serandour (SA)
Mengu Sukan (LG)
Target Audience• The novice
–Knows very little math
–Knows no formal programming
–Knows how to turn on a computer?
(NOT YOU!!!)
Motivation• Programming is hard
• Programming is tedious/boring
• Robots are cool
• Everybody likes (video) games
The Solution• Make it simple
• Make it intuitive
• Make it rewarding
• And make it violent!
The Game• All out robot fight to the death
–That sounds awesome! What’s the catch?
• You write an A.I. program to indirectly control your robot avatar
–Navigate terrain
–Hunt enemies
–Protect and hoard resources
ROBOTIt’s more than a language
Aurelien Serandour (SA)
Basic architecture
Translator(written in
Java)
ROBOTcode
(x.robot)
Javasource code
(x.java)
How can we see what the avatar does?
Runtime environment
Runtime environment• Editable code area
• 3D visualization
• Many functionalities:
–Auto-indentation
– (Translated) Java code viewer
–No need to restart the application to translate/run the ROBOT code!
Final architecture
Translator
.robotprogram
file
.java fileJava
compiler.class file
Application
dynamic class
loader
GUIRobot class
ROBOTThe gory details
Ashish Gagneja (SI)
Sample ROBOT Program
! count# = 0
! think! | my_loc@ = location@ of self! |! | x# of 1th of targetLocation@... = 10! | y# of 1th of targetLocation@... = y# of my_loc@! | x# of 2th of targetLocation@... = 10! | y# of 2th of targetLocation@... = 10! | x# of 3th of targetLocation@... = x# of my_loc@! | y# of 3th of targetLocation@... = 10! | x# of 4th of targetLocation@... = x# of my_loc@! | y# of 4th of targetLocation@... = y# of my_loc@! |! | if my_loc@ != count#th of targetLocation@... then! | | move_to count#th of targetLocation@...! | +---else! | | count# = (count# + 1) rollover 4! | +---done! +---end
patrol.robot
Supported types
• Number! myNumber# = 12.35
• Boolean! bool? = True
• Location! enemyLocation@ = NOWHERE@
• Enemy! enemy! = get_closest_enemy enemyList!...
• List! enemyList!... = get_enemies
• Percentage! healthValue% = 100
• Resource! myResource$ = closest_resource$
Development Environmentand Tools
• Eclipse for development (with OpenGL, Swing)
• JFlex for the Lexical Analyzer
• CUP for the Parser
• SVN (Google code) for version control
• JUnit
ROBOTTesting… Testing… 1, 2, 3…
Soonhac Hong (V&T)
Verification & Validation! Compiler Test
! Regression and Blackbox testing for grammar consistency
! Complete Test Coverage and Traceability
count# = 0think my_loc@ = location@ of self x# of 1th of targetLoc@...=10 y# of 1th of targetLoc@...=y# of my_loc@ x# of 2th of targetLoc@...=10 y# of 2th of targetLoc@...=10 x# of 3th of targetLoc@...=x# of my_loc@ y# of 3th of targetLoc@...=10 x# of 4th of targetLoc@...=x# of my_loc@ y# of 4th of targetLoc@...=y# of my_loc@
if my_loc@ != count#th of targetLoc@... then move_to count#th of targetLoc@... 10% else count# = (count# + 1) rollover 4 doneend
User Code (Test code) Translated Code Baseline
Verification & Validation (cont'd)
! Application Test
! Unit test for automation and regression
! Integration test for usability and functionality
Unit Test using JUnit Integration Test
ROBOTLet’s bring it home
Mengu Sukan (LG)
RecapPurpose
• Simple/intuitive
• Fun (i.e. violent)
• Rewarding (i.e. intro to programming)
RecapArchitecture/Tools
• ROBOT ⇒ Java
• Translator: JFlex & CUP
• Runtime environment: Swing & OpenGL
Next Steps
• Finish grammar implementation
• Testing with more complex programs
Next StepsError Checking and Reporting
VS
Syntax error# Attempting error recovery# Finding recovery state on stack# Pop stack by one, state was # 10# Pop stack by one, state was # 2# Pop stack by one, state was # 0# No recovery state found on stack# Error recovery failsCouldn't repair and continue parseCan't recover from previous error(s)
Syntax error on line 21: 2: targetLocation@ 100 ----------------------^3:4: think5: | x# of targetLocation@=10 6: | y# of targetLocation@=10 7: | move_to targetLocation@ 92.5%8: +---end
Things we learned
• Designing a programming language is HARD!
• Designing a SIMPLE programming language is HARDER!*
* Larry Wall’s “Waterbed Theory of Complexity”
DemoBecause one animation is worth a 1,000 words...
Questions?Example: When can I get my hands
on this awesome game?