State Machine Presentation1 61

428 views

Published on

Published in: Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
428
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

State Machine Presentation1 61

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

×