finite state machines using alice stephen cano cis 4914 senior project wednesday december 5th

13
Finite State Finite State Machines using Machines using Alice Alice Stephen Cano Stephen Cano CIS 4914 Senior Project CIS 4914 Senior Project Wednesday December 5th Wednesday December 5th

Upload: jeffry-york

Post on 18-Jan-2018

219 views

Category:

Documents


0 download

DESCRIPTION

Project Summary Problem: Can a successful Finite State Machine be assembled in the Alice programming environment? Problem: Can a successful Finite State Machine be assembled in the Alice programming environment? Alice is a tool made to teach beginners how to program, but contains the ability to easily render a 3D world (free at Alice is a tool made to teach beginners how to program, but contains the ability to easily render a 3D world (free at Is Alice’s “simple” environment enough to handle high-level programming concepts? Is Alice’s “simple” environment enough to handle high-level programming concepts?

TRANSCRIPT

Page 1: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Finite State Finite State Machines using Machines using

AliceAliceStephen CanoStephen Cano

CIS 4914 Senior ProjectCIS 4914 Senior ProjectWednesday December 5thWednesday December 5th

Page 2: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Project SummaryProject Summary

Motivation: In order to teach AI in a Motivation: In order to teach AI in a University setting, specifically high University setting, specifically high level AI algorithms such as Finite level AI algorithms such as Finite State Machines, there needs to be a State Machines, there needs to be a foundational environment to work in.foundational environment to work in. Save students the time of building Save students the time of building

characters or settings for artificial characters or settings for artificial intelligence and instead focus on the intelligence and instead focus on the algorithms themselvesalgorithms themselves

Page 3: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Project SummaryProject Summary Problem: Can a successful Finite State Problem: Can a successful Finite State

Machine be assembled in the Alice Machine be assembled in the Alice programming environment?programming environment?

Alice is a tool made to teach beginners Alice is a tool made to teach beginners how to program, but contains the ability how to program, but contains the ability to easily render a 3D world (free at to easily render a 3D world (free at http://www.alice.org)http://www.alice.org)

Is Alice’s “simple” environment enough to Is Alice’s “simple” environment enough to handle high-level programming concepts?handle high-level programming concepts?

Page 4: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Project SummaryProject Summary Solution: Create a 3D world with a Solution: Create a 3D world with a

single actor that is controlled by a single actor that is controlled by a finite state machinefinite state machine

User interaction adds additional User interaction adds additional states and extra situations to the states and extra situations to the FSMFSM

Start simple and build up, seeing Start simple and build up, seeing what Alice can and cannot handlewhat Alice can and cannot handle

Page 5: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Literature SearchLiterature Search Anon, Anon, http://www.alice.orghttp://www.alice.org, Carnigie Mellon (as-, Carnigie Mellon (as-

of Oct 10of Oct 10thth)) Alice tutorials and other work done in AliceAlice tutorials and other work done in Alice

Steve Rabin, Steve Rabin, AI Game Programming Wisdom 2AI Game Programming Wisdom 2,,Charles River Media (Dec 2003)Charles River Media (Dec 2003) What is a Finite State Machine?What is a Finite State Machine? Good examples for single-actor FSMGood examples for single-actor FSM How to debug and enhance your finite state machineHow to debug and enhance your finite state machine

Ian Millington, Ian Millington, Artificial Intelligence for GamesArtificial Intelligence for Games,,Morgan Kaufmann (June 2006)Morgan Kaufmann (June 2006) More basic information around Finite State MachinesMore basic information around Finite State Machines ““Ant colony” finite state machine involving many Ant colony” finite state machine involving many

actorsactors

Page 6: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Work PerformedWork Performed In Alice, created a single-actor finite In Alice, created a single-actor finite

state machinestate machine Main actor, the “penguin” character, Main actor, the “penguin” character,

goes between 3 different states when goes between 3 different states when left to run, and can enter two left to run, and can enter two different states based on user different states based on user interaction.interaction.

Created two “objects”Created two “objects”the user can put intothe user can put intothe scenethe scene

Page 7: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

State DiagramsState Diagrams

Page 8: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Main functionsMain functions Penguin.FSM:Penguin.FSM:

Main “always running” function, had a Main “always running” function, had a looped action that shows the finite state looped action that shows the finite state machine has entered a certain state.machine has entered a certain state.

Example: if in “roam” state, call Example: if in “roam” state, call Penguin.roam, which makes the penguin Penguin.roam, which makes the penguin take a few stepstake a few steps

Also contains a check to see if conditions Also contains a check to see if conditions have been met to enter a new statehave been met to enter a new state

Page 9: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Main functionsMain functions Penguin.StatecheckPenguin.Statecheck

Checks the environment of the Checks the environment of the character to see if the state needs to be character to see if the state needs to be changedchanged

Performs the necessary actions for pre- Performs the necessary actions for pre- and post-state change processingand post-state change processing

Example: Sit down to eat when hungry, Example: Sit down to eat when hungry, turn to run and hide when scaredturn to run and hide when scared

Page 10: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Conclusions: PositiveConclusions: Positive While missing some high-level While missing some high-level

functionality, a simple FSM can be functionality, a simple FSM can be built in Alicebuilt in Alice

Enough functionality Enough functionality exists for the purpose exists for the purpose of educational venturesof educational venturesin AI.in AI.

Very fun, easy to useVery fun, easy to use

Page 11: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Conclusions: NegativeConclusions: Negative FSM not as “smart” as it could be due to FSM not as “smart” as it could be due to

programming limitationsprogramming limitations If/Else statements only good available If/Else statements only good available

logiclogic Animations must finish before “moving” Animations must finish before “moving”

on, cannot have multiple threads running on, cannot have multiple threads running to constantly check statesto constantly check states Example: Penguin will not notice fear-Example: Penguin will not notice fear-

enducing skeleton until he is done with his enducing skeleton until he is done with his walk cyclewalk cycle

Cannot dynamically add objects to the Cannot dynamically add objects to the environmentenvironment

Page 12: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Future WorkFuture Work Could a more skilled Alice animator create Could a more skilled Alice animator create

sharper state transitions?sharper state transitions? Can the Java base of Alice be directly Can the Java base of Alice be directly

modified to be more inclusive of AI modified to be more inclusive of AI technology?technology?

Can other AI algorithms also be replicated Can other AI algorithms also be replicated in Alice?in Alice?

Is there a better programming environment Is there a better programming environment for educational purposes of AI?for educational purposes of AI?

Page 13: Finite State Machines using Alice Stephen Cano CIS 4914 Senior Project Wednesday December 5th

Q/A time and quick notesQ/A time and quick notes

Thanks to Professor Schmalz, Dr. Thanks to Professor Schmalz, Dr. Dankel, and my fellow Senior classDankel, and my fellow Senior class

I wish you all a great winter break, I wish you all a great winter break, and a great spring semester!and a great spring semester!