Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2016
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. FSM.Automata.RegisterFSM({
  2.  
  3.         name: 'chainedwords',
  4.         initial_state: 'create',
  5.         state: ['create', 'play', 'check', 'grab', 'end', 'tileConvert', 'tilesChange', 'waitOpponent', 'invite'],
  6.         transition: [
  7.             {
  8.                 event: 'start',
  9.                 from: 'create',
  10.                 to: 'play'
  11.             },
  12.             {
  13.                 event: 'change_tiles',
  14.                 from: 'play',
  15.                 to: 'tilesChange'
  16.             },
  17.             {
  18.                 event: 'wait_player',
  19.                 from: 'play',
  20.                 to: 'waitOpponent'
  21.             },
  22.             {
  23.                 event: 'player_joined',
  24.                 from: 'waitOpponent',
  25.                 to: 'play'
  26.             },
  27.             {
  28.                 event: 'tiles_changed',
  29.                 from: 'tilesChange',
  30.                 to: 'play'
  31.             },
  32.             {
  33.                 event: 'game_ends',
  34.                 from: 'tilesChange',
  35.                 to: 'end'
  36.             },
  37.             {
  38.                 event: 'convert_tile',
  39.                 from: 'play',
  40.                 to: 'tileConvert'
  41.             },
  42.             {
  43.                 event: 'tile_converted',
  44.                 from: 'tileConvert',
  45.                 to: 'play'
  46.             },
  47.             {
  48.                 event: 'play_tiles',
  49.                 from: 'play',
  50.                 to: 'check'
  51.             },
  52.             {
  53.                 event: 'pass',
  54.                 from: 'check',
  55.                 to: 'play'
  56.             },
  57.             {
  58.                 event: 'check_ok',
  59.                 from: 'check',
  60.                 to: 'grab'
  61.             },
  62.             {
  63.                 event: 'check_error',
  64.                 from: 'check',
  65.                 to: 'play'
  66.             },
  67.             {
  68.                 event: 'game_ends',
  69.                 from: 'check',
  70.                 to: 'end'
  71.             },
  72.             {
  73.                 event: 'get_tiles',
  74.                 from: 'grab',
  75.                 to: 'play'
  76.             },
  77.             {
  78.                 event: 'game_ends',
  79.                 from: 'grab',
  80.                 to: 'end'
  81.             },
  82.             {
  83.                 event: 'resign',
  84.                 from: 'play',
  85.                 to: 'end'
  86.             },
  87.             {
  88.                 event: 'resign',
  89.                 from: 'waitOpponent',
  90.                 to: 'end'
  91.             },
  92.             {
  93.                 event: 'wait_accept_invitation',
  94.                 from : 'play',
  95.                 to : 'invite'
  96.             },
  97.             {
  98.                 event : 'invitation_accepted',
  99.                 from : 'invite',
  100.                 to : 'play'
  101.             },
  102.             {
  103.                 event : 'invitation_rejected',
  104.                 from : 'invite',
  105.                 to : 'end'
  106.             },
  107.             {
  108.                 event : 'resign',
  109.                 from : 'invite',
  110.                 to : 'end'
  111.             },
  112.             {
  113.                 event : 'invitation_rejected',
  114.                 from : 'play',
  115.                 to : 'end'
  116.             },
  117.             {
  118.                 event : 'invitation_accepted',
  119.                 from : 'play',
  120.                 to : 'play'
  121.             },
  122.             {
  123.                 event : 'expire',
  124.                 from : 'play',
  125.                 to : 'end'
  126.             }
  127.         ]
  128.  
  129.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement