State Machine Presentation1 61
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
408
On Slideshare
403
From Embeds
5
Number of Embeds
1

Actions

Shares
Downloads
4
Comments
0
Likes
0

Embeds 5

http://www.slideshare.net 5

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. The State Pattern Thursday, March 18, 2010
  • 2. The State Pattern An Appalling Exploration Thursday, March 18, 2010
  • 3. ? Thursday, March 18, 2010
  • 4. ? Thursday, March 18, 2010
  • 5. Thursday, March 18, 2010
  • 6. Thursday, March 18, 2010
  • 7. Thursday, March 18, 2010
  • 8. Thursday, March 18, 2010
  • 9. Thursday, March 18, 2010
  • 10. Thursday, March 18, 2010
  • 11. Thursday, March 18, 2010
  • 12. Thursday, March 18, 2010
  • 13. Thursday, March 18, 2010
  • 14. Thursday, March 18, 2010
  • 15. Thursday, March 18, 2010
  • 16. Thursday, March 18, 2010
  • 17. :) Thursday, March 18, 2010
  • 18. Why we need it... Thursday, March 18, 2010
  • 19. B. F. Skinner (do not do what he did) Thursday, March 18, 2010
  • 20. Thursday, March 18, 2010
  • 21. Skinner box “Operant Conditioning Chamber” Thursday, March 18, 2010
  • 22. Thursday, March 18, 2010
  • 23. FAIL Thursday, March 18, 2010
  • 24. What you do depends on your state Thursday, March 18, 2010
  • 25. Blood test Thursday, March 18, 2010
  • 26. Thursday, March 18, 2010
  • 27. Not Thing Blood test Thursday, March 18, 2010
  • 28. Thursday, March 18, 2010
  • 29. Not Thing Blood test Thing Thursday, March 18, 2010
  • 30. Thursday, March 18, 2010
  • 31. First aid Thursday, March 18, 2010
  • 32. Not Thing First aid Thursday, March 18, 2010
  • 33. Thursday, March 18, 2010
  • 34. Not Thing First aid Thing Thursday, March 18, 2010
  • 35. Thursday, March 18, 2010
  • 36. Not Thing First aid Thing Not Thing Blood test Thing Thursday, March 18, 2010
  • 37. Not Thing First aid Thing Not Thing Blood test Thing Thursday, March 18, 2010
  • 38. 1. Repeatedly using same test 2. Answers to test are predictable and repeated 3. Test concerns one’s own internal matters Thursday, March 18, 2010
  • 39. Time to get practical. Thursday, March 18, 2010
  • 40. Thursday, March 18, 2010
  • 41. public class Creature { public function Creature() { trace(“Ecce Creature”); } } Thursday, March 18, 2010
  • 42. Thursday, March 18, 2010
  • 43. 1. Come to life Thursday, March 18, 2010
  • 44. 1. Come to life 2. Talk to us Thursday, March 18, 2010
  • 45. 1. Come to life 2. Talk to us 3. Move around Thursday, March 18, 2010
  • 46. public class Creature { public function Creature() { trace(“Ecce Creature”); } public function zap() {} public function talk() {} Thursday, March 18, 2010
  • 47. { trace(“Ecce Creature”); } public function zap() {} public function talk() {} public function walk() {} } Thursday, March 18, 2010
  • 48. Thursday, March 18, 2010
  • 49. Thursday, March 18, 2010
  • 50. Thursday, March 18, 2010
  • 51. ... public function implant( b : Brain ) { mybrain = b; } ... Thursday, March 18, 2010
  • 52. Thursday, March 18, 2010
  • 53. public function zap() { // IF DEAD, BECOME ALIVE // IF ALIVE, BECOME DEAD } public function walk() { } public function talk() { } Thursday, March 18, 2010
  • 54. public function zap() { // IF DEAD, BECOME ALIVE // IF ALIVE, BECOME DEAD } public function talk() { // IF DEAD, DO NOTHING // IF ALIVE, DESCRIBE CANCER CURE } public function walk() { } Thursday, March 18, 2010
  • 55. // IF DEAD, BECOME ALIVE // IF ALIVE, BECOME DEAD } public function talk() { // IF DEAD, DO NOTHING // IF ALIVE, DESCRIBE CANCER CURE } public function walk() { // IF DEAD, DO NOTHING // IF ALIVE, WALK TO LAB } Thursday, March 18, 2010
  • 56. x_x Thursday, March 18, 2010
  • 57. o_o Thursday, March 18, 2010
  • 58. 0.0 Thursday, March 18, 2010
  • 59. x_x Thursday, March 18, 2010
  • 60. ? Thursday, March 18, 2010
  • 61. Thursday, March 18, 2010
  • 62. public class Creature { private var amIdead : Boolean; public function Creature() { trace(“Ecce Creature”); amIdead = true; } public function zap() { Thursday, March 18, 2010
  • 63. } public function zap() { if( amIdead ) { amIdead = false; } else { amIdead = false; } } public function talk() { Thursday, March 18, 2010
  • 64. amIdead = false; } } public function talk() { if( amIdead ) { // DO NOTHING -- I’M DEAD } else { trace(“Listen to this...”); trace(“the secrets of eternity”); } } Thursday, March 18, 2010
  • 65. } public function walk() { if( amIdead ) { // DO NOTHING -- I’M DEAD } else { trace(“I’ll go to my lab”); trace(“and cure cancer”); } } } Thursday, March 18, 2010
  • 66. [clip: Igor drops Hans Delbruck’s brain] Thursday, March 18, 2010
  • 67. Thursday, March 18, 2010
  • 68. public class Creature { private var amIdead : Boolean; private var doIHaveDelbruckBrain : Boolean; public function Creature() { trace(“Ecce Creature”); amIdead = true; } public function implant( b : Brain ) { Thursday, March 18, 2010
  • 69. } public function implant( b : Brain ) { mybrain = b; if( mybrain == DELBRUCK_BRAIN ) // how?? { doIHaveDelbruckBrain = true; } else { doIHaveDelbruckBrain = false; } } Thursday, March 18, 2010
  • 70. } public function zap() { if( amIdead ) { amIdead = false; } else { amIdead = false; } } public function talk() { Thursday, March 18, 2010
  • 71. } public function talk() { if( amIdead ) { // DO NOTHING -- I’M DEAD } else { if( doIHaveDelbruckBrain ) { trace(“Listen to this...”); trace(“the secrets of eternity”); Thursday, March 18, 2010 }
  • 72. else { if( doIHaveDelbruckBrain ) { trace(“Listen to this...”); trace(“the secrets of eternity”); } else { trace(“UNNNNNNNH”); } } Thursday, March 18, 2010