home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Puzzle / Clusterz / Clusterz.swf / scripts / RES / OBJECTS / OField.as < prev    next >
Encoding:
Text File  |  2008-09-12  |  69.0 KB  |  1,442 lines

  1. package RES.OBJECTS
  2. {
  3.    import ENGINE.CORE.OGlobal;
  4.    import ENGINE.CORE.ORandomInt;
  5.    import ENGINE.CORE.OSound;
  6.    import ENGINE.CORE.OSystem;
  7.    import ENGINE.CORE.OUtils;
  8.    import ENGINE.DISPLAY.OSprite;
  9.    import ENGINE.INTERFACE.OCounter;
  10.    import ENGINE.SMARTFOX.OMultiplayer;
  11.    import flash.display.*;
  12.    import flash.events.*;
  13.    import flash.geom.*;
  14.    import flash.utils.getTimer;
  15.    
  16.    public class OField extends OSprite
  17.    {
  18.       
  19.       public static const stGameOverShow:int = 10;
  20.       
  21.       private static const iInd:Array = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,0],[0,1],[1,-1],[1,0],[1,1]];
  22.       
  23.       public static const stShowFBub:int = 2;
  24.       
  25.       public static const stInvisible:int = 0;
  26.       
  27.       public static const stAddNewBub:int = 6;
  28.       
  29.       public static const iFCols:int = 16;
  30.       
  31.       public static const stShuffle:int = 7;
  32.       
  33.       private static var iLevels:Array = [[[3,6,25],[0,1,2],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,2,2,0,0,0,0,0,0,0,0,2,2,0,0],[0,0,3,0,3,0,0,0,3,0,0,0,3,0,3,0],[0,0,1,1,0,0,0,3,3,0,0,0,1,1,0,0],[0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0],[0,0,0,8,0,0,3,0,2,0,3,0,0,8,0,0],[0,0,0,0,0,3,0,2,2,0,3,0,0,0,0,0],[0,0,0,0,0,0,3,0,2,0,3,0,0,0,0,0],[0,0,1,1,0,0,1,0,0,1,0,0,1,1,0,0],[0,0,3,0,3,0,0,1,0,1,0,0,3,0,3,0],[0,0,2,2,0,0,0,3,3,0,0,0,2,2,0,0],[0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0]],[[3,0,15],[3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0],[0,0,0,0,0,0,2,2,0,2,2,0,0,0,0,0],[0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,8,2,3,1,1,3,2,8,0,0,0,0],[0,0,0,0,0,2,0,0,2,0,0,2,0,0,0,0],[0,0,0,0,0,3,0,3,3,0,3,0,0,0,0,0],[0,0,0,2,0,0,1,2,3,2,1,0,0,2,0,0],[0,0,0,2,3,0,1,0,0,1,0,3,2,0,0,0],[0,0,0,1,0,3,0,3,0,3,0,3,0,1,0,0],[0,0,0,1,2,0,0,2,2,0,0,2,1,0,0,0],[0,0,0,0,0,2,0,0,8,0,0,2,0,0,0,0]],[[3,0,15],[0,2,4],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,3,2,1,0,0,0,0,0,1,2,3,0,0],[0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0],[0,0,0,0,8,0,3,2,1,2,3,0,8,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,3,2,1,0,0,0,0,0,1,2,3,0,0],[0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0],[0,0,0,0,0,0,3,2,1,2,3,0,0,0,0,0],[0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0],[0,0,0,3,2,1,0,0,0,0,0,1,2,3,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,8,0,3,2,1,2,3,0,8,0,0,0],[0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0],[0,0,0,3,2,1,0,0,0,0,0,1,2,3,0,0]],[[3,0,15],[0,1,2],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0],[0,0,0,3,1,3,0,3,8,3,0,3,1,3,0,0],[0,0,2,0,0,2,0,1,1,0,2,0,0,2,0,0],[0,0,1,0,0,0,1,3,2,3,1,0,0,0,1,0],[0,3,0,8,0,0,0,1,3,0,0,0,8,0,3,0],[0,0,2,0,0,0,0,2,0,2,0,0,0,0,2,0],[0,0,1,0,0,0,0,1,3,0,0,0,0,1,0,0],[0,0,0,2,1,3,1,3,2,3,1,3,1,2,0,0],[0,0,3,0,0,0,0,1,3,0,0,0,0,3,0,0],[0,0,2,0,0,8,0,1,2,1,0,8,0,0,2,0],[0,0,1,0,0,0,3,0,0,3,0,0,0,1,0,0],[0,0,0,2,1,3,2,0,0,0,2,3,1,2,0,0]],[[3,0,15],[3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[1,0,0,2,1,0,0,1,0,0,1,2,0,0,1,0],[2,0,3,0,3,0,3,3,0,3,0,3,0,2,0,0],[0,3,2,0,0,1,2,0,2,1,0,0,2,3,0,0],[0,0,0,2,8,0,0,0,0,8,2,0,0,0,0,0],[0,0,0,3,1,0,0,0,0,0,1,3,0,0,0,0],[0,0,1,2,0,0,0,0,0,0,2,1,0,0,0,0],[0,8,2,3,2,1,2,1,2,1,2,3,2,8,0,0],[3,2,1,0,0,0,3,3,0,0,0,1,2,3,0,0],[0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,0],[0,0,2,8,0,0,3,3,0,0,8,2,0,0,0,0],[0,0,3,1,2,3,1,2,1,3,2,1,3,0,0,0],[2,1,0,0,0,2,3,3,2,0,0,0,1,2,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],[[3,0,15],[1,3,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,2,0,2,0,0,3,0,0,0,3,0,0,2,0,2],[0,3,1,0,0,2,0,0,0,0,2,0,0,3,1,0],[0,0,8,0,0,3,2,0,0,0,2,3,0,0,8,0],[0,3,0,0,2,0,1,0,0,1,0,2,0,0,3,0],[0,0,1,0,1,0,0,3,0,3,0,0,1,0,1,0],[0,0,2,3,0,0,0,2,2,0,0,0,3,2,0,0],[0,0,1,8,1,0,0,3,0,3,0,0,1,8,1,0],[0,3,0,0,2,0,1,0,0,1,0,2,0,0,3,0],[0,1,0,0,0,3,2,0,0,0,2,3,0,0,0,1],[3,0,0,0,3,8,3,0,0,3,8,3,0,0,0,3],[0,1,0,0,2,0,0,2,0,2,0,0,2,0,0,1],[0,2,0,1,0,0,0,1,1,0,0,0,1,0,2,0],[0,0,1,2,0,0,0,0,8,0,0,0,0,2,1,0]],[[3,0,15],[0,1,2],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,3,1,0,0,0,1,0,0,0,1,3,0,0],[0,0,2,0,0,0,0,2,2,0,0,0,0,2,0,0],[0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],[0,2,0,0,0,0,2,3,3,2,0,0,0,0,2,0],[0,3,1,2,3,0,1,0,8,0,1,0,3,2,1,3],[1,2,3,1,2,3,0,0,0,0,3,2,1,3,2,1],[0,0,8,2,8,0,1,0,2,0,1,0,8,2,8,0],[0,0,1,3,1,3,2,1,3,2,3,1,3,1,0,0],[0,0,3,0,0,0,0,0,2,0,0,0,0,0,3,0],[0,0,2,0,0,0,0,3,1,0,0,0,0,2,0,0],[0,0,0,3,0,0,3,1,2,3,0,0,0,3,0,0],[0,0,0,1,2,0,8,3,1,8,0,2,1,0,0,0],[0,0,0,0,2,3,2,1,8,1,2,3,2,0,0,0]],[[3,0,15],[3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,2,1,0,0,2,0,0,0,0,0,2,0,0,1,2],[1,3,1,0,0,1,0,0,0,0,1,0,0,1,3,1],[0,2,2,0,0,0,3,0,0,0,3,0,0,0,2,2],[0,3,0,0,0,2,3,0,0,3,2,0,0,0,3,0],[0,8,8,0,1,3,1,3,8,3,1,3,1,0,8,8],[0,3,0,3,0,0,3,0,0,3,0,0,3,0,3,0],[0,0,1,0,0,0,0,2,0,2,0,0,0,0,1,0],[0,0,1,0,0,0,0,3,1,0,0,0,0,1,0,0],[0,0,0,8,2,3,3,2,0,2,3,3,2,8,0,0],[0,0,1,2,0,0,0,2,2,0,0,0,2,1,0,0],[0,3,3,0,2,0,0,3,0,3,0,0,2,0,3,3],[0,1,2,0,2,8,1,0,0,1,8,2,0,2,1,0],[0,0,0,0,0,1,1,3,3,3,1,1,0,0,0,0]],[[4,0,15],[1,2,3,4],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,4,4,0,0,0,0,0,0,0,0,0,4,4,0],[0,3,0,4,0,0,2,0,0,2,0,0,4,0,3,0],[0,3,0,0,4,3,2,0,0,0,2,3,4,0,0,3],[2,0,0,0,8,8,0,0,0,0,8,8,0,0,0,2],[0,0,0,0,9,1,0,0,0,0,0,1,9,0,0,0],[0,0,0,9,0,1,0,0,0,0,1,0,9,0,0,0],[0,1,1,9,0,0,2,0,0,0,2,0,0,9,0,0],[0,0,9,0,0,4,3,2,2,3,4,0,0,9,0,0],[0,8,8,1,1,4,0,2,1,2,0,4,1,1,8,8],[0,0,0,0,4,0,0,3,3,0,0,4,0,0,0,0],[0,0,0,0,1,0,0,0,8,0,0,0,1,0,0,0],[0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0],[0,2,3,3,0,0,0,0,0,0,0,0,0,3,3,2]],[[4,0,15],[0,1,2,3],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[1,2,3,4,1,0,0,0,0,0,0,1,4,3,2,1],[8,8,8,2,0,0,0,0,0,0,0,2,8,8,8,8],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,1,0,1,0,0,8,0,0,1,0,1,0,0],[0,0,0,2,1,0,0,0,0,0,0,1,2,0,0,0],[0,0,0,0,3,0,0,1,3,1,0,0,3,0,0,0],[0,0,4,4,8,0,0,2,2,0,0,8,4,4,0,0],[0,1,1,3,1,0,0,0,0,0,0,0,3,1,1,1],[0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,0,2,2,3,3,4,8,4,3,3,2,2,0,0],[0,0,0,3,0,0,0,0,0,0,0,0,3,0,0,0],[0,0,0,4,0,0,0,0,0,0,0,0,0,4,0,0]],[[4,0,15],[2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,2,1,0,0,0,0,3,4,3,0,0,0,0,1,2],[0,0,2,3,0,1,2,0,0,2,1,0,3,2,0,0],[0,0,1,0,0,8,0,4,0,4,0,8,0,0,1,0],[0,2,0,0,8,0,0,3,3,0,0,8,0,0,2,0],[0,0,3,0,0,0,0,0,0,0,0,0,0,0,3,0],[0,0,8,1,1,2,0,8,8,0,2,1,1,8,0,0],[0,0,2,2,0,0,2,8,4,8,2,0,0,2,2,0],[0,3,0,0,0,2,3,3,3,3,2,0,0,0,3,0],[0,0,4,0,0,3,0,0,0,0,0,3,0,0,4,0],[0,0,3,0,2,1,0,0,0,0,1,2,0,3,0,0],[0,0,0,4,3,2,2,3,0,3,2,2,3,4,0,0],[0,0,0,8,4,4,0,0,0,0,4,4,8,0,0,0],[0,3,3,1,1,0,0,0,0,0,0,0,1,1,3,3]],[[4,0,15],[1,2,3,4],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,4,3,2,1,1,4,3,2,3,4,1,1,2,3,4],[0,3,0,2,4,0,0,0,0,0,0,4,2,0,3,0],[0,4,0,3,3,0,0,8,4,8,0,0,3,3,0,4],[2,2,0,2,0,0,8,2,2,8,0,0,2,0,2,2],[0,0,0,1,3,0,8,3,1,3,8,0,3,1,0,0],[0,0,2,0,1,8,0,0,0,0,8,1,0,2,0,0],[0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,3],[0,4,0,0,0,4,0,0,0,0,4,0,0,0,4,0],[0,1,0,0,2,0,1,0,8,0,1,0,2,0,0,1],[0,2,0,4,0,2,3,0,0,3,2,0,4,0,2,0],[0,0,1,3,3,4,3,0,0,0,3,4,3,3,1,0],[3,2,8,3,0,1,2,0,0,2,1,0,3,8,2,3],[0,2,8,0,0,0,1,2,4,2,1,0,0,0,8,2]],[[4,0,15],[0,1,2,3],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,0,0,4,3,4,3,4,0,0,0,0,0],[0,0,0,0,0,0,2,1,2,1,0,0,0,0,0,0],[0,0,2,0,0,0,0,8,8,8,0,0,0,0,2,0],[0,0,3,0,0,0,0,4,1,0,0,0,0,3,0,0],[0,0,0,4,1,2,3,3,1,2,3,2,1,4,0,0],[0,0,3,0,0,0,0,4,3,0,0,0,0,3,0,0],[0,0,2,0,8,8,0,0,0,0,0,8,8,0,2,0],[0,0,1,0,0,1,2,4,4,2,1,0,0,1,0,0],[0,0,0,2,0,2,0,0,1,0,0,2,0,2,0,0],[0,8,8,0,4,0,0,2,2,0,0,4,0,8,8,0],[0,0,3,0,0,3,0,8,1,8,0,3,0,0,3,0],[0,0,2,0,0,2,1,0,0,1,2,0,0,2,0,0],[0,1,2,1,2,3,0,0,8,0,0,3,2,1,2,1],[0,0,0,2,2,0,0,0,0,0,0,2,2,0,0,0]],[[4,0,15],[2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[1,2,3,4,0,0,0,2,1,2,0,0,1,2,3,4],[8,8,0,0,0,0,0,8,8,0,0,0,0,8,8,8],[0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0],[0,2,3,4,2,1,0,0,0,0,1,2,4,3,2,0],[0,8,4,0,0,0,4,0,0,0,4,0,0,0,4,8],[1,2,3,4,0,0,3,0,0,3,0,0,4,3,2,1],[0,3,0,8,0,0,0,2,8,2,0,0,0,8,0,3],[4,0,0,0,0,0,1,0,0,1,0,0,0,0,0,4],[0,3,0,0,4,8,0,1,0,1,0,8,4,0,0,3],[0,2,0,3,2,0,2,0,0,2,0,2,3,0,2,0],[0,4,1,2,0,3,1,0,0,0,1,3,0,2,1,4],[0,1,0,0,0,0,4,0,0,4,0,0,0,0,1,0],[0,0,3,0,0,0,2,4,8,4,2,0,0,0,3,0],[0,1,1,3,3,2,0,0,0,0,2,3,3,1,1,0]],[[4,0,15],[1,2,3,4],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,3,0,0,4,3,3,3,4,0,0,3,0,0],[0,0,0,3,0,0,2,1,1,2,0,0,3,0,0,0],[0,0,0,0,2,2,8,8,8,8,8,2,2,0,0,0],[0,0,0,3,0,0,1,0,0,1,0,0,3,0,0,0],[0,0,0,3,0,0,2,0,0,0,2,0,0,3,0,0],[8,8,8,0,0,1,0,0,0,0,1,0,0,8,8,8],[0,0,0,4,0,0,2,0,0,0,2,0,0,4,0,0],[0,0,0,2,0,0,1,0,0,1,0,0,2,0,0,0],[0,0,0,0,4,8,8,1,1,1,8,8,4,0,0,0],[0,0,0,2,0,0,3,0,0,3,0,2,0,0,0,0],[0,0,0,4,0,0,0,1,0,1,0,0,4,0,0,0],[0,0,2,0,0,0,0,3,3,0,0,0,2,0,0,0],[0,0,4,0,0,0,0,0,8,0,0,0,0,4,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],[[4,0,15],[0,1,2,3],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,4,0,0,0,4,3,1,3,4,0,0,0,4,0],[0,0,3,0,0,0,0,2,2,0,0,0,0,3,0,0],[0,0,0,2,1,0,0,3,4,3,0,0,1,2,0,0],[0,0,0,8,2,0,0,1,1,0,0,2,8,0,0,0],[0,0,0,0,0,1,0,8,8,8,0,1,0,0,0,0],[8,8,0,0,1,1,0,2,2,0,1,1,0,0,8,8],[0,0,8,2,2,0,4,0,3,0,4,0,2,2,8,0],[0,0,8,0,0,0,4,0,0,4,0,0,0,8,0,0],[0,1,0,0,0,0,0,3,3,3,0,0,0,0,0,1],[0,4,0,0,0,0,4,0,0,4,0,0,0,0,4,0],[0,0,1,1,3,4,3,0,0,0,3,4,3,1,1,0],[0,0,3,0,3,1,1,0,0,1,1,3,0,3,0,0],[0,0,0,2,4,4,0,8,0,8,0,4,4,2,0,0],[3,3,2,0,0,0,0,8,8,0,0,0,0,2,3,3]],[[4,0,15],[2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[1,1,1,0,0,0,4,2,3,1,4,0,0,4,4,4],[3,2,2,0,0,0,1,2,3,1,0,0,0,3,2,2],[0,3,0,0,0,0,0,4,3,4,0,0,0,0,1,0],[3,0,0,0,0,0,0,2,2,0,0,0,0,0,1,0],[4,1,0,0,0,8,8,0,1,8,8,0,0,0,1,4],[8,8,0,1,0,0,0,2,2,0,0,0,1,0,8,8],[0,3,0,2,0,0,3,4,3,4,3,0,0,2,0,3],[0,2,0,1,4,1,0,2,2,0,1,4,1,0,2,0],[0,0,8,0,2,8,0,0,0,0,0,8,2,0,8,0],[0,1,0,1,0,1,2,4,4,2,1,0,1,0,1,0],[0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1],[0,2,0,2,3,4,4,0,0,4,4,3,2,0,2,0],[0,0,3,3,1,1,0,0,0,0,0,1,1,3,3,0],[8,8,8,0,0,0,0,0,0,0,0,0,0,8,8,8]],[[4,0,15],[0,1,2,3,4],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,0,8,3,4,3,4,3,8,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,2,0,8,1,4,1,8,0,2,0,0,0],[0,0,0,2,0,4,0,0,0,0,4,0,2,0,0,0],[0,0,0,4,0,3,0,8,1,8,0,3,0,2,0,0],[0,0,4,0,5,0,4,2,3,1,0,1,0,2,0,0],[0,0,8,0,8,0,8,3,1,4,8,0,8,0,8,0],[0,0,3,0,2,0,3,4,3,2,0,2,0,1,0,0],[0,0,0,3,0,4,0,8,1,8,0,4,0,1,0,0],[0,0,0,2,0,2,0,0,0,0,2,0,2,0,0,0],[0,0,0,0,2,0,8,3,3,3,8,0,2,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,8,1,1,8,2,2,8,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],[[5,0,15],[1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,2,1,2,3,1,0,1,3,2,1,3,0,0],[0,0,4,0,8,5,8,0,0,8,5,8,0,4,0,0],[0,0,2,0,0,8,8,4,5,4,8,8,0,0,3,0],[0,4,0,0,0,1,0,0,0,0,3,0,0,0,4,0],[0,1,0,0,0,5,2,0,0,0,2,3,0,0,0,1],[0,2,0,0,4,0,3,0,0,3,0,1,0,0,2,0],[0,0,5,0,3,0,0,4,0,4,0,0,4,0,3,0],[0,0,5,2,0,0,0,5,5,0,0,0,5,3,0,0],[0,0,8,1,8,1,2,3,4,3,2,1,8,5,8,0],[0,0,8,8,0,0,0,5,2,0,0,0,8,8,0,0],[0,0,0,0,1,0,0,0,1,0,0,0,4,0,0,0],[0,0,0,0,1,0,0,4,3,0,0,4,0,0,0,0],[0,0,0,0,0,2,2,8,1,8,3,3,0,0,0,0],[0,0,0,0,0,0,2,8,8,3,0,0,0,0,0,0]],[[5,0,15],[0,1,2,3,4],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,2,1,1,4,0,5,1,0,2,1,1,4,0,0],[0,9,9,9,9,9,1,2,3,9,9,9,9,9,0,0],[0,3,1,1,0,0,8,3,5,8,0,0,1,1,3,0],[0,3,0,0,0,0,8,8,8,0,0,0,0,3,0,0],[0,0,4,1,0,0,1,0,0,1,0,0,1,4,0,0],[0,0,4,0,0,5,0,0,0,5,0,0,4,0,0,0],[0,0,8,0,0,8,0,0,0,0,8,0,0,8,0,0],[0,0,8,0,5,8,0,0,0,8,5,0,8,0,0,0],[0,0,5,1,0,5,3,3,3,3,5,0,1,1,0,0],[0,5,0,1,2,0,0,4,0,0,2,1,0,1,0,0],[2,3,0,1,8,1,5,4,4,5,1,8,1,0,5,2],[2,3,1,0,8,2,3,0,2,3,8,0,1,5,2,0],[0,0,2,0,0,8,5,1,1,4,8,0,0,4,0,0],[0,0,2,3,2,8,5,1,4,8,2,3,4,0,0,0]],[[5,0,15],[1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[9,0,0,9,0,4,5,1,2,3,4,0,9,0,0,9],[9,0,9,2,3,8,8,8,8,8,3,2,9,0,9,0],[0,9,9,1,0,1,2,3,4,5,1,0,1,9,9,0],[0,9,2,0,0,8,8,8,8,8,0,0,2,9,0,0],[0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,0,2,8,4,4,0,0,1,1,8,2,0,0,0],[0,0,1,0,0,0,5,0,0,0,5,0,0,0,0,0],[0,0,0,0,0,3,5,0,0,5,4,0,0,0,0,0],[0,8,0,0,0,0,3,0,8,0,4,0,0,0,8,0],[1,1,2,2,3,3,4,4,5,5,1,1,2,2,5,5],[0,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],[0,1,0,0,5,0,0,3,3,0,0,0,4,0,1,0],[0,0,2,0,0,5,0,0,5,0,0,0,4,0,1,0],[0,8,8,0,0,3,0,8,8,0,0,3,0,8,8,0]],[[5,0,15],[0,1,2,3,4],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,0,0,9,9,9,9,9,0,0,0,0,0],[9,9,0,0,0,9,0,0,0,0,9,0,0,0,9,9],[8,8,9,0,0,9,0,0,0,0,0,9,0,0,8,8],[0,0,9,0,9,0,0,0,0,0,0,9,0,9,0,0],[0,0,0,9,8,9,9,9,8,9,9,9,8,9,0,0],[0,0,0,8,8,8,9,9,9,9,8,8,8,0,0,0],[0,0,0,1,9,9,8,9,9,9,8,9,9,4,0,0],[0,0,2,0,0,9,8,9,9,8,9,0,0,3,0,0],[0,0,2,0,1,0,9,0,0,0,9,0,1,0,3,0],[0,1,3,0,0,9,8,5,5,8,9,0,0,2,1,0],[0,1,5,3,2,0,0,4,4,4,0,0,1,2,0,1],[0,5,4,4,8,0,3,3,3,3,0,8,1,1,2,2],[0,0,0,0,8,0,0,0,0,0,0,0,8,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],[[5,0,15],[1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,8,1,1,8,9,9,8,1,1,8,0,0,0],[0,0,8,2,2,8,9,9,9,8,2,2,8,0,0,0],[0,0,8,3,3,8,9,9,9,9,8,3,3,8,0,0],[0,0,8,4,4,8,9,9,9,8,4,4,8,0,0,0],[0,0,0,8,5,5,8,9,9,8,5,5,8,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,1,2,3,0,0,0,5,4,5,0,0,0,3,2,1],[1,0,0,3,2,1,0,0,0,0,1,2,3,0,0,1],[0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0],[0,4,3,0,0,0,0,3,3,0,0,0,0,3,4,0],[0,0,0,5,5,0,0,4,0,4,0,0,5,5,0,0],[0,0,3,8,0,0,8,0,0,8,0,0,8,3,0,0],[0,0,0,4,4,0,0,0,0,0,0,0,4,4,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],[[5,0,15],[0,1,2,3,4],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,9,0,0,0,9,9,9,9,9,0,0,0,9,0],[0,0,9,0,0,9,0,9,0,0,9,0,0,9,0,0],[0,0,0,9,9,9,0,3,1,5,0,9,9,9,0,0],[0,0,9,0,0,9,8,2,4,8,9,0,0,9,0,0],[0,9,9,0,0,0,9,8,8,8,9,0,0,0,9,9],[0,0,1,4,5,0,0,0,0,0,0,5,4,1,0,0],[0,8,2,3,8,4,0,0,0,0,3,8,2,3,8,0],[0,8,8,8,2,3,3,4,3,3,2,8,8,8,0,0],[0,2,2,4,5,5,0,3,3,0,0,2,4,5,1,0],[2,8,3,1,8,5,2,3,2,2,8,3,1,8,1,0],[2,2,8,8,8,0,0,0,0,0,0,8,8,8,5,5],[0,1,1,0,0,0,4,5,5,4,0,0,0,1,1,5],[0,0,0,2,0,0,4,0,0,0,4,0,0,2,0,0],[0,0,0,2,3,3,0,0,0,0,3,3,2,0,0,0]],[[5,0,15],[1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[9,9,9,9,0,0,0,9,9,9,0,0,0,9,9,9],[9,9,8,0,0,0,8,9,9,8,0,0,0,8,9,9],[4,4,3,3,0,0,0,2,2,2,0,0,1,1,5,5],[0,0,8,0,2,2,8,0,0,8,1,1,0,8,0,0],[0,0,0,4,4,3,3,0,0,0,3,3,4,4,0,0],[0,0,8,0,5,5,8,0,0,8,1,1,0,8,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[2,2,8,0,0,0,8,5,4,8,0,0,0,8,1,1],[3,3,5,5,0,0,0,5,5,4,0,0,0,4,3,3],[1,1,8,0,0,0,8,3,3,8,0,0,0,8,2,2],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,8,0,0,0,8,0,0,8,0,0,8,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,8,0,0,0,0,0,0,0,8,0,0,0,0]],[[5,0,15],[0,1,2,3,4],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,4,5,0,0,0,0,0,0,0,0,0,0,1,2,0],[1,2,3,0,0,0,0,0,0,0,0,0,5,4,3,0],[8,8,8,9,0,0,8,9,9,8,0,0,9,8,8,8],[5,0,0,9,9,8,9,9,9,8,9,9,0,0,3,0],[5,4,0,9,0,8,9,9,9,9,8,0,9,0,0,3],[0,4,8,9,9,0,0,0,0,0,9,9,8,0,4,0],[0,4,8,0,0,0,0,0,0,0,0,0,0,8,4,0],[1,1,8,0,0,0,0,0,0,0,0,0,8,3,3,0],[2,0,0,5,1,1,4,4,5,5,3,3,4,0,0,5],[2,3,3,5,8,8,1,3,2,8,8,4,1,1,5,0],[0,0,0,0,0,8,1,3,3,2,8,0,0,0,0,0],[0,0,0,0,0,2,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,8,8,8,0,0,0,0,0,0,0]],[[5,0,15],[1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,9,9,9,0,0,0,1,2,3,0,0,0,9,9,9],[0,9,9,3,0,0,8,8,8,8,0,0,3,9,9,0],[0,0,8,8,3,2,1,0,0,0,4,5,3,8,8,0],[0,0,0,0,2,1,0,0,0,0,4,5,0,0,0,0],[0,4,0,0,8,8,0,0,0,0,0,8,8,0,0,0],[4,2,0,0,4,0,0,0,0,0,0,5,0,2,5,5],[1,1,2,0,0,4,0,0,0,0,0,5,0,2,3,3],[8,8,0,0,0,8,8,1,1,8,8,0,0,0,8,8],[0,3,0,0,0,3,0,2,0,4,0,1,0,0,0,5],[0,3,0,0,3,0,2,0,0,4,0,1,0,0,5,0],[0,0,4,0,8,8,5,0,0,0,5,8,8,0,3,0],[0,0,4,2,1,5,2,3,3,4,5,1,4,3,0,0],[0,0,0,2,1,0,0,2,3,4,0,0,1,4,0,0],[0,0,8,8,0,0,0,0,0,0,0,0,8,8,0,0]],[[5,0,15],[0,1,2,3,4],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[9,9,9,0,0,0,5,4,3,2,0,0,0,0,9,9],[9,9,0,8,0,0,8,8,8,0,0,8,0,9,9,9],[9,9,9,0,0,0,0,0,0,0,0,0,0,0,9,9],[1,1,0,1,0,2,0,3,0,4,0,5,0,4,4,4],[8,8,8,0,0,0,0,0,0,0,0,0,0,8,8,8],[2,4,5,0,0,0,0,0,0,0,0,0,0,2,1,3],[8,8,8,0,0,1,2,2,5,4,4,0,0,8,8,8],[4,5,1,0,0,0,0,0,0,0,0,0,0,5,2,1],[4,5,1,0,0,0,0,0,0,0,0,0,0,5,2,1],[8,8,8,0,0,0,0,0,0,0,0,0,0,8,8,8],[1,2,3,0,0,0,0,0,0,0,0,0,0,3,4,5],[8,8,8,0,0,3,3,0,0,5,5,0,0,8,8,8],[1,1,4,4,2,2,0,0,0,0,1,1,5,5,3,3],[1,0,4,0,2,0,0,0,0,0,1,0,5,0,3,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[9,9,0,9,9,9,0,0,0,0,0,0,9,9,9,0],[9,9,9,0,0,9,9,0,0,0,9,9,0,0,9,0],[9,9,9,0,0,0,0,0,0,0,0,0,0,0,0,9],[0,0,9,8,8,8,8,8,0,8,8,8,8,8,9,0],[0,0,0,0,1,2,3,4,5,5,4,3,2,1,0,0],[0,0,0,0,8,8,8,8,6,8,8,8,8,0,0,0],[0,0,0,0,0,3,4,5,6,6,5,4,3,0,0,0],[0,6,5,4,1,8,8,8,0,8,8,8,1,2,3,6],[0,0,6,5,4,1,2,3,4,4,3,2,1,2,3,6],[0,0,0,0,0,0,8,8,0,8,8,0,0,0,0,0],[0,0,0,0,2,2,1,1,2,3,4,4,3,3,0,0],[0,3,0,3,0,0,0,8,0,8,0,0,0,4,0,4],[0,0,6,6,0,0,0,0,0,0,0,0,0,0,5,5],[0,0,1,0,0,0,0,0,0,0,0,0,0,0,6,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,1,9,9,2,2,2,0,0,6,9,9,2,2,9,0],[1,0,0,0,0,0,3,0,6,0,8,8,0,0,9,0],[9,0,8,8,8,0,0,3,2,0,8,1,8,0,0,4],[9,0,3,3,8,0,0,2,0,8,1,2,8,0,0,4],[2,0,0,2,2,8,0,0,0,8,3,3,2,8,0,9],[2,0,1,1,5,0,0,0,5,4,4,1,1,5,0,6],[9,0,8,8,8,5,0,0,5,6,6,2,3,6,5,6],[3,0,0,2,2,8,0,0,5,2,1,5,2,6,5,1],[3,0,0,0,6,6,8,0,0,5,3,3,3,4,5,1],[2,0,1,3,5,5,8,0,0,8,5,5,4,8,0,6],[2,0,1,3,4,4,8,6,6,3,8,6,6,8,0,6],[5,0,8,8,8,8,2,0,0,3,8,8,8,0,5,0],[0,5,0,0,0,4,2,0,0,0,2,0,0,1,5,0],[0,1,1,3,3,4,0,0,0,0,2,4,4,1,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,5,5,0,4,4,0,3,3,0,2,2,0,1,1,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,1,2,3,4,5,6,0,1,2,3,4,5,6,0],[0,0,8,8,8,8,8,0,0,8,8,8,8,8,0,0],[0,0,4,8,1,2,3,4,5,6,1,2,3,8,2,0],[0,4,0,8,1,2,3,4,5,6,1,2,8,0,2,0],[0,3,0,0,8,1,2,3,4,5,6,1,8,0,0,3],[0,3,0,0,0,0,0,0,0,0,0,0,0,0,3,0],[0,2,0,0,0,0,0,0,0,0,0,0,0,0,4,0],[2,0,0,0,8,8,0,0,0,0,8,8,0,0,4,0],[0,5,0,0,8,1,2,3,0,4,5,6,8,0,0,5],[0,5,0,8,1,2,3,0,0,4,5,6,8,0,5,0],[1,1,0,8,8,8,8,0,4,2,8,8,8,8,6,6],[6,6,5,5,4,4,3,3,4,2,3,3,2,2,1,1]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,9,9,9,9,9,1,2,9,9,9,9,9,9,0],[0,9,0,0,0,0,0,0,0,0,0,0,0,0,9,0],[0,9,0,0,0,0,0,0,8,0,0,0,0,0,0,9],[9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9],[0,4,0,0,8,8,8,0,0,0,8,8,8,0,6,6],[0,4,0,8,1,1,2,5,6,4,3,3,8,0,6,0],[0,0,3,8,8,8,2,5,6,6,4,8,8,8,1,0],[0,0,3,0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0],[0,2,8,8,8,8,1,1,4,3,8,8,8,8,2,0],[0,1,0,8,1,3,3,2,4,5,3,4,4,8,0,5],[1,0,0,8,8,8,8,2,5,8,8,8,8,0,0,5],[1,2,2,3,3,4,4,6,5,1,4,2,3,3,6,6],[0,0,0,0,5,5,6,0,0,1,4,2,0,0,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[9,9,9,9,9,0,0,2,1,4,0,9,9,9,9,9],[0,0,8,9,0,8,0,2,4,0,8,0,9,8,0,0],[0,9,9,9,0,0,0,8,0,8,0,0,0,9,9,9],[9,8,0,4,8,2,6,0,0,2,4,8,1,0,8,9],[9,8,0,3,4,5,2,6,0,0,2,4,1,4,6,8],[0,0,8,3,0,5,8,0,0,8,6,6,4,8,6,0],[0,0,0,0,0,3,3,3,3,3,3,3,0,0,0,0],[0,8,9,9,8,2,0,0,0,0,3,8,9,9,8,0],[0,9,9,9,0,9,2,0,0,0,3,9,9,9,9,0],[0,8,9,8,0,9,8,0,0,8,9,0,8,9,8,0],[0,6,6,3,3,0,1,1,0,3,3,6,6,5,5,0],[0,8,4,4,8,1,2,2,4,4,3,8,1,1,8,0],[0,5,2,2,3,3,2,0,0,0,4,5,5,4,4,0],[0,5,8,1,1,8,0,0,0,0,8,6,6,8,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,9,9,9,9,0,0,0,0,9,9,9,9,0,0],[0,0,0,0,8,2,8,0,0,0,8,1,8,0,0,0],[0,0,0,0,0,8,8,0,0,0,0,8,8,0,0,0],[9,9,9,9,9,8,9,9,9,9,9,8,9,9,9,9],[0,0,0,0,0,6,0,0,0,0,0,0,4,0,0,0],[0,0,0,8,6,8,0,0,0,0,0,8,4,8,0,0],[0,0,0,0,8,8,5,0,0,0,0,5,8,8,0,0],[9,9,9,9,8,5,9,9,9,9,9,5,8,9,9,9],[0,0,0,0,1,2,0,0,0,0,0,0,4,3,0,0],[0,0,8,1,8,2,0,0,0,0,0,4,8,3,8,0],[0,0,3,8,8,0,0,0,0,0,0,0,0,8,8,6],[0,0,3,8,2,2,0,8,0,8,0,4,4,8,6,0],[0,0,0,0,0,0,1,1,8,8,5,5,0,0,0,0],[0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[9,0,9,0,0,0,0,0,0,0,0,0,0,9,0,9],[9,9,0,0,9,6,5,4,3,2,9,0,0,9,9,0],[0,9,0,0,9,8,8,8,8,8,8,9,0,0,9,0],[0,0,0,9,1,2,3,4,5,6,0,9,0,0,0,0],[0,0,0,9,0,8,8,8,8,8,8,0,9,0,0,0],[0,0,9,0,0,6,5,4,3,2,1,0,9,0,0,0],[0,0,9,0,0,8,8,8,8,8,8,0,0,9,0,9],[9,9,0,0,1,2,3,4,5,6,0,0,0,1,1,0],[0,5,0,0,9,8,8,8,8,8,8,1,0,0,2,0],[6,5,0,4,6,5,4,3,2,1,0,3,0,2,9,0],[0,0,3,4,0,8,8,8,8,8,8,0,3,4,0,0],[0,0,3,0,1,2,3,4,5,6,0,0,4,0,0,0],[0,0,1,2,0,8,8,8,8,8,8,0,6,5,0,0],[0,1,0,2,0,0,0,0,0,0,0,6,0,5,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,0,5,3,1,1,2,4,0,0,0,0,0],[9,8,0,9,8,5,3,1,2,4,8,9,0,8,9,0],[0,9,8,0,9,8,5,6,6,6,8,9,0,8,9,0],[0,9,8,0,9,8,0,0,0,8,9,0,8,9,0,0],[0,0,0,0,0,0,3,0,0,4,0,0,0,0,0,0],[5,6,4,0,0,0,3,0,4,0,2,3,1,0,0,0],[0,5,6,4,0,0,0,2,2,0,0,2,3,1,0,0],[0,8,8,8,0,0,0,8,0,0,0,8,8,8,0,0],[4,4,3,3,0,0,0,0,0,0,0,0,3,3,4,4],[8,8,8,3,0,0,0,0,0,0,0,0,2,8,8,8],[3,3,6,0,3,1,1,0,0,0,6,6,2,0,5,4],[2,6,8,0,0,8,0,0,0,8,0,0,8,5,4,0],[2,1,8,2,3,8,4,5,6,5,8,4,3,8,2,1],[1,8,2,3,8,4,5,6,5,5,8,4,3,8,2,1]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,9,9,9,9,9,9,9,9,9,9,0,0],[0,0,0,9,0,0,0,0,0,0,0,0,0,9,0,0],[0,0,0,9,0,0,8,8,8,8,8,8,0,0,9,0],[0,0,9,0,0,6,6,5,5,4,4,0,0,0,9,0],[0,0,9,0,0,0,8,8,8,8,8,8,0,0,0,9],[0,9,0,0,0,1,1,2,2,3,3,0,0,0,0,9],[0,0,9,0,0,8,8,8,8,8,8,8,8,0,0,9],[0,0,9,0,0,6,6,5,5,4,4,0,0,0,9,0],[0,0,0,9,9,9,8,8,8,8,8,8,9,9,9,0],[0,0,9,0,0,1,1,2,2,3,3,0,0,0,9,0],[0,0,9,0,0,0,0,8,8,8,8,0,0,0,0,9],[0,0,9,0,0,0,0,8,8,8,0,0,0,0,9,0],[0,0,0,9,9,9,0,0,8,8,0,0,9,9,9,0],[0,0,0,0,0,9,9,9,8,9,9,9,0,0,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,3,8,4,4,4,8,5,0,0,0,0,0],[0,0,0,0,1,8,5,0,0,2,8,6,0,0,0,0],[0,0,0,1,8,4,5,0,2,3,8,6,0,0,0,0],[0,0,0,2,8,3,4,8,8,3,4,8,5,0,0,0],[0,0,2,0,2,3,8,6,8,4,5,0,5,0,0,0],[0,0,3,8,1,2,8,6,1,8,5,6,8,4,0,0],[0,3,8,6,1,8,5,5,2,8,6,1,8,4,0,0],[0,0,8,5,6,8,4,5,2,3,8,1,2,8,0,0],[0,8,4,5,8,3,4,8,3,4,8,2,3,8,0,0],[0,0,0,4,8,2,3,8,8,4,5,8,3,0,0,0],[0,0,0,8,1,2,8,0,8,5,6,8,0,0,0,0],[0,0,0,0,0,1,8,0,0,8,6,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[2,2,3,8,8,0,0,9,9,0,0,8,8,4,3,3],[1,1,6,8,0,0,9,9,9,0,0,8,5,4,2,2],[4,4,5,8,8,0,0,9,9,0,0,8,8,1,1,6],[2,2,3,8,0,0,0,6,0,0,0,8,4,5,5,6],[5,5,3,8,8,0,0,5,6,0,0,8,8,4,2,2],[1,1,2,0,0,0,5,3,4,0,0,0,1,1,3,3],[3,3,2,8,8,0,0,3,4,0,0,8,8,6,6,5],[6,6,5,8,0,0,0,2,0,0,0,8,3,4,4,5],[4,4,5,8,8,0,0,1,2,0,0,8,8,3,2,2],[1,3,3,0,0,0,0,1,0,0,0,0,6,6,1,1],[1,2,2,8,8,0,0,0,0,0,0,8,8,4,5,5],[6,5,4,8,0,0,0,0,0,0,0,8,4,1,3,2],[6,5,4,8,8,0,0,0,0,0,0,8,8,1,3,2],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[8,2,2,1,1,0,0,0,0,0,0,5,5,4,4,8],[8,8,8,8,0,0,8,8,8,0,0,8,8,8,8,0],[0,0,0,0,2,0,0,8,8,0,0,4,0,0,0,5],[8,0,0,1,2,0,0,8,0,0,3,4,0,0,5,8],[1,0,0,8,1,8,9,9,9,9,8,3,8,0,0,3],[1,0,0,8,8,9,9,9,9,9,8,8,0,0,3,4],[2,2,0,0,0,0,6,6,8,8,2,2,4,0,0,4],[8,5,5,6,6,5,6,5,0,3,3,4,1,1,6,8],[3,3,0,0,4,8,8,5,6,8,8,1,0,0,0,6],[4,0,0,0,4,8,4,5,6,8,1,0,0,0,2,2],[4,0,0,0,3,0,4,3,3,2,5,0,0,0,0,1],[8,0,0,3,0,0,1,1,2,0,5,0,0,0,1,8],[0,0,0,2,0,0,0,8,8,0,0,6,0,0,0,0],[0,0,2,0,0,0,0,8,0,0,0,6,0,0,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[1,2,3,4,5,6,0,8,8,0,1,2,3,4,5,6],[1,2,3,4,5,6,8,8,8,1,2,3,4,5,6,0],[8,8,8,0,0,0,9,8,8,9,0,0,0,8,8,8],[0,0,8,0,4,4,0,8,0,3,3,0,8,0,0,0],[0,0,8,0,5,0,0,8,8,0,0,2,0,8,0,0],[0,8,0,0,5,0,0,0,0,0,2,0,0,8,0,0],[0,8,0,0,0,6,0,8,8,0,1,0,0,0,8,0],[8,0,0,0,0,6,0,0,0,1,0,0,0,0,8,0],[8,0,0,0,0,0,8,8,8,8,0,0,0,0,0,8],[4,3,1,0,0,8,1,1,1,8,0,0,0,4,3,2],[4,3,1,0,0,8,2,2,3,3,8,0,0,4,3,2],[0,0,0,0,8,4,4,6,5,5,8,0,0,0,0,0],[0,0,0,0,8,1,1,6,6,2,2,8,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,6,8,0,8,0,0,0,2,2,8,0,8,5,0],[0,6,3,8,5,8,0,0,0,1,8,6,8,4,5,0],[0,0,0,3,8,5,8,0,8,1,8,6,8,4,0,0],[0,0,8,1,1,4,0,0,0,0,3,2,2,8,0,0],[0,0,0,8,5,8,4,8,0,8,3,8,6,8,0,0],[0,0,4,4,5,3,0,0,0,0,0,1,6,2,0,0],[0,0,0,2,8,3,8,0,0,0,8,1,8,2,0,0],[0,1,2,8,5,8,0,0,0,0,8,4,8,3,0,0],[0,0,1,3,5,0,0,6,0,4,0,0,4,3,0,0],[0,0,3,8,8,8,6,0,0,4,8,8,8,0,0,0],[0,0,0,6,6,5,5,0,0,0,1,1,2,2,0,0],[0,0,8,1,8,2,8,0,0,8,4,8,3,8,0,0],[0,0,5,5,1,2,0,0,0,0,4,6,6,3,0,0],[0,0,0,0,0,8,0,0,0,0,8,0,0,0,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,8,0,8,1,1,2,2,8,0,8,0,0,0],[0,0,2,8,0,8,4,0,3,8,0,8,0,0,0,0],[8,0,1,2,8,0,8,4,3,8,0,8,0,6,5,8],[8,1,0,3,3,5,5,6,6,0,0,0,6,5,8,0],[0,8,0,0,8,0,8,0,0,8,0,8,4,4,8,0],[1,8,8,0,0,0,0,0,0,0,0,0,8,8,6,0],[0,1,2,0,0,4,5,5,2,2,3,0,0,5,6,0],[0,0,2,8,4,8,1,6,6,8,3,8,5,0,0,0],[8,0,0,3,3,0,1,0,0,0,0,4,4,0,0,8],[8,1,2,3,4,8,5,6,2,8,1,6,5,4,8,0],[0,8,1,2,3,4,5,6,3,2,1,6,5,4,8,0],[0,8,8,0,0,0,8,3,8,0,0,0,8,8,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,8,1,1,2,2,3,3,4,4,5,5,6,6,8,0],[2,2,0,8,0,8,0,0,0,8,0,8,5,5,3,0],[8,6,8,0,0,0,0,0,0,0,0,0,0,8,3,8],[6,4,8,0,0,0,0,0,0,0,0,0,8,1,1,0],[0,8,4,0,8,0,8,0,0,8,0,8,0,0,8,0],[0,0,8,0,0,6,6,0,0,0,4,0,8,0,0,0],[0,8,0,0,8,1,0,2,0,0,4,8,0,0,8,0],[0,0,0,8,1,0,0,2,3,3,5,8,0,0,0,0],[8,0,8,0,2,3,3,0,0,4,4,5,0,8,0,8],[4,4,5,2,1,0,0,0,0,0,6,6,0,2,1,1],[8,6,8,5,1,8,0,0,0,0,8,0,5,8,2,8],[6,8,0,0,0,0,0,0,0,0,0,0,5,8,3,3],[8,1,2,3,3,0,0,0,0,0,0,6,6,5,4,8],[8,1,2,8,0,0,0,8,0,0,0,8,5,4,8,0]],[[6,0,15],[0,1,2,3,4,5],[629157,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,0,1,2,3,4,5,6,0,0,0,0,0],[0,0,0,0,0,5,8,8,8,2,0,0,0,0,0,0],[0,0,0,0,0,0,5,6,1,2,0,0,0,0,0,0],[0,0,0,0,4,8,8,8,8,8,3,0,0,0,0,0],[0,0,0,0,0,4,5,6,1,2,3,0,0,0,0,0],[0,0,0,3,8,8,8,8,8,8,8,4,0,0,0,0],[0,0,0,0,3,4,5,6,1,2,3,4,0,0,0,0],[0,0,2,8,8,8,8,8,8,8,8,8,5,0,0,0],[0,0,0,2,3,4,5,6,1,2,3,4,5,0,0,0],[0,0,1,8,8,8,8,8,8,8,8,8,4,0,0,0],[0,0,0,1,2,3,4,5,6,1,2,3,4,0,0,0],[0,0,0,8,8,8,8,8,8,8,8,8,0,0,0,0],[0,0,0,0,2,2,3,3,6,6,5,5,0,0,0,0],[0,0,0,0,0,8,8,0,8,8,0,0,0,0,0,0]]];
  34.       
  35.       public static const stMoveFBub:int = 4;
  36.       
  37.       public static const stShowField:int = 1;
  38.       
  39.       public static const stGameOver:int = 11;
  40.       
  41.       public static const stNormal:int = 3;
  42.       
  43.       public static const stLevelCompShow:int = 8;
  44.       
  45.       public static const stCalcRemove:int = 5;
  46.       
  47.       public static const stLevelComplete:int = 9;
  48.       
  49.       public static const iFRows:int = 21;
  50.        
  51.       
  52.       private var iDiameter:Number;
  53.       
  54.       private var iField:Array;
  55.       
  56.       private var iRecord:ORecord;
  57.       
  58.       private var iBorderCount:int;
  59.       
  60.       private var iRand:ORandomInt;
  61.       
  62.       private var iFBub:OBubble;
  63.       
  64.       private var iBang:OBang;
  65.       
  66.       private var iScorePurBubble:int = 10;
  67.       
  68.       private var iRadius:Number;
  69.       
  70.       private var iFBubP:Point;
  71.       
  72.       private var iRRect:Rectangle;
  73.       
  74.       private var iCIndexes:Array;
  75.       
  76.       private var iDY:Number;
  77.       
  78.       private var iNewField:Array;
  79.       
  80.       private var iTime:int;
  81.       
  82.       private var iFC:int;
  83.       
  84.       private var iLostShoot:Boolean;
  85.       
  86.       private var iFR:int;
  87.       
  88.       private var iCursor:OCursor;
  89.       
  90.       private var iNBub:OBubble;
  91.       
  92.       private var iColors:Array;
  93.       
  94.       private var iRandomP:int = 25;
  95.       
  96.       private var iBangCount:int;
  97.       
  98.       private var dTime:Number;
  99.       
  100.       private var iCounter:OCounter;
  101.       
  102.       private var iDir:Point;
  103.       
  104.       private var iBubbleFall:Boolean;
  105.       
  106.       private var iRTime:int;
  107.       
  108.       private var iMaxColors:int;
  109.       
  110.       private var iConnectDist2:Number;
  111.       
  112.       private var iState:int = 0;
  113.       
  114.       private var iBubbleCount:int;
  115.       
  116.       private var iRect:Rectangle;
  117.       
  118.       private var iMx:int;
  119.       
  120.       private var iMy:int;
  121.       
  122.       public function OField(param1:Number, param2:Number, param3:Number, param4:OCounter, param5:OBang, param6:int, param7:Rectangle)
  123.       {
  124.          iState = 0;
  125.          iRandomP = 25;
  126.          iScorePurBubble = 10;
  127.          super();
  128.          this.iBang = param5;
  129.          this.iRadius = param1;
  130.          this.iCounter = param4;
  131.          this.iRRect = param7;
  132.          this.iDiameter = this.iRadius * 2;
  133.          this.iConnectDist2 = this.iDiameter * this.iDiameter * 0.66 * 0.66;
  134.          this.iRTime = -1;
  135.          this.iRand = new ORandomInt();
  136.          this.iRand.SeedRand(param6);
  137.          this.iRecord = new ORecord();
  138.          this.iBubbleCount = 0;
  139.          this.iBubbleFall = false;
  140.          FieldInit();
  141.          this.Pos(param2,param3);
  142.          iDir = new Point();
  143.          this.addEventListener(MouseEvent.MOUSE_DOWN,OnMouseDown);
  144.          this.addEventListener(Event.ENTER_FRAME,OnEnterFrame);
  145.          this.State = stInvisible;
  146.       }
  147.       
  148.       public function get prGameIndex() : int
  149.       {
  150.          return (ClusterzL.iGAME.prGamesStartCount + ClusterzL.iGAME.prLevel + ClusterzL.iGAME.prRNDFactor) % 10;
  151.       }
  152.       
  153.       private function Neighbours(param1:int, param2:int) : Array
  154.       {
  155.          var _loc3_:Array = null;
  156.          var _loc4_:int = 0;
  157.          _loc3_ = new Array();
  158.          _loc4_ = 0;
  159.          if(param1 % 2 == 0)
  160.          {
  161.             if(param1 > 0 && param2 > 0)
  162.             {
  163.                if((_loc4_ = ActiveCell(param1 - 1,param2 - 1)) > 0)
  164.                {
  165.                   _loc3_.push(_loc4_ - 1);
  166.                }
  167.             }
  168.             if(param1 > 0)
  169.             {
  170.                if((_loc4_ = ActiveCell(param1 - 1,param2)) > 0)
  171.                {
  172.                   _loc3_.push(_loc4_ - 1);
  173.                }
  174.             }
  175.             if(param2 > 0)
  176.             {
  177.                if((_loc4_ = ActiveCell(param1,param2 - 1)) > 0)
  178.                {
  179.                   _loc3_.push(_loc4_ - 1);
  180.                }
  181.             }
  182.             if(param2 < iFCols - 1)
  183.             {
  184.                if((_loc4_ = ActiveCell(param1,param2 + 1)) > 0)
  185.                {
  186.                   _loc3_.push(_loc4_ - 1);
  187.                }
  188.             }
  189.             if(param1 < iFRows - 1 && param2 > 0)
  190.             {
  191.                if((_loc4_ = ActiveCell(param1 + 1,param2 - 1)) > 0)
  192.                {
  193.                   _loc3_.push(_loc4_ - 1);
  194.                }
  195.             }
  196.             if(param1 < iFRows - 1)
  197.             {
  198.                if((_loc4_ = ActiveCell(param1 + 1,param2)) > 0)
  199.                {
  200.                   _loc3_.push(_loc4_ - 1);
  201.                }
  202.             }
  203.          }
  204.          else
  205.          {
  206.             if(param1 > 0)
  207.             {
  208.                if((_loc4_ = ActiveCell(param1 - 1,param2)) > 0)
  209.                {
  210.                   _loc3_.push(_loc4_ - 1);
  211.                }
  212.             }
  213.             if(param2 < iFCols - 1 && param1 > 0)
  214.             {
  215.                if((_loc4_ = ActiveCell(param1 - 1,param2 + 1)) > 0)
  216.                {
  217.                   _loc3_.push(_loc4_ - 1);
  218.                }
  219.             }
  220.             if(param2 > 0)
  221.             {
  222.                if((_loc4_ = ActiveCell(param1,param2 - 1)) > 0)
  223.                {
  224.                   _loc3_.push(_loc4_ - 1);
  225.                }
  226.             }
  227.             if(param2 < iFCols - 1)
  228.             {
  229.                if((_loc4_ = ActiveCell(param1,param2 + 1)) > 0)
  230.                {
  231.                   _loc3_.push(_loc4_ - 1);
  232.                }
  233.             }
  234.             if(param1 < iFRows - 1)
  235.             {
  236.                if((_loc4_ = ActiveCell(param1 + 1,param2)) > 0)
  237.                {
  238.                   _loc3_.push(_loc4_ - 1);
  239.                }
  240.             }
  241.             if(param1 < iFRows - 1 && param2 < iFCols - 1)
  242.             {
  243.                if((_loc4_ = ActiveCell(param1 + 1,param2 + 1)) > 0)
  244.                {
  245.                   _loc3_.push(_loc4_ - 1);
  246.                }
  247.             }
  248.          }
  249.          return _loc3_;
  250.       }
  251.       
  252.       private function FieldBangBlackBub() : void
  253.       {
  254.          var _loc1_:int = 0;
  255.          var _loc2_:int = 0;
  256.          var _loc3_:int = 0;
  257.          var _loc4_:OBubble = null;
  258.          _loc1_ = 20;
  259.          _loc2_ = 0;
  260.          while(_loc2_ < OField.iFRows)
  261.          {
  262.             _loc3_ = 0;
  263.             while(_loc3_ < OField.iFCols)
  264.             {
  265.                if((_loc4_ = this.iField[_loc2_][_loc3_]).prCInd >= OBubble.iColorsCount - 1)
  266.                {
  267.                   _loc4_.prType = _loc1_;
  268.                   _loc1_ += 20;
  269.                   _loc4_.prDelta = _loc4_.prType;
  270.                   _loc4_.State = OBubble.stBeforeBang;
  271.                }
  272.                _loc3_++;
  273.             }
  274.             _loc2_++;
  275.          }
  276.       }
  277.       
  278.       private function get prNextColor() : int
  279.       {
  280.          return this.iColors[this.iRand.RandVal(this.iColors.length)];
  281.       }
  282.       
  283.       private function FieldShowRemove() : Boolean
  284.       {
  285.          var _loc1_:Boolean = false;
  286.          var _loc2_:int = 0;
  287.          var _loc3_:int = 0;
  288.          var _loc4_:OBubble = null;
  289.          _loc1_ = false;
  290.          _loc2_ = 0;
  291.          while(_loc2_ < OField.iFRows)
  292.          {
  293.             _loc3_ = 0;
  294.             while(_loc3_ < OField.iFCols)
  295.             {
  296.                if((_loc4_ = this.iField[_loc2_][_loc3_]).prType)
  297.                {
  298.                   _loc4_.OnEnterFrame(null);
  299.                   if(_loc4_.State != OBubble.stInvisible)
  300.                   {
  301.                      _loc1_ = true;
  302.                   }
  303.                   if(_loc4_.State == OBubble.stBang)
  304.                   {
  305.                      if(this.iBang)
  306.                      {
  307.                         this.iBang.MakeFirework3(_loc4_,3);
  308.                      }
  309.                      _loc4_.prCInd = -1;
  310.                   }
  311.                   if(_loc4_.State == OBubble.stFlyOut)
  312.                   {
  313.                      _loc4_.prCInd = -1;
  314.                   }
  315.                }
  316.                _loc3_++;
  317.             }
  318.             _loc2_++;
  319.          }
  320.          return _loc1_;
  321.       }
  322.       
  323.       public function get State() : int
  324.       {
  325.          return this.iState;
  326.       }
  327.       
  328.       private function FieldCheckGameOver() : Boolean
  329.       {
  330.          var _loc1_:int = 0;
  331.          _loc1_ = 0;
  332.          while(_loc1_ < OField.iFCols)
  333.          {
  334.             if(this.iField[OField.iFRows - 1][_loc1_].prCInd >= 0)
  335.             {
  336.                return true;
  337.             }
  338.             _loc1_++;
  339.          }
  340.          return false;
  341.       }
  342.       
  343.       private function FieldShowNewBub(param1:Array) : void
  344.       {
  345.          var _loc2_:int = 0;
  346.          var _loc3_:int = 0;
  347.          var _loc4_:int = 0;
  348.          var _loc5_:OBubble = null;
  349.          _loc2_ = 0;
  350.          _loc3_ = 0;
  351.          while(_loc3_ < OField.iFRows)
  352.          {
  353.             _loc4_ = 0;
  354.             while(_loc4_ < OField.iFCols)
  355.             {
  356.                if(param1[_loc3_][_loc4_] >= 0)
  357.                {
  358.                   _loc5_ = this.iField[_loc3_][_loc4_];
  359.                   this.iField[_loc3_][_loc4_].prCInd = param1[_loc3_][_loc4_];
  360.                   _loc5_.InitShow(2,4,this.iRadius,0,5);
  361.                   ++this.iBubbleCount;
  362.                }
  363.                _loc4_++;
  364.             }
  365.             _loc2_ += 1;
  366.             _loc3_++;
  367.          }
  368.       }
  369.       
  370.       override public function Free() : void
  371.       {
  372.          this.removeEventListener(Event.ENTER_FRAME,OnEnterFrame);
  373.          this.removeEventListener(MouseEvent.MOUSE_DOWN,OnMouseDown);
  374.          this.iField = null;
  375.          if(iCursor)
  376.          {
  377.             iCursor = null;
  378.          }
  379.          super.Free();
  380.       }
  381.       
  382.       private function FieldCalcColors() : void
  383.       {
  384.          var _loc1_:int = 0;
  385.          var _loc2_:int = 0;
  386.          var _loc3_:int = 0;
  387.          _loc1_ = 0;
  388.          while(_loc1_ < 12)
  389.          {
  390.             this.iColors[_loc1_] = -1;
  391.             _loc1_++;
  392.          }
  393.          _loc2_ = OField.iFRows - 1;
  394.          while(_loc2_ >= 0)
  395.          {
  396.             _loc3_ = 0;
  397.             while(_loc3_ < OField.iFCols)
  398.             {
  399.                if(ActiveCell(_loc2_,_loc3_) > 0)
  400.                {
  401.                   this.iColors[this.iField[_loc2_][_loc3_].prCInd] = this.iField[_loc2_][_loc3_].prCInd;
  402.                }
  403.                _loc3_++;
  404.             }
  405.             _loc2_--;
  406.          }
  407.          _loc1_ = 0;
  408.          while(_loc1_ < this.iColors.length)
  409.          {
  410.             if(this.iColors[_loc1_] < 0)
  411.             {
  412.                this.iColors.splice(_loc1_,1);
  413.             }
  414.             else
  415.             {
  416.                _loc1_++;
  417.             }
  418.          }
  419.       }
  420.       
  421.       private function FieldOnEnterFrame() : void
  422.       {
  423.          var _loc1_:int = 0;
  424.          var _loc2_:int = 0;
  425.          var _loc3_:OBubble = null;
  426.          _loc1_ = 0;
  427.          while(_loc1_ < OField.iFRows)
  428.          {
  429.             _loc2_ = 0;
  430.             while(_loc2_ < OField.iFCols)
  431.             {
  432.                _loc3_ = this.iField[_loc1_][_loc2_];
  433.                if(_loc3_.prCInd >= 0)
  434.                {
  435.                   _loc3_.OnEnterFrame(null);
  436.                }
  437.                _loc2_++;
  438.             }
  439.             _loc1_++;
  440.          }
  441.       }
  442.       
  443.       public function OnEnterFrame(param1:Event) : void
  444.       {
  445.          var _loc2_:Number = NaN;
  446.          var _loc3_:int = 0;
  447.          var _loc4_:Number = NaN;
  448.          var _loc5_:Number = NaN;
  449.          switch(this.iState)
  450.          {
  451.             case stShowField:
  452.                this.FieldOnEnterFrame();
  453.                if(this.FieldIsAllStates(OBubble.stNormal))
  454.                {
  455.                   this.State = stShowFBub;
  456.                }
  457.                break;
  458.             case stShowFBub:
  459.                _loc2_ = -this.iRadius / 4;
  460.                this.iFBub.Move(0,_loc2_);
  461.                this.iNBub.Move(0,_loc2_);
  462.                if(this.iFBub.prY == this.iFBubP.y)
  463.                {
  464.                   this.State = stNormal;
  465.                }
  466.                break;
  467.             case stNormal:
  468.                if(!this.iBang)
  469.                {
  470.                   _loc3_ = getTimer();
  471.                   if(iCursor != null)
  472.                   {
  473.                      iCursor.Move(iDir.x * (_loc3_ - dTime),iDir.y * (_loc3_ - dTime));
  474.                      dTime = getTimer();
  475.                   }
  476.                   if(this.iRTime >= 0 && _loc3_ - this.iTime >= this.iRTime)
  477.                   {
  478.                      this.EmulateMove(new Point(iMx,iMy),this.iRRect);
  479.                      this.iRTime = this.iRecord.ReadTime() * 200;
  480.                      iMx = this.iRecord.ReadCoord();
  481.                      iMy = this.iRecord.ReadCoord();
  482.                      if(iCursor)
  483.                      {
  484.                         _loc4_ = iMx * this.iRect.width / iRRect.width;
  485.                         _loc5_ = iMy * this.iRect.height / iRRect.height;
  486.                         iDir = new Point((this.prX + _loc4_ - iCursor.prX) / iRTime,(this.prY + _loc5_ - iCursor.prY) / iRTime);
  487.                      }
  488.                      this.iTime = _loc3_;
  489.                      this.State = stMoveFBub;
  490.                   }
  491.                }
  492.                break;
  493.             case stMoveFBub:
  494.                if(!this.MoveFBub())
  495.                {
  496.                   if(this.iLostShoot)
  497.                   {
  498.                      this.State = stAddNewBub;
  499.                   }
  500.                   else
  501.                   {
  502.                      this.State = stCalcRemove;
  503.                   }
  504.                }
  505.                break;
  506.             case stCalcRemove:
  507.                if(!this.FieldShowRemove())
  508.                {
  509.                   this.State = stAddNewBub;
  510.                }
  511.                break;
  512.             case stAddNewBub:
  513.                this.FieldOnEnterFrame();
  514.                if(this.FieldIsAllStates(OBubble.stNormal))
  515.                {
  516.                   this.State = stShuffle;
  517.                }
  518.                break;
  519.             case stLevelCompShow:
  520.                this.FieldOnEnterFrame();
  521.                if(!this.FieldShowRemove())
  522.                {
  523.                   if(!iBang)
  524.                   {
  525.                      this.State = stLevelComplete;
  526.                   }
  527.                   else if(iBang.numChildren == 0)
  528.                   {
  529.                      this.State = stLevelComplete;
  530.                   }
  531.                }
  532.                break;
  533.             case stGameOverShow:
  534.                this.FieldOnEnterFrame();
  535.                if(this.FieldIsAllStates(OBubble.stInvisible))
  536.                {
  537.                   this.State = stGameOver;
  538.                }
  539.          }
  540.       }
  541.       
  542.       private function Shuffle() : void
  543.       {
  544.          var _loc1_:int = 0;
  545.          var _loc2_:int = 0;
  546.          _loc1_ = 0;
  547.          while(_loc1_ < OField.iFRows)
  548.          {
  549.             _loc2_ = 0;
  550.             while(_loc2_ < OField.iFCols)
  551.             {
  552.                if(ActiveCell(_loc1_,_loc2_) > 0)
  553.                {
  554.                   this.iField[_loc1_][_loc2_].prCInd = this.iCIndexes[this.iRand.RandVal(this.iCIndexes.length)];
  555.                }
  556.                _loc2_++;
  557.             }
  558.             _loc1_++;
  559.          }
  560.       }
  561.       
  562.       public function set State(param1:int) : void
  563.       {
  564.          this.iState = param1;
  565.          switch(this.iState)
  566.          {
  567.             case stInvisible:
  568.                this.prVisible = false;
  569.             case stShowField:
  570.                this.prVisible = true;
  571.                this.FieldInitShow();
  572.                break;
  573.             case stShowFBub:
  574.                this.FieldCalcColors();
  575.                if(this.FieldCheckLevComplete())
  576.                {
  577.                   this.State = stLevelCompShow;
  578.                   break;
  579.                }
  580.                if(this.FieldCheckGameOver())
  581.                {
  582.                   this.State = stGameOverShow;
  583.                   break;
  584.                }
  585.                this.iFBub.prCInd = this.iNBub.prCInd;
  586.                if(!this.ColorPresent(this.iFBub.prCInd))
  587.                {
  588.                   this.iFBub.prCInd = this.prNextColor;
  589.                }
  590.                this.iNBub.prCInd = this.prNextColor;
  591.                this.iFBub.Pos(this.iFBubP.x,this.iFBubP.y + this.iDiameter);
  592.                this.iFBub.prVisible = true;
  593.                this.iNBub.Pos(this.iFBubP.x,this.iFBubP.y + this.iDiameter * 2);
  594.                this.iNBub.prVisible = true;
  595.                break;
  596.             case stNormal:
  597.                this.iTime = getTimer();
  598.                this.dTime = getTimer();
  599.                break;
  600.             case stMoveFBub:
  601.                this.iLostShoot = false;
  602.                break;
  603.             case stCalcRemove:
  604.                if(!this.FieldCalcRemove())
  605.                {
  606.                   this.State = stAddNewBub;
  607.                }
  608.                break;
  609.             case stAddNewBub:
  610.                if(this.iLostShoot)
  611.                {
  612.                   this.FieldShowNewBub(this.FieldCalcAddNewBub());
  613.                }
  614.                else
  615.                {
  616.                   this.State = stShuffle;
  617.                }
  618.                break;
  619.             case stShuffle:
  620.                if(this.iBubbleFall)
  621.                {
  622.                   this.Shuffle();
  623.                }
  624.                this.State = stShowFBub;
  625.                break;
  626.             case stLevelCompShow:
  627.                this.SendGameToServer();
  628.                this.FieldBangBlackBub();
  629.                this.iFBub.prVisible = false;
  630.                this.iNBub.prVisible = false;
  631.                break;
  632.             case stGameOverShow:
  633.                this.SendGameToServer();
  634.                this.FieldInitHide();
  635.                ClusterzL.iGAME.SetSaveGame(null);
  636.                this.iFBub.prVisible = false;
  637.                this.iNBub.prVisible = false;
  638.          }
  639.       }
  640.       
  641.       public function get prRecord() : String
  642.       {
  643.          return this.iRecord.prStr;
  644.       }
  645.       
  646.       public function get prRect() : Rectangle
  647.       {
  648.          return this.iRect;
  649.       }
  650.       
  651.       private function FieldInit() : void
  652.       {
  653.          var _loc1_:Sprite = null;
  654.          var _loc2_:Number = NaN;
  655.          var _loc3_:int = 0;
  656.          var _loc4_:Number = NaN;
  657.          var _loc5_:int = 0;
  658.          this.iDY = Math.round(Math.sqrt(3) * this.iRadius);
  659.          this.iRect = new Rectangle(0,0,this.iDiameter * OField.iFCols + this.iRadius,this.iDY * (OField.iFRows - 1) + this.iDiameter);
  660.          _loc1_ = new Sprite();
  661.          _loc1_.graphics.beginFill(0);
  662.          _loc1_.graphics.drawRect(0,0,this.iRect.width * OGlobal.Scale,this.iRect.height * OGlobal.Scale);
  663.          _loc1_.visible = false;
  664.          this.addChild(_loc1_);
  665.          this.hitArea = _loc1_;
  666.          this.iField = new Array(OField.iFRows);
  667.          _loc2_ = this.iRadius;
  668.          _loc3_ = 0;
  669.          while(_loc3_ < OField.iFRows)
  670.          {
  671.             this.iField[_loc3_] = new Array(OField.iFCols);
  672.             _loc4_ = _loc3_ % 2 == 0 ? this.iRadius : this.iDiameter;
  673.             _loc5_ = 0;
  674.             while(_loc5_ < OField.iFCols)
  675.             {
  676.                this.iField[_loc3_][_loc5_] = new OBubble(this.iRadius,-1,_loc4_,_loc2_);
  677.                this.addChild(this.iField[_loc3_][_loc5_]);
  678.                _loc4_ += this.iDiameter;
  679.                _loc5_++;
  680.             }
  681.             _loc2_ += this.iDY;
  682.             _loc3_++;
  683.          }
  684.          this.iFBubP = new Point(Math.round((this.iDiameter * OField.iFCols + this.iRadius) / 2),_loc2_ - 2 * this.iDY + this.iDiameter);
  685.          this.iFBub = new OBubble(this.iRadius,-1,this.iFBubP.x,this.iFBubP.y);
  686.          this.addChild(this.iFBub);
  687.          this.iNBub = new OBubble(this.iRadius,-1,this.iFBubP.x,this.iFBubP.y + this.iDiameter);
  688.          this.addChild(this.iNBub);
  689.       }
  690.       
  691.       private function NeighbourCount(param1:int, param2:int) : int
  692.       {
  693.          var _loc3_:int = 0;
  694.          _loc3_ = 0;
  695.          if(param1 % 2 == 0)
  696.          {
  697.             if(param1 > 0 && param2 > 0)
  698.             {
  699.                if(iNewField[param1 - 1][param2 - 1] >= 0 && iNewField[param1 - 1][param2 - 1] != OBubble.iColorsCount)
  700.                {
  701.                   return 1;
  702.                }
  703.             }
  704.             if(param1 > 0)
  705.             {
  706.                if(iNewField[param1 - 1][param2] >= 0 && iNewField[param1 - 1][param2] != OBubble.iColorsCount)
  707.                {
  708.                   return 1;
  709.                }
  710.             }
  711.             if(param2 > 0)
  712.             {
  713.                if(iNewField[param1][param2 - 1] >= 0 && iNewField[param1][param2 - 1] != OBubble.iColorsCount)
  714.                {
  715.                   return 1;
  716.                }
  717.             }
  718.             if(param2 < iFCols - 1)
  719.             {
  720.                if(iNewField[param1][param2 + 1] >= 0 && iNewField[param1][param2 + 1] != OBubble.iColorsCount)
  721.                {
  722.                   return 1;
  723.                }
  724.             }
  725.             if(param1 < iFRows - 1 && param2 > 0)
  726.             {
  727.                if(iNewField[param1 + 1][param2 - 1] >= 0 && iNewField[param1 + 1][param2 - 1] != OBubble.iColorsCount)
  728.                {
  729.                   return 1;
  730.                }
  731.             }
  732.             if(param1 < iFRows - 1)
  733.             {
  734.                if(iNewField[param1 + 1][param2] >= 0 && iNewField[param1 + 1][param2] != OBubble.iColorsCount)
  735.                {
  736.                   return 1;
  737.                }
  738.             }
  739.          }
  740.          else
  741.          {
  742.             if(param1 > 0)
  743.             {
  744.                if(iNewField[param1 - 1][param2] >= 0 && iNewField[param1 - 1][param2] != OBubble.iColorsCount)
  745.                {
  746.                   return 1;
  747.                }
  748.             }
  749.             if(param2 < iFCols - 1 && param1 > 0)
  750.             {
  751.                if(iNewField[param1 - 1][param2 + 1] >= 0 && iNewField[param1 - 1][param2 + 1] != OBubble.iColorsCount)
  752.                {
  753.                   return 1;
  754.                }
  755.             }
  756.             if(param2 > 0)
  757.             {
  758.                if(iNewField[param1][param2 - 1] >= 0 && iNewField[param1][param2 - 1] != OBubble.iColorsCount)
  759.                {
  760.                   return 1;
  761.                }
  762.             }
  763.             if(param2 < iFCols - 1)
  764.             {
  765.                if(iNewField[param1][param2 + 1] >= 0 && iNewField[param1][param2 + 1] != OBubble.iColorsCount)
  766.                {
  767.                   return 1;
  768.                }
  769.             }
  770.             if(param1 < iFRows - 1)
  771.             {
  772.                if(iNewField[param1 + 1][param2] >= 0 && iNewField[param1 + 1][param2] != OBubble.iColorsCount)
  773.                {
  774.                   return 1;
  775.                }
  776.             }
  777.             if(param1 < iFRows - 1 && param2 < iFCols - 1)
  778.             {
  779.                if(iNewField[param1 + 1][param2 + 1] >= 0 && iNewField[param1 + 1][param2 + 1] != OBubble.iColorsCount)
  780.                {
  781.                   return 1;
  782.                }
  783.             }
  784.          }
  785.          return _loc3_;
  786.       }
  787.       
  788.       private function FieldCalcFreeBub() : void
  789.       {
  790.          var _loc1_:int = 0;
  791.          var _loc2_:int = 0;
  792.          var _loc3_:int = 0;
  793.          var _loc4_:OBubble = null;
  794.          _loc1_ = 0;
  795.          _loc2_ = 0;
  796.          while(_loc2_ < OField.iFRows)
  797.          {
  798.             _loc3_ = 0;
  799.             while(_loc3_ < OField.iFCols)
  800.             {
  801.                if(!(iNewField[_loc2_][_loc3_] < 0 || iNewField[_loc2_][_loc3_] == OBubble.iColorsCount - 1))
  802.                {
  803.                   _loc4_ = iField[_loc2_][_loc3_];
  804.                   if(NeighbourCount(_loc2_,_loc3_) == 0)
  805.                   {
  806.                      _loc4_.prType = this.iBangCount++ + 1;
  807.                   }
  808.                }
  809.                _loc3_++;
  810.             }
  811.             _loc2_++;
  812.          }
  813.       }
  814.       
  815.       private function FieldCalcAddNewBub() : Array
  816.       {
  817.          var _loc1_:Array = null;
  818.          var _loc2_:int = 0;
  819.          var _loc3_:int = 0;
  820.          var _loc4_:Array = null;
  821.          _loc1_ = new Array(OField.iFRows);
  822.          _loc2_ = 0;
  823.          while(_loc2_ < OField.iFRows)
  824.          {
  825.             _loc1_[_loc2_] = new Array();
  826.             _loc3_ = 0;
  827.             while(_loc3_ < OField.iFCols)
  828.             {
  829.                if(iField[_loc2_][_loc3_].prCInd >= 0)
  830.                {
  831.                   _loc1_[_loc2_].push(-1);
  832.                }
  833.                else if((_loc4_ = this.Neighbours(_loc2_,_loc3_)).length > 0 && _loc4_.length < 4)
  834.                {
  835.                   if(this.iRand.RandVal(100) < 100 - iRandomP)
  836.                   {
  837.                      _loc1_[_loc2_].push(_loc4_[this.iRand.RandVal(_loc4_.length)]);
  838.                   }
  839.                   else
  840.                   {
  841.                      _loc1_[_loc2_].push(prNextColor);
  842.                   }
  843.                }
  844.                else
  845.                {
  846.                   _loc1_[_loc2_].push(-1);
  847.                }
  848.                _loc3_++;
  849.             }
  850.             _loc2_++;
  851.          }
  852.          return _loc1_;
  853.       }
  854.       
  855.       private function Dist2(param1:int, param2:int, param3:Point) : Number
  856.       {
  857.          var _loc4_:Number = NaN;
  858.          var _loc5_:Number = NaN;
  859.          var _loc6_:Number = NaN;
  860.          if(param1 < 0 || param1 >= OField.iFRows || param2 < 0 || param2 >= OField.iFCols)
  861.          {
  862.             return Number.MAX_VALUE;
  863.          }
  864.          _loc4_ = param3.x - this.iField[param1][param2].prX;
  865.          _loc5_ = param3.y - this.iField[param1][param2].prY;
  866.          _loc6_ = _loc4_ * _loc4_ + _loc5_ * _loc5_;
  867.          return this.iField[param1][param2].prCInd < 0 ? -_loc6_ : _loc6_;
  868.       }
  869.       
  870.       private function FieldInitShow() : void
  871.       {
  872.          var _loc1_:int = 0;
  873.          var _loc2_:int = 0;
  874.          var _loc3_:int = 0;
  875.          var _loc4_:OBubble = null;
  876.          _loc1_ = 0;
  877.          _loc2_ = 0;
  878.          while(_loc2_ < OField.iFRows)
  879.          {
  880.             _loc3_ = 0;
  881.             while(_loc3_ < OField.iFCols)
  882.             {
  883.                if((_loc4_ = this.iField[_loc2_][_loc3_]).prCInd >= 0)
  884.                {
  885.                   _loc4_.InitShow(_loc1_,4,this.iRadius,0,OUtils.Random(10,15));
  886.                }
  887.                _loc3_++;
  888.             }
  889.             _loc1_ += 5;
  890.             _loc2_++;
  891.          }
  892.          this.iFBub.prVisible = false;
  893.          this.iNBub.prVisible = false;
  894.       }
  895.       
  896.       private function FieldCheckLevComplete() : Boolean
  897.       {
  898.          return this.iBubbleCount == 0;
  899.       }
  900.       
  901.       public function EmulateMove(param1:Point, param2:Rectangle) : void
  902.       {
  903.          var _loc3_:Number = NaN;
  904.          var _loc4_:Number = NaN;
  905.          var _loc5_:Point = null;
  906.          if(this.State != OField.stNormal)
  907.          {
  908.             return;
  909.          }
  910.          _loc3_ = param1.x * this.iRect.width / param2.width;
  911.          _loc4_ = param1.y * this.iRect.height / param2.height;
  912.          (_loc5_ = new Point(_loc3_ - this.iFBubP.x,_loc4_ - this.iFBubP.y)).normalize(this.iRadius);
  913.          this.iFBub.prVel = _loc5_;
  914.          this.iBorderCount = this.iRecord.ReadSmallInt();
  915.          this.iBubbleFall = this.iRecord.ReadFall();
  916.          this.iFR = this.iRecord.ReadSmallInt();
  917.          this.iFC = this.iRecord.ReadSmallInt();
  918.          if(iBubbleFall)
  919.          {
  920.             --this.iBubbleCount;
  921.          }
  922.          if(iCursor)
  923.          {
  924.             iCursor.Pos(this.prX + _loc3_,this.prY + _loc4_);
  925.             iCursor.Blink();
  926.          }
  927.       }
  928.       
  929.       private function CalcFCell(param1:Number, param2:Number) : Boolean
  930.       {
  931.          var _loc3_:Boolean = false;
  932.          var _loc4_:Point = null;
  933.          var _loc5_:Point = null;
  934.          var _loc6_:Point = null;
  935.          var _loc7_:int = 0;
  936.          var _loc8_:int = 0;
  937.          var _loc9_:int = 0;
  938.          var _loc10_:int = 0;
  939.          var _loc11_:int = 0;
  940.          var _loc12_:int = 0;
  941.          var _loc13_:int = 0;
  942.          var _loc14_:int = 0;
  943.          var _loc15_:Number = NaN;
  944.          var _loc16_:Number = NaN;
  945.          var _loc17_:int = 0;
  946.          var _loc18_:int = 0;
  947.          var _loc19_:int = 0;
  948.          var _loc20_:Number = NaN;
  949.          _loc3_ = false;
  950.          (_loc5_ = (_loc4_ = new Point(param1 - this.iFBubP.x,param2 - this.iFBubP.y)).clone()).normalize(0.2 * this.iRadius / 15);
  951.          _loc6_ = this.iFBubP.clone();
  952.          this.iBorderCount = 0;
  953.          _loc7_ = -1;
  954.          _loc8_ = -1;
  955.          _loc9_ = -1;
  956.          _loc10_ = -1;
  957.          _loc11_ = -1;
  958.          _loc12_ = -1;
  959.          while(1)
  960.          {
  961.             if((_loc8_ = (_loc7_ = (_loc6_.y - this.iRadius) / this.iDY + 1) % 2 == 0 ? int(_loc6_.x / this.iDiameter) : int((_loc6_.x - this.iRadius) / this.iDiameter)) < 0)
  962.             {
  963.                _loc8_ = 0;
  964.             }
  965.             _loc15_ = Number.MAX_VALUE;
  966.             _loc16_ = Number.MAX_VALUE;
  967.             _loc17_ = 0;
  968.             while(_loc17_ < 9)
  969.             {
  970.                _loc18_ = _loc7_ + OField.iInd[_loc17_][0];
  971.                _loc19_ = _loc8_ + OField.iInd[_loc17_][1];
  972.                if((_loc20_ = Dist2(_loc18_,_loc19_,_loc6_)) < 0)
  973.                {
  974.                   if(Math.abs(_loc20_) < _loc16_)
  975.                   {
  976.                      _loc16_ = Math.abs(_loc20_);
  977.                      _loc11_ = _loc18_;
  978.                      _loc12_ = _loc19_;
  979.                   }
  980.                }
  981.                else if(_loc20_ < _loc15_)
  982.                {
  983.                   _loc15_ = _loc20_;
  984.                   _loc9_ = _loc18_;
  985.                   _loc10_ = _loc19_;
  986.                }
  987.                _loc17_++;
  988.             }
  989.             _loc7_ = _loc11_;
  990.             _loc8_ = _loc12_;
  991.             if(_loc15_ <= this.iConnectDist2)
  992.             {
  993.                if(iBang)
  994.                {
  995.                   ++this.iBubbleCount;
  996.                }
  997.                break;
  998.             }
  999.             if(_loc7_ > iFRows - 2 && _loc5_.y >= 0)
  1000.             {
  1001.                _loc3_ = true;
  1002.                break;
  1003.             }
  1004.             _loc6_.offset(_loc5_.x,_loc5_.y);
  1005.             if(_loc5_.x >= 0 && _loc6_.x + this.iRadius >= this.iRect.width || _loc5_.x < 0 && _loc6_.x - this.iRadius <= 0)
  1006.             {
  1007.                _loc5_.x = -_loc5_.x;
  1008.                ++this.iBorderCount;
  1009.             }
  1010.             if(_loc5_.y < 0 && _loc6_.y - this.iRadius <= 0)
  1011.             {
  1012.                _loc5_.y = -_loc5_.y;
  1013.                ++this.iBorderCount;
  1014.             }
  1015.          }
  1016.          this.iFR = _loc7_;
  1017.          this.iFC = _loc8_;
  1018.          if((_loc14_ = (_loc13_ = getTimer()) - this.iTime) >= 19999)
  1019.          {
  1020.             _loc14_ = 19999;
  1021.          }
  1022.          _loc14_ /= 200;
  1023.          if(this.iBang)
  1024.          {
  1025.             this.iRecord.WriteNode(param1,param2,_loc14_,iBorderCount,_loc3_,_loc7_,_loc8_);
  1026.          }
  1027.          this.iTime = _loc13_;
  1028.          OSystem.iUserText2 = param1.toString() + "x" + param2.toString() + "/" + this.iFR.toString() + "x" + this.iFC.toString();
  1029.          _loc4_.normalize(this.iRadius);
  1030.          this.iFBub.prVel = _loc4_;
  1031.          return _loc3_;
  1032.       }
  1033.       
  1034.       private function SendGameToServer() : void
  1035.       {
  1036.          if(this.iBang && this.iRecord.prStr && ClusterzL.iMP.State == OMultiplayer.stInZone)
  1037.          {
  1038.             ClusterzL.iMP.Turn(["wrl",ClusterzL.iGAME.prLevel,this.prGameIndex,ClusterzL.iGAME.prPlayerName,this.iRecord.prStr]);
  1039.          }
  1040.       }
  1041.       
  1042.       private function FieldInitHide() : void
  1043.       {
  1044.          var _loc1_:int = 0;
  1045.          var _loc2_:int = 0;
  1046.          var _loc3_:Boolean = false;
  1047.          var _loc4_:int = 0;
  1048.          var _loc5_:OBubble = null;
  1049.          _loc1_ = 90;
  1050.          _loc2_ = OField.iFRows - 1;
  1051.          while(_loc2_ >= 0)
  1052.          {
  1053.             _loc3_ = false;
  1054.             _loc4_ = 0;
  1055.             while(_loc4_ < OField.iFCols)
  1056.             {
  1057.                if((_loc5_ = this.iField[_loc2_][_loc4_]).prCInd >= 0)
  1058.                {
  1059.                   _loc3_ = true;
  1060.                   _loc5_.InitHide(_loc1_,this.iRadius,4,0,OUtils.Random(10,15));
  1061.                }
  1062.                _loc4_++;
  1063.             }
  1064.             if(_loc3_)
  1065.             {
  1066.                _loc1_ += 5;
  1067.             }
  1068.             _loc2_--;
  1069.          }
  1070.          this.iFBub.prVisible = false;
  1071.          this.iNBub.prVisible = false;
  1072.       }
  1073.       
  1074.       public function get prRTime() : int
  1075.       {
  1076.          return this.iRTime;
  1077.       }
  1078.       
  1079.       public function OnMouseDown(param1:MouseEvent) : void
  1080.       {
  1081.          var _loc2_:Number = NaN;
  1082.          var _loc3_:Number = NaN;
  1083.          if(this.iState == stNormal)
  1084.          {
  1085.             _loc2_ = Math.round(OGlobal.ToLocal(param1.stageX - OGlobal.ViewporRect.x) - this.prX);
  1086.             _loc3_ = Math.round(OGlobal.ToLocal(param1.stageY - OGlobal.ViewporRect.y) - this.prY);
  1087.             if(_loc3_ - this.iFBubP.y >= 0)
  1088.             {
  1089.                return;
  1090.             }
  1091.             this.iBubbleFall = this.CalcFCell(_loc2_,_loc3_);
  1092.             this.State = stMoveFBub;
  1093.          }
  1094.       }
  1095.       
  1096.       private function FieldCalcRemove() : Boolean
  1097.       {
  1098.          var _loc1_:int = 0;
  1099.          var _loc2_:int = 0;
  1100.          var _loc3_:Boolean = false;
  1101.          var _loc4_:Number = NaN;
  1102.          var _loc5_:int = 0;
  1103.          var _loc6_:int = 0;
  1104.          var _loc7_:int = 0;
  1105.          var _loc8_:OBubble = null;
  1106.          iNewField = new Array(OField.iFRows);
  1107.          _loc1_ = 0;
  1108.          while(_loc1_ < OField.iFRows)
  1109.          {
  1110.             iNewField[_loc1_] = new Array(OField.iFCols);
  1111.             _loc7_ = 0;
  1112.             while(_loc7_ < OField.iFCols)
  1113.             {
  1114.                this.iField[_loc1_][_loc7_].prType = 0;
  1115.                iNewField[_loc1_][_loc7_] = this.iField[_loc1_][_loc7_].prCInd;
  1116.                _loc7_++;
  1117.             }
  1118.             _loc1_++;
  1119.          }
  1120.          _loc2_ = int(this.iField[this.iFR][this.iFC].prCInd);
  1121.          this.iBangCount = 0;
  1122.          FieldCalcR(this.iFR,this.iFC,_loc2_);
  1123.          if(!iBubbleFall)
  1124.          {
  1125.             if(this.iBangCount < 3)
  1126.             {
  1127.                this.iBangCount = 0;
  1128.                this.iLostShoot = true;
  1129.                return false;
  1130.             }
  1131.          }
  1132.          if(this.iBangCount < 0)
  1133.          {
  1134.             this.iBangCount = 0;
  1135.          }
  1136.          this.FieldCalcFreeBub();
  1137.          _loc3_ = true;
  1138.          _loc4_ = 0;
  1139.          _loc5_ = 0;
  1140.          _loc6_ = 0;
  1141.          _loc1_ = 0;
  1142.          while(_loc1_ < OField.iFRows)
  1143.          {
  1144.             _loc7_ = 0;
  1145.             while(_loc7_ < OField.iFCols)
  1146.             {
  1147.                if((_loc8_ = this.iField[_loc1_][_loc7_]).prType)
  1148.                {
  1149.                   _loc8_.prDelta = _loc8_.prType;
  1150.                   _loc8_.State = OBubble.stBeforeBang;
  1151.                   if(this.iBubbleFall && _loc1_ == iFR && _loc7_ == iFC)
  1152.                   {
  1153.                      _loc8_.State = OBubble.stFlyOut;
  1154.                   }
  1155.                   else
  1156.                   {
  1157.                      _loc6_++;
  1158.                      --this.iBubbleCount;
  1159.                   }
  1160.                   _loc4_ += _loc7_;
  1161.                   _loc5_++;
  1162.                }
  1163.                _loc7_++;
  1164.             }
  1165.             _loc1_++;
  1166.          }
  1167.          _loc4_ /= _loc5_ * OField.iFCols;
  1168.          if(this.iCounter)
  1169.          {
  1170.             this.iCounter.prValue += _loc6_ * this.iScorePurBubble;
  1171.          }
  1172.          OSound.PlaySoundRandom(_loc4_ * 2 - 1,ClusterzL.OSBubbleBangSInd + 1,ClusterzL.OSBubbleBangEInd);
  1173.          return true;
  1174.       }
  1175.       
  1176.       private function ActiveCell(param1:int, param2:int) : int
  1177.       {
  1178.          if(this.iField[param1][param2].prCInd < 0)
  1179.          {
  1180.             return -1;
  1181.          }
  1182.          if(this.iField[param1][param2].prCInd == OBubble.iColorsCount - 1)
  1183.          {
  1184.             return 0;
  1185.          }
  1186.          return this.iField[param1][param2].prCInd + 1;
  1187.       }
  1188.       
  1189.       private function MoveFBub() : Boolean
  1190.       {
  1191.          var _loc1_:Point = null;
  1192.          var _loc2_:OBubble = null;
  1193.          var _loc3_:Number = NaN;
  1194.          var _loc4_:Number = NaN;
  1195.          var _loc5_:Number = NaN;
  1196.          var _loc6_:Number = NaN;
  1197.          _loc1_ = this.iFBub.prVel;
  1198.          this.iFBub.Move(_loc1_.x,_loc1_.y);
  1199.          if(_loc1_.x >= 0 && this.iFBub.prX + this.iRadius >= this.iRect.width || _loc1_.x < 0 && this.iFBub.prX - this.iRadius <= 0)
  1200.          {
  1201.             _loc1_.x = -_loc1_.x;
  1202.             --this.iBorderCount;
  1203.          }
  1204.          if(_loc1_.y < 0 && this.iFBub.prY - this.iRadius <= 0)
  1205.          {
  1206.             _loc1_.y = -_loc1_.y;
  1207.             --this.iBorderCount;
  1208.          }
  1209.          _loc2_ = this.iField[this.iFR][this.iFC];
  1210.          _loc3_ = _loc2_.prX - this.iFBub.prX;
  1211.          _loc4_ = _loc2_.prY - this.iFBub.prY;
  1212.          _loc5_ = _loc3_ * _loc3_ + _loc4_ * _loc4_;
  1213.          if(iBubbleFall && this.iBorderCount == 0 || !iBubbleFall)
  1214.          {
  1215.             if(_loc5_ < this.iDiameter * this.iDiameter * 2)
  1216.             {
  1217.                if((_loc6_ = _loc1_.length * 0.8) < 1.5)
  1218.                {
  1219.                   _loc6_ = 1.5;
  1220.                }
  1221.                _loc1_.x += _loc3_;
  1222.                _loc1_.y += _loc4_;
  1223.                _loc1_.normalize(_loc6_);
  1224.                if(_loc5_ <= _loc6_ * _loc6_ * 2)
  1225.                {
  1226.                   this.iFBub.prVisible = false;
  1227.                   if(!iBang)
  1228.                   {
  1229.                      ++this.iBubbleCount;
  1230.                   }
  1231.                   _loc2_.prCInd = iFBub.prCInd;
  1232.                   return false;
  1233.                }
  1234.             }
  1235.          }
  1236.          return true;
  1237.       }
  1238.       
  1239.       private function FieldIsAllStates(param1:int) : Boolean
  1240.       {
  1241.          var _loc2_:int = 0;
  1242.          var _loc3_:int = 0;
  1243.          var _loc4_:OBubble = null;
  1244.          _loc2_ = 0;
  1245.          while(_loc2_ < OField.iFRows)
  1246.          {
  1247.             _loc3_ = 0;
  1248.             while(_loc3_ < OField.iFCols)
  1249.             {
  1250.                if((_loc4_ = this.iField[_loc2_][_loc3_]).prCInd >= 0)
  1251.                {
  1252.                   if(_loc4_.State != param1)
  1253.                   {
  1254.                      return false;
  1255.                   }
  1256.                }
  1257.                _loc3_++;
  1258.             }
  1259.             _loc2_++;
  1260.          }
  1261.          return true;
  1262.       }
  1263.       
  1264.       private function FieldCalcR(param1:int, param2:int, param3:int) : void
  1265.       {
  1266.          var _loc4_:OBubble = null;
  1267.          if(param1 < 0 || param1 >= OField.iFRows || param2 < 0 || param2 >= OField.iFCols)
  1268.          {
  1269.             return;
  1270.          }
  1271.          if((_loc4_ = this.iField[param1][param2]).prCInd != param3 || Boolean(_loc4_.prType))
  1272.          {
  1273.             return;
  1274.          }
  1275.          _loc4_.prType = this.iBangCount++ + 1;
  1276.          this.iNewField[param1][param2] = -1;
  1277.          if(param1 % 2 == 0)
  1278.          {
  1279.             FieldCalcR(param1 - 1,param2 - 1,param3);
  1280.             FieldCalcR(param1 - 1,param2,param3);
  1281.             FieldCalcR(param1,param2 - 1,param3);
  1282.             FieldCalcR(param1,param2 + 1,param3);
  1283.             FieldCalcR(param1 + 1,param2 - 1,param3);
  1284.             FieldCalcR(param1 + 1,param2,param3);
  1285.          }
  1286.          else
  1287.          {
  1288.             FieldCalcR(param1 - 1,param2,param3);
  1289.             FieldCalcR(param1 - 1,param2 + 1,param3);
  1290.             FieldCalcR(param1,param2 - 1,param3);
  1291.             FieldCalcR(param1,param2 + 1,param3);
  1292.             FieldCalcR(param1 + 1,param2,param3);
  1293.             FieldCalcR(param1 + 1,param2 + 1,param3);
  1294.          }
  1295.       }
  1296.       
  1297.       public function set prRecord(param1:String) : void
  1298.       {
  1299.          var _loc2_:Number = NaN;
  1300.          var _loc3_:Number = NaN;
  1301.          this.iRecord.prStr = param1;
  1302.          if(param1)
  1303.          {
  1304.             this.iRecord.ReadStart();
  1305.             this.iRTime = this.iRecord.ReadTime() * 200;
  1306.             iMx = this.iRecord.ReadCoord();
  1307.             iMy = this.iRecord.ReadCoord();
  1308.             if(iCursor != null)
  1309.             {
  1310.                _loc2_ = iMx * this.iRect.width / iRRect.width;
  1311.                _loc3_ = iMy * this.iRect.height / iRRect.height;
  1312.                iDir = new Point((this.prX + _loc2_ - iCursor.prX) / iRTime,(this.prY + _loc3_ - iCursor.prY) / iRTime);
  1313.             }
  1314.          }
  1315.          else
  1316.          {
  1317.             this.iRTime = -1;
  1318.          }
  1319.       }
  1320.       
  1321.       public function NewLevel(param1:int, param2:Array = null) : void
  1322.       {
  1323.          var _loc3_:int = 0;
  1324.          var _loc4_:Array = null;
  1325.          var _loc5_:int = 0;
  1326.          var _loc6_:int = 0;
  1327.          var _loc7_:int = 0;
  1328.          this.iBubbleCount = 0;
  1329.          _loc3_ = param1 < OField.iLevels.length ? param1 : int(param1 % OField.iLevels.length);
  1330.          if(_loc3_ >= 0)
  1331.          {
  1332.             _loc4_ = OField.iLevels[_loc3_];
  1333.          }
  1334.          else
  1335.          {
  1336.             _loc4_ = param2;
  1337.          }
  1338.          this.iMaxColors = _loc4_[0][0];
  1339.          if(_loc4_[0].length > 2 && _loc3_ >= 0)
  1340.          {
  1341.             this.iRandomP = _loc4_[0][2] + 5 * Math.floor(param1 / OField.iLevels.length);
  1342.          }
  1343.          else
  1344.          {
  1345.             this.iRandomP = _loc4_[0][2];
  1346.          }
  1347.          this.iCIndexes = _loc4_[1];
  1348.          this.iColors = new Array();
  1349.          _loc5_ = 0;
  1350.          while(_loc5_ < this.iMaxColors)
  1351.          {
  1352.             this.iColors[_loc5_] = this.iCIndexes[_loc5_];
  1353.             _loc5_++;
  1354.          }
  1355.          this.iScorePurBubble = (ClusterzL.iGAME.prLevel + 1) * 10;
  1356.          if(param2 == null)
  1357.          {
  1358.             this.iRand.SeedRand(_loc4_[2][this.prGameIndex]);
  1359.          }
  1360.          else
  1361.          {
  1362.             this.iRand.SeedRand(_loc4_[2][0]);
  1363.          }
  1364.          if(this.iBang)
  1365.          {
  1366.             this.iRecord.WriteStart();
  1367.          }
  1368.          _loc6_ = 0;
  1369.          _loc7_ = 0;
  1370.          _loc6_ = 0;
  1371.          while(_loc6_ < OField.iFRows)
  1372.          {
  1373.             _loc7_ = 0;
  1374.             while(_loc7_ < OField.iFCols)
  1375.             {
  1376.                this.iField[_loc6_][_loc7_].prCInd = -1;
  1377.                this.iField[_loc6_][_loc7_].prRadius = this.iRadius;
  1378.                _loc7_++;
  1379.             }
  1380.             _loc6_++;
  1381.          }
  1382.          _loc6_ = 3;
  1383.          while(_loc6_ < _loc4_.length)
  1384.          {
  1385.             _loc7_ = 0;
  1386.             while(_loc7_ < _loc4_[_loc6_].length)
  1387.             {
  1388.                switch(_loc4_[_loc6_][_loc7_])
  1389.                {
  1390.                   case 9:
  1391.                      this.iField[_loc6_ - 3][_loc7_].prCInd = this.prNextColor;
  1392.                      ++this.iBubbleCount;
  1393.                      break;
  1394.                   case 0:
  1395.                      break;
  1396.                   case 8:
  1397.                      this.iField[_loc6_ - 3][_loc7_].prCInd = OBubble.iColorsCount - 1;
  1398.                      break;
  1399.                   default:
  1400.                      if(_loc4_[_loc6_][_loc7_] <= iColors.length)
  1401.                      {
  1402.                         this.iField[_loc6_ - 3][_loc7_].prCInd = this.iColors[_loc4_[_loc6_][_loc7_] - 1];
  1403.                         ++this.iBubbleCount;
  1404.                      }
  1405.                      break;
  1406.                }
  1407.                _loc7_++;
  1408.             }
  1409.             _loc6_++;
  1410.          }
  1411.          this.iFBub.prCInd = this.prNextColor;
  1412.          this.iNBub.prCInd = this.prNextColor;
  1413.          this.iBangCount = 3;
  1414.          if(this.iCounter)
  1415.          {
  1416.             this.iCounter.prValue = 0;
  1417.          }
  1418.          this.State = stShowField;
  1419.       }
  1420.       
  1421.       public function set prCursor(param1:OCursor) : void
  1422.       {
  1423.          this.iCursor = param1;
  1424.       }
  1425.       
  1426.       private function ColorPresent(param1:int) : Boolean
  1427.       {
  1428.          var _loc2_:int = 0;
  1429.          _loc2_ = 0;
  1430.          while(_loc2_ < this.iColors.length)
  1431.          {
  1432.             if(this.iColors[_loc2_] == param1)
  1433.             {
  1434.                return true;
  1435.             }
  1436.             _loc2_++;
  1437.          }
  1438.          return false;
  1439.       }
  1440.    }
  1441. }
  1442.