robot - columbia universityaho/cs4115_fall-2009/lectures/09-04-27_robot.pdfand tools • eclipse for...

25
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)

Upload: others

Post on 19-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

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)

Page 2: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

Target Audience• The novice

–Knows very little math

–Knows no formal programming

–Knows how to turn on a computer?

(NOT YOU!!!)

Page 3: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

Motivation• Programming is hard

• Programming is tedious/boring

• Robots are cool

• Everybody likes (video) games

Page 4: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

The Solution• Make it simple

• Make it intuitive

• Make it rewarding

• And make it violent!

Page 5: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

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

Page 6: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

ROBOTIt’s more than a language

Aurelien Serandour (SA)

Page 7: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

Basic architecture

Translator(written in

Java)

ROBOTcode

(x.robot)

Javasource code

(x.java)

How can we see what the avatar does?

Page 8: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

Runtime environment

Page 9: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

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!

Page 10: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

Final architecture

Translator

.robotprogram

file

.java fileJava

compiler.class file

Application

dynamic class

loader

GUIRobot class

Page 11: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

ROBOTThe gory details

Ashish Gagneja (SI)

Page 12: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

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

Page 13: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

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$

Page 14: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

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

Page 15: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

ROBOTTesting… Testing… 1, 2, 3…

Soonhac Hong (V&T)

Page 16: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

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

Page 17: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

Verification & Validation (cont'd)

! Application Test

! Unit test for automation and regression

! Integration test for usability and functionality

Unit Test using JUnit Integration Test

Page 18: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

ROBOTLet’s bring it home

Mengu Sukan (LG)

Page 19: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

RecapPurpose

• Simple/intuitive

• Fun (i.e. violent)

• Rewarding (i.e. intro to programming)

Page 20: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

RecapArchitecture/Tools

• ROBOT ⇒ Java

• Translator: JFlex & CUP

• Runtime environment: Swing & OpenGL

Page 21: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

Next Steps

• Finish grammar implementation

• Testing with more complex programs

Page 22: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

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

Page 23: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

Things we learned

• Designing a programming language is HARD!

• Designing a SIMPLE programming language is HARDER!*

* Larry Wall’s “Waterbed Theory of Complexity”

Page 24: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

DemoBecause one animation is worth a 1,000 words...

Page 25: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for

Questions?Example: When can I get my hands

on this awesome game?