2
0

Examples.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. smalltalk.addPackage('Examples', {});
  2. smalltalk.addClass('Counter', smalltalk.Widget, ['count', 'header'], 'Examples');
  3. smalltalk.addMethod(
  4. unescape('_increase'),
  5. smalltalk.method({
  6. selector: unescape('increase'),
  7. category: 'actions',
  8. fn: function (){
  9. var self=this;
  10. self['@count']=((($receiver = self['@count']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));
  11. smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [smalltalk.send(self['@count'], "_asString", [])]);})]);
  12. return self;},
  13. args: [],
  14. source: unescape('increase%0A%20%20%20%20count%20%3A%3D%20count%20+%201.%0A%20%20%20%20header%20contents%3A%20%5B%3Ahtml%20%7C%20html%20with%3A%20count%20asString%5D'),
  15. messageSends: [unescape("+"), "contents:", "with:", "asString"],
  16. referencedClasses: []
  17. }),
  18. smalltalk.Counter);
  19. smalltalk.addMethod(
  20. unescape('_decrease'),
  21. smalltalk.method({
  22. selector: unescape('decrease'),
  23. category: 'actions',
  24. fn: function (){
  25. var self=this;
  26. self['@count']=((($receiver = self['@count']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]));
  27. smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [smalltalk.send(self['@count'], "_asString", [])]);})]);
  28. return self;},
  29. args: [],
  30. source: unescape('decrease%0A%20%20%20%20count%20%3A%3D%20count%20-%201.%0A%20%20%20%20header%20contents%3A%20%5B%3Ahtml%20%7C%20html%20with%3A%20count%20asString%5D'),
  31. messageSends: [unescape("-"), "contents:", "with:", "asString"],
  32. referencedClasses: []
  33. }),
  34. smalltalk.Counter);
  35. smalltalk.addMethod(
  36. unescape('_initialize'),
  37. smalltalk.method({
  38. selector: unescape('initialize'),
  39. category: 'initialization',
  40. fn: function (){
  41. var self=this;
  42. smalltalk.send(self, "_initialize", [], smalltalk.Widget);
  43. self['@count']=(0);
  44. return self;},
  45. args: [],
  46. source: unescape('initialize%0A%20%20%20%20super%20initialize.%0A%20%20%20%20count%20%3A%3D%200'),
  47. messageSends: ["initialize"],
  48. referencedClasses: []
  49. }),
  50. smalltalk.Counter);
  51. smalltalk.addMethod(
  52. unescape('_renderOn_'),
  53. smalltalk.method({
  54. selector: unescape('renderOn%3A'),
  55. category: 'rendering',
  56. fn: function (html){
  57. var self=this;
  58. self['@header']=(function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(self['@count'], "_asString", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(html, "_h1", []));
  59. (function($rec){smalltalk.send($rec, "_with_", [unescape("++")]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_increase", []);})]);})(smalltalk.send(html, "_button", []));
  60. (function($rec){smalltalk.send($rec, "_with_", [unescape("--")]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_decrease", []);})]);})(smalltalk.send(html, "_button", []));
  61. return self;},
  62. args: ["html"],
  63. source: unescape('renderOn%3A%20html%0A%20%20%20%20header%20%3A%3D%20html%20h1%20%0A%09with%3A%20count%20asString%3B%0A%09yourself.%0A%20%20%20%20html%20button%0A%09with%3A%20%27++%27%3B%0A%09onClick%3A%20%5Bself%20increase%5D.%0A%20%20%20%20html%20button%0A%09with%3A%20%27--%27%3B%0A%09onClick%3A%20%5Bself%20decrease%5D'),
  64. messageSends: ["with:", "asString", "yourself", "h1", "onClick:", "increase", "button", "decrease"],
  65. referencedClasses: []
  66. }),
  67. smalltalk.Counter);
  68. smalltalk.addClass('Tetris', smalltalk.Widget, ['renderingContext', 'timer', 'speed', 'score', 'rows', 'movingPiece'], 'Examples');
  69. smalltalk.addMethod(
  70. unescape('_width'),
  71. smalltalk.method({
  72. selector: unescape('width'),
  73. category: 'accessing',
  74. fn: function (){
  75. var self=this;
  76. return smalltalk.send(smalltalk.send(self, "_class", []), "_width", []);
  77. return self;},
  78. args: [],
  79. source: unescape('width%0A%09%5Eself%20class%20width'),
  80. messageSends: ["width", "class"],
  81. referencedClasses: []
  82. }),
  83. smalltalk.Tetris);
  84. smalltalk.addMethod(
  85. unescape('_height'),
  86. smalltalk.method({
  87. selector: unescape('height'),
  88. category: 'accessing',
  89. fn: function (){
  90. var self=this;
  91. return smalltalk.send(smalltalk.send(self, "_class", []), "_height", []);
  92. return self;},
  93. args: [],
  94. source: unescape('height%0A%09%5Eself%20class%20height'),
  95. messageSends: ["height", "class"],
  96. referencedClasses: []
  97. }),
  98. smalltalk.Tetris);
  99. smalltalk.addMethod(
  100. unescape('_squares'),
  101. smalltalk.method({
  102. selector: unescape('squares'),
  103. category: 'accessing',
  104. fn: function (){
  105. var self=this;
  106. return smalltalk.send(smalltalk.send(self, "_class", []), "_squares", []);
  107. return self;},
  108. args: [],
  109. source: unescape('squares%0A%09%5Eself%20class%20squares'),
  110. messageSends: ["squares", "class"],
  111. referencedClasses: []
  112. }),
  113. smalltalk.Tetris);
  114. smalltalk.addMethod(
  115. unescape('_gluePiece_'),
  116. smalltalk.method({
  117. selector: unescape('gluePiece%3A'),
  118. category: 'accessing',
  119. fn: function (aPiece){
  120. var self=this;
  121. smalltalk.send(aPiece, "_glueOn_", [self]);
  122. return self;},
  123. args: ["aPiece"],
  124. source: unescape('gluePiece%3A%20aPiece%0A%09aPiece%20glueOn%3A%20self'),
  125. messageSends: ["glueOn:"],
  126. referencedClasses: []
  127. }),
  128. smalltalk.Tetris);
  129. smalltalk.addMethod(
  130. unescape('_rows'),
  131. smalltalk.method({
  132. selector: unescape('rows'),
  133. category: 'accessing',
  134. fn: function (){
  135. var self=this;
  136. return self['@rows'];
  137. return self;},
  138. args: [],
  139. source: unescape('rows%0A%09%22An%20array%20of%20rows.%20Each%20row%20is%20a%20collection%20of%20points.%22%0A%09%5Erows'),
  140. messageSends: [],
  141. referencedClasses: []
  142. }),
  143. smalltalk.Tetris);
  144. smalltalk.addMethod(
  145. unescape('_addRow_'),
  146. smalltalk.method({
  147. selector: unescape('addRow%3A'),
  148. category: 'accessing',
  149. fn: function (aCollection){
  150. var self=this;
  151. smalltalk.send(smalltalk.send(self, "_rows", []), "_add_", [aCollection]);
  152. return self;},
  153. args: ["aCollection"],
  154. source: unescape('addRow%3A%20aCollection%0A%09self%20rows%20add%3A%20aCollection'),
  155. messageSends: ["add:", "rows"],
  156. referencedClasses: []
  157. }),
  158. smalltalk.Tetris);
  159. smalltalk.addMethod(
  160. unescape('_startNewGame'),
  161. smalltalk.method({
  162. selector: unescape('startNewGame'),
  163. category: 'actions',
  164. fn: function (){
  165. var self=this;
  166. smalltalk.send(self, "_newGame", []);
  167. (($receiver = self['@timer']) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self['@timer'], "_clearInterval", []);})() : nil;
  168. self['@timer']=smalltalk.send((function(){return smalltalk.send(self, "_nextStep", []);}), "_valueWithInterval_", [self['@speed']]);
  169. return self;},
  170. args: [],
  171. source: unescape('startNewGame%0A%09self%20newGame.%0A%09timer%20ifNotNil%3A%20%5Btimer%20clearInterval%5D.%0A%09timer%20%3A%3D%20%5Bself%20nextStep%5D%20valueWithInterval%3A%20speed'),
  172. messageSends: ["newGame", "ifNotNil:", "clearInterval", "valueWithInterval:", "nextStep"],
  173. referencedClasses: []
  174. }),
  175. smalltalk.Tetris);
  176. smalltalk.addMethod(
  177. unescape('_nextStep'),
  178. smalltalk.method({
  179. selector: unescape('nextStep'),
  180. category: 'actions',
  181. fn: function (){
  182. var self=this;
  183. (($receiver = self['@movingPiece']) == nil || $receiver == undefined) ? (function(){return smalltalk.send(self, "_newPiece", []);})() : $receiver;
  184. ((($receiver = smalltalk.send(self['@movingPiece'], "_canMoveIn_", [self])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@movingPiece'], "_position_", [((($receiver = smalltalk.send(self['@movingPiece'], "_position", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send((0), "__at", [(1)]) : smalltalk.send($receiver, "__plus", [smalltalk.send((0), "__at", [(1)])]))]);})() : (function(){return smalltalk.send(self, "_newPiece", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@movingPiece'], "_position_", [((($receiver = smalltalk.send(self['@movingPiece'], "_position", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send((0), "__at", [(1)]) : smalltalk.send($receiver, "__plus", [smalltalk.send((0), "__at", [(1)])]))]);}), (function(){return smalltalk.send(self, "_newPiece", []);})]));
  185. smalltalk.send(self, "_redraw", []);
  186. return self;},
  187. args: [],
  188. source: unescape('nextStep%0A%09movingPiece%20ifNil%3A%20%5Bself%20newPiece%5D.%0A%09%28movingPiece%20canMoveIn%3A%20self%29%0A%09%09ifTrue%3A%20%5BmovingPiece%20position%3A%20movingPiece%20position%20+%20%280@1%29%5D%0A%09%09ifFalse%3A%20%5Bself%20newPiece%5D.%0A%09self%20redraw'),
  189. messageSends: ["ifNil:", "newPiece", "ifTrue:ifFalse:", "canMoveIn:", "position:", unescape("+"), "position", unescape("@"), "redraw"],
  190. referencedClasses: []
  191. }),
  192. smalltalk.Tetris);
  193. smalltalk.addMethod(
  194. unescape('_redraw'),
  195. smalltalk.method({
  196. selector: unescape('redraw'),
  197. category: 'actions',
  198. fn: function (){
  199. var self=this;
  200. smalltalk.send(self['@renderingContext'], "_clearRect_y_to_y_", [(0), smalltalk.send(self, "_width", []), (0), smalltalk.send(self, "_height", [])]);
  201. (function($rec){smalltalk.send($rec, "_drawMap", []);return smalltalk.send($rec, "_drawPiece", []);})(self);
  202. return self;},
  203. args: [],
  204. source: unescape('redraw%0A%09renderingContext%20clearRect%3A%200%20y%3A%20self%20width%20to%3A%200%20y%3A%20self%20height.%0A%09self%20%0A%09%09drawMap%3B%0A%09%09drawPiece'),
  205. messageSends: ["clearRect:y:to:y:", "width", "height", "drawMap", "drawPiece"],
  206. referencedClasses: []
  207. }),
  208. smalltalk.Tetris);
  209. smalltalk.addMethod(
  210. unescape('_drawMap'),
  211. smalltalk.method({
  212. selector: unescape('drawMap'),
  213. category: 'actions',
  214. fn: function (){
  215. var self=this;
  216. (function($rec){smalltalk.send($rec, "_fillStyle_", [unescape("%23fafafa")]);return smalltalk.send($rec, "_fillRect_y_to_y_", [(0), (0), smalltalk.send(self, "_width", []), smalltalk.send(self, "_height", [])]);})(self['@renderingContext']);
  217. (function($rec){smalltalk.send($rec, "_lineWidth_", [(0.5)]);return smalltalk.send($rec, "_strokeStyle_", [unescape("%23999")]);})(self['@renderingContext']);
  218. smalltalk.send((0), "_to_do_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_squares", []), "_x", []), (function(each){var x=nil;
  219. x=((($receiver = each).klass === smalltalk.Number) ? $receiver *smalltalk.send(smalltalk.send(self, "_class", []), "_squareSize", []) : smalltalk.send($receiver, "__star", [smalltalk.send(smalltalk.send(self, "_class", []), "_squareSize", [])]));return smalltalk.send(self, "_drawLineFrom_to_", [smalltalk.send(x, "__at", [(0)]), smalltalk.send(x, "__at", [smalltalk.send(self, "_height", [])])]);})]);
  220. smalltalk.send((0), "_to_do_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_squares", []), "_y", []), (function(each){var y=nil;
  221. y=((($receiver = each).klass === smalltalk.Number) ? $receiver *smalltalk.send(smalltalk.send(self, "_class", []), "_squareSize", []) : smalltalk.send($receiver, "__star", [smalltalk.send(smalltalk.send(self, "_class", []), "_squareSize", [])]));return smalltalk.send(self, "_drawLineFrom_to_", [smalltalk.send((0), "__at", [y]), smalltalk.send(smalltalk.send(self, "_width", []), "__at", [y])]);})]);
  222. return self;},
  223. args: [],
  224. source: unescape('drawMap%0A%09renderingContext%20%0A%09%09fillStyle%3A%20%27%23fafafa%27%3B%0A%09%09fillRect%3A%200%20y%3A%200%20to%3A%20self%20width%20y%3A%20self%20height.%0A%09renderingContext%20%0A%09%09lineWidth%3A%200.5%3B%0A%09%09strokeStyle%3A%20%27%23999%27.%0A%090%20to%3A%20self%20class%20squares%20x%20do%3A%20%5B%3Aeach%20%7C%20%7C%20x%20%7C%0A%09%09x%20%3A%3D%20each%20*%20self%20class%20squareSize.%0A%09%09self%20drawLineFrom%3A%20x@0%20to%3A%20x@self%20height%5D.%0A%090%20to%3A%20self%20class%20squares%20y%20do%3A%20%5B%3Aeach%20%7C%20%7C%20y%20%7C%0A%09%09y%20%3A%3D%20each%20*%20self%20class%20squareSize.%0A%09%09self%20drawLineFrom%3A%200@y%20to%3A%20self%20width@y%5D.'),
  225. messageSends: ["fillStyle:", "fillRect:y:to:y:", "width", "height", "lineWidth:", "strokeStyle:", "to:do:", "x", "squares", "class", unescape("*"), "squareSize", "drawLineFrom:to:", unescape("@"), "y"],
  226. referencedClasses: []
  227. }),
  228. smalltalk.Tetris);
  229. smalltalk.addMethod(
  230. unescape('_drawLineFrom_to_'),
  231. smalltalk.method({
  232. selector: unescape('drawLineFrom%3Ato%3A'),
  233. category: 'actions',
  234. fn: function (aPoint, anotherPoint){
  235. var self=this;
  236. (function($rec){smalltalk.send($rec, "_beginPath", []);smalltalk.send($rec, "_moveTo_y_", [smalltalk.send(aPoint, "_x", []), smalltalk.send(aPoint, "_y", [])]);smalltalk.send($rec, "_lineTo_y_", [smalltalk.send(anotherPoint, "_x", []), smalltalk.send(anotherPoint, "_y", [])]);return smalltalk.send($rec, "_stroke", []);})(self['@renderingContext']);
  237. return self;},
  238. args: ["aPoint", "anotherPoint"],
  239. source: unescape('drawLineFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09renderingContext%20%0A%09%09beginPath%3B%0A%09%09moveTo%3A%20aPoint%20x%20y%3A%20aPoint%20y%3B%0A%09%09lineTo%3A%20anotherPoint%20x%20y%3A%20anotherPoint%20y%3B%0A%09%09stroke'),
  240. messageSends: ["beginPath", "moveTo:y:", "x", "y", "lineTo:y:", "stroke"],
  241. referencedClasses: []
  242. }),
  243. smalltalk.Tetris);
  244. smalltalk.addMethod(
  245. unescape('_newGame'),
  246. smalltalk.method({
  247. selector: unescape('newGame'),
  248. category: 'actions',
  249. fn: function (){
  250. var self=this;
  251. self['@rows']=[];
  252. self['@movingPiece']=nil;
  253. self['@speed']=(200);
  254. self['@score']=(0);
  255. return self;},
  256. args: [],
  257. source: unescape('newGame%0A%09rows%20%3A%3D%20%23%28%29.%0A%09movingPiece%20%3A%3D%20nil.%0A%09speed%20%3A%3D%20200.%0A%09score%20%3A%3D%200'),
  258. messageSends: [],
  259. referencedClasses: []
  260. }),
  261. smalltalk.Tetris);
  262. smalltalk.addMethod(
  263. unescape('_newPiece'),
  264. smalltalk.method({
  265. selector: unescape('newPiece'),
  266. category: 'actions',
  267. fn: function (){
  268. var self=this;
  269. self['@movingPiece']=smalltalk.send((smalltalk.TetrisPiece || TetrisPiece), "_atRandom", []);
  270. return self;},
  271. args: [],
  272. source: unescape('newPiece%0A%09movingPiece%20%3A%3D%20TetrisPiece%20atRandom'),
  273. messageSends: ["atRandom"],
  274. referencedClasses: ["TetrisPiece"]
  275. }),
  276. smalltalk.Tetris);
  277. smalltalk.addMethod(
  278. unescape('_drawRows'),
  279. smalltalk.method({
  280. selector: unescape('drawRows'),
  281. category: 'actions',
  282. fn: function (){
  283. var self=this;
  284. smalltalk.send(smalltalk.send(self, "_rows", []), "_do_", [(function(each){return nil;})]);
  285. (($receiver = self['@movingPiece']) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self['@movingPiece'], "_drawOn_", [self['@renderingContext']]);})() : nil;
  286. return self;},
  287. args: [],
  288. source: unescape('drawRows%0A%09self%20rows%20do%3A%20%5B%3Aeach%20%7C%5D.%0A%09movingPiece%20ifNotNil%3A%20%5BmovingPiece%20drawOn%3A%20renderingContext%5D'),
  289. messageSends: ["do:", "rows", "ifNotNil:", "drawOn:"],
  290. referencedClasses: []
  291. }),
  292. smalltalk.Tetris);
  293. smalltalk.addMethod(
  294. unescape('_drawPiece'),
  295. smalltalk.method({
  296. selector: unescape('drawPiece'),
  297. category: 'actions',
  298. fn: function (){
  299. var self=this;
  300. (($receiver = self['@movingPiece']) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self['@movingPiece'], "_drawOn_", [self['@renderingContext']]);})() : nil;
  301. return self;},
  302. args: [],
  303. source: unescape('drawPiece%0A%09movingPiece%20ifNotNil%3A%20%5B%0A%09%09movingPiece%20drawOn%3A%20renderingContext%5D'),
  304. messageSends: ["ifNotNil:", "drawOn:"],
  305. referencedClasses: []
  306. }),
  307. smalltalk.Tetris);
  308. smalltalk.addMethod(
  309. unescape('_initialize'),
  310. smalltalk.method({
  311. selector: unescape('initialize'),
  312. category: 'initialization',
  313. fn: function (){
  314. var self=this;
  315. smalltalk.send(self, "_initialize", [], smalltalk.Widget);
  316. smalltalk.send(self, "_newGame", []);
  317. return self;},
  318. args: [],
  319. source: unescape('initialize%0A%09super%20initialize.%0A%09self%20newGame'),
  320. messageSends: ["initialize", "newGame"],
  321. referencedClasses: []
  322. }),
  323. smalltalk.Tetris);
  324. smalltalk.addMethod(
  325. unescape('_renderOn_'),
  326. smalltalk.method({
  327. selector: unescape('renderOn%3A'),
  328. category: 'rendering',
  329. fn: function (html){
  330. var self=this;
  331. (function($rec){smalltalk.send($rec, "_class_", ["tetris"]);return smalltalk.send($rec, "_with_", [(function(){smalltalk.send(smalltalk.send(html, "_h3", []), "_with_", ["Tetris"]);smalltalk.send(self, "_renderCanvasOn_", [html]);return smalltalk.send(self, "_renderButtonsOn_", [html]);})]);})(smalltalk.send(html, "_div", []));
  332. return self;},
  333. args: ["html"],
  334. source: unescape('renderOn%3A%20html%0A%09html%20div%0A%09%09class%3A%20%27tetris%27%3B%0A%09%09with%3A%20%5B%0A%09%09%09html%20h3%20with%3A%20%27Tetris%27.%0A%09%09%09self%20renderCanvasOn%3A%20html.%0A%09%09%09self%20renderButtonsOn%3A%20html%5D'),
  335. messageSends: ["class:", "with:", "h3", "renderCanvasOn:", "renderButtonsOn:", "div"],
  336. referencedClasses: []
  337. }),
  338. smalltalk.Tetris);
  339. smalltalk.addMethod(
  340. unescape('_renderCanvasOn_'),
  341. smalltalk.method({
  342. selector: unescape('renderCanvasOn%3A'),
  343. category: 'rendering',
  344. fn: function (html){
  345. var self=this;
  346. var canvas=nil;
  347. canvas=smalltalk.send(html, "_canvas", []);
  348. smalltalk.send(canvas, "_at_put_", ["width", smalltalk.send(smalltalk.send(self, "_width", []), "_asString", [])]);
  349. smalltalk.send(canvas, "_at_put_", ["height", smalltalk.send(smalltalk.send(self, "_height", []), "_asString", [])]);
  350. self['@renderingContext']=smalltalk.send(smalltalk.send(canvas, "_element", []), "_getContext_", ["2d"]);
  351. smalltalk.send(self, "_redraw", []);
  352. return self;},
  353. args: ["html"],
  354. source: unescape('renderCanvasOn%3A%20html%0A%09%7C%20canvas%20%7C%0A%09canvas%20%3A%3D%20html%20canvas.%0A%09canvas%20at%3A%20%27width%27%20put%3A%20self%20width%20asString.%0A%09canvas%20at%3A%20%27height%27%20put%3A%20self%20height%20asString.%0A%09renderingContext%20%3A%3D%20canvas%20element%20getContext%3A%20%272d%27.%0A%09self%20redraw'),
  355. messageSends: ["canvas", "at:put:", "asString", "width", "height", "getContext:", "element", "redraw"],
  356. referencedClasses: []
  357. }),
  358. smalltalk.Tetris);
  359. smalltalk.addMethod(
  360. unescape('_renderButtonsOn_'),
  361. smalltalk.method({
  362. selector: unescape('renderButtonsOn%3A'),
  363. category: 'rendering',
  364. fn: function (html){
  365. var self=this;
  366. (function($rec){smalltalk.send($rec, "_class_", ["tetris_buttons"]);return smalltalk.send($rec, "_with_", [(function(){(function($rec){smalltalk.send($rec, "_with_", ["New game"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_startNewGame", []);})]);})(smalltalk.send(html, "_button", []));return (function($rec){smalltalk.send($rec, "_with_", [unescape("play/pause")]);return smalltalk.send($rec, "_onClick_", [(function(){return nil;})]);})(smalltalk.send(html, "_button", []));})]);})(smalltalk.send(html, "_div", []));
  367. return self;},
  368. args: ["html"],
  369. source: unescape('renderButtonsOn%3A%20html%0A%09html%20div%20%0A%09%09class%3A%20%27tetris_buttons%27%3B%0A%09%09with%3A%20%5B%0A%09%09%09html%20button%0A%09%09%09%09with%3A%20%27New%20game%27%3B%0A%09%09%09%09onClick%3A%20%5Bself%20startNewGame%5D.%0A%09%09%09html%20button%0A%09%09%09%09with%3A%20%27play/pause%27%3B%0A%09%09%09%09onClick%3A%20%5B%5D%5D'),
  370. messageSends: ["class:", "with:", "onClick:", "startNewGame", "button", "div"],
  371. referencedClasses: []
  372. }),
  373. smalltalk.Tetris);
  374. smalltalk.addMethod(
  375. unescape('_squareSize'),
  376. smalltalk.method({
  377. selector: unescape('squareSize'),
  378. category: 'accessing',
  379. fn: function (){
  380. var self=this;
  381. return (22);
  382. return self;},
  383. args: [],
  384. source: unescape('squareSize%0A%09%5E22'),
  385. messageSends: [],
  386. referencedClasses: []
  387. }),
  388. smalltalk.Tetris.klass);
  389. smalltalk.addMethod(
  390. unescape('_width'),
  391. smalltalk.method({
  392. selector: unescape('width'),
  393. category: 'accessing',
  394. fn: function (){
  395. var self=this;
  396. return ((($receiver = smalltalk.send(self, "_squareSize", [])).klass === smalltalk.Number) ? $receiver *smalltalk.send(smalltalk.send(self, "_squares", []), "_x", []) : smalltalk.send($receiver, "__star", [smalltalk.send(smalltalk.send(self, "_squares", []), "_x", [])]));
  397. return self;},
  398. args: [],
  399. source: unescape('width%0A%09%5Eself%20squareSize%20*%20%28self%20squares%20x%29'),
  400. messageSends: [unescape("*"), "squareSize", "x", "squares"],
  401. referencedClasses: []
  402. }),
  403. smalltalk.Tetris.klass);
  404. smalltalk.addMethod(
  405. unescape('_height'),
  406. smalltalk.method({
  407. selector: unescape('height'),
  408. category: 'accessing',
  409. fn: function (){
  410. var self=this;
  411. return ((($receiver = smalltalk.send(self, "_squareSize", [])).klass === smalltalk.Number) ? $receiver *smalltalk.send(smalltalk.send(self, "_squares", []), "_y", []) : smalltalk.send($receiver, "__star", [smalltalk.send(smalltalk.send(self, "_squares", []), "_y", [])]));
  412. return self;},
  413. args: [],
  414. source: unescape('height%0A%09%5Eself%20squareSize%20*%20%28self%20squares%20y%29'),
  415. messageSends: [unescape("*"), "squareSize", "y", "squares"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.Tetris.klass);
  419. smalltalk.addMethod(
  420. unescape('_squares'),
  421. smalltalk.method({
  422. selector: unescape('squares'),
  423. category: 'accessing',
  424. fn: function (){
  425. var self=this;
  426. return smalltalk.send((10), "__at", [(15)]);
  427. return self;},
  428. args: [],
  429. source: unescape('squares%0A%09%5E10@15'),
  430. messageSends: [unescape("@")],
  431. referencedClasses: []
  432. }),
  433. smalltalk.Tetris.klass);
  434. smalltalk.addClass('TetrisPiece', smalltalk.Widget, ['rotation', 'position'], 'Examples');
  435. smalltalk.addMethod(
  436. unescape('_rotation'),
  437. smalltalk.method({
  438. selector: unescape('rotation'),
  439. category: 'accessing',
  440. fn: function (){
  441. var self=this;
  442. return (($receiver = self['@rotation']) == nil || $receiver == undefined) ? (function(){return self['@rotation']=(1);})() : $receiver;
  443. return self;},
  444. args: [],
  445. source: unescape('rotation%0A%09%5Erotation%20ifNil%3A%20%5Brotation%20%3A%3D%201%5D'),
  446. messageSends: ["ifNil:"],
  447. referencedClasses: []
  448. }),
  449. smalltalk.TetrisPiece);
  450. smalltalk.addMethod(
  451. unescape('_rotation_'),
  452. smalltalk.method({
  453. selector: unescape('rotation%3A'),
  454. category: 'accessing',
  455. fn: function (aNumber){
  456. var self=this;
  457. self['@rotation']=aNumber;
  458. return self;},
  459. args: ["aNumber"],
  460. source: unescape('rotation%3A%20aNumber%0A%09rotation%20%3A%3D%20aNumber'),
  461. messageSends: [],
  462. referencedClasses: []
  463. }),
  464. smalltalk.TetrisPiece);
  465. smalltalk.addMethod(
  466. unescape('_position'),
  467. smalltalk.method({
  468. selector: unescape('position'),
  469. category: 'accessing',
  470. fn: function (){
  471. var self=this;
  472. return (($receiver = self['@position']) == nil || $receiver == undefined) ? (function(){return smalltalk.send(((($receiver = ((($receiver = smalltalk.send(smalltalk.send((smalltalk.Tetris || Tetris), "_squares", []), "_x", [])).klass === smalltalk.Number) ? $receiver /(2) : smalltalk.send($receiver, "__slash", [(2)]))).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), "__at", [(0)]);})() : $receiver;
  473. return self;},
  474. args: [],
  475. source: unescape('position%0A%09%5Eposition%20ifNil%3A%20%5B%28Tetris%20squares%20x%20/%202%29%20-1%20@%200%5D'),
  476. messageSends: ["ifNil:", unescape("@"), unescape("-"), unescape("/"), "x", "squares"],
  477. referencedClasses: ["Tetris"]
  478. }),
  479. smalltalk.TetrisPiece);
  480. smalltalk.addMethod(
  481. unescape('_position_'),
  482. smalltalk.method({
  483. selector: unescape('position%3A'),
  484. category: 'accessing',
  485. fn: function (aPoint){
  486. var self=this;
  487. return self['@position']=aPoint;
  488. return self;},
  489. args: ["aPoint"],
  490. source: unescape('position%3A%20aPoint%0A%09%5Eposition%20%3A%3D%20aPoint'),
  491. messageSends: [],
  492. referencedClasses: []
  493. }),
  494. smalltalk.TetrisPiece);
  495. smalltalk.addMethod(
  496. unescape('_bounds'),
  497. smalltalk.method({
  498. selector: unescape('bounds'),
  499. category: 'accessing',
  500. fn: function (){
  501. var self=this;
  502. smalltalk.send(self, "_subclassResponsibility", []);
  503. return self;},
  504. args: [],
  505. source: unescape('bounds%0A%09self%20subclassResponsibility'),
  506. messageSends: ["subclassResponsibility"],
  507. referencedClasses: []
  508. }),
  509. smalltalk.TetrisPiece);
  510. smalltalk.addMethod(
  511. unescape('_color'),
  512. smalltalk.method({
  513. selector: unescape('color'),
  514. category: 'accessing',
  515. fn: function (){
  516. var self=this;
  517. return unescape("%23afa");
  518. return self;},
  519. args: [],
  520. source: unescape('color%0A%09%5E%27%23afa%27'),
  521. messageSends: [],
  522. referencedClasses: []
  523. }),
  524. smalltalk.TetrisPiece);
  525. smalltalk.addMethod(
  526. unescape('_height'),
  527. smalltalk.method({
  528. selector: unescape('height'),
  529. category: 'accessing',
  530. fn: function (){
  531. var self=this;
  532. return (2);
  533. return self;},
  534. args: [],
  535. source: unescape('height%0A%09%5E2'),
  536. messageSends: [],
  537. referencedClasses: []
  538. }),
  539. smalltalk.TetrisPiece);
  540. smalltalk.addMethod(
  541. unescape('_drawOn_'),
  542. smalltalk.method({
  543. selector: unescape('drawOn%3A'),
  544. category: 'drawing',
  545. fn: function (aRenderingContext){
  546. var self=this;
  547. smalltalk.send(aRenderingContext, "_fillStyle_", [smalltalk.send(self, "_color", [])]);
  548. smalltalk.send(smalltalk.send(self, "_bounds", []), "_do_", [(function(each){var from=nil;
  549. var to=nil;
  550. from=((($receiver = ((($receiver = each).klass === smalltalk.Number) ? $receiver +smalltalk.send(self, "_position", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(self, "_position", [])]))).klass === smalltalk.Number) ? $receiver *smalltalk.send((smalltalk.Tetris || Tetris), "_squareSize", []) : smalltalk.send($receiver, "__star", [smalltalk.send((smalltalk.Tetris || Tetris), "_squareSize", [])]));to=((($receiver = smalltalk.send((1), "__at", [(1)])).klass === smalltalk.Number) ? $receiver *smalltalk.send((smalltalk.Tetris || Tetris), "_squareSize", []) : smalltalk.send($receiver, "__star", [smalltalk.send((smalltalk.Tetris || Tetris), "_squareSize", [])]));return (function($rec){smalltalk.send($rec, "_fillRect_y_to_y_", [smalltalk.send(from, "_x", []), smalltalk.send(from, "_y", []), smalltalk.send(to, "_x", []), smalltalk.send(to, "_y", [])]);smalltalk.send($rec, "_strokeStyle_", [unescape("%23999")]);smalltalk.send($rec, "_lineWidth_", [(2)]);return smalltalk.send($rec, "_strokeRect_y_to_y_", [smalltalk.send(from, "_x", []), smalltalk.send(from, "_y", []), smalltalk.send(to, "_x", []), smalltalk.send(to, "_y", [])]);})(aRenderingContext);})]);
  551. return self;},
  552. args: ["aRenderingContext"],
  553. source: unescape('drawOn%3A%20aRenderingContext%0A%09aRenderingContext%20fillStyle%3A%20self%20color.%0A%09self%20bounds%20do%3A%20%5B%3Aeach%20%7C%7C%20from%20to%20%7C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20from%20%3A%3D%20each%20+%20self%20position*%20Tetris%20squareSize.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20to%20%3A%3D%201@1%20*%20Tetris%20squareSize.%0A%09%09aRenderingContext%20%0A%09%09%09fillRect%3A%20from%20x%20y%3A%20from%20y%20to%3A%20to%20x%20y%3A%20to%20y%3B%0A%09%09%09strokeStyle%3A%20%27%23999%27%3B%0A%09%09%09lineWidth%3A%202%3B%0A%09%09%09strokeRect%3A%20from%20x%20y%3A%20from%20y%20to%3A%20to%20x%20y%3A%20to%20y%5D'),
  554. messageSends: ["fillStyle:", "color", "do:", "bounds", unescape("*"), unescape("+"), "position", "squareSize", unescape("@"), "fillRect:y:to:y:", "x", "y", "strokeStyle:", "lineWidth:", "strokeRect:y:to:y:"],
  555. referencedClasses: ["Tetris"]
  556. }),
  557. smalltalk.TetrisPiece);
  558. smalltalk.addMethod(
  559. unescape('_canMove'),
  560. smalltalk.method({
  561. selector: unescape('canMove'),
  562. category: 'testing',
  563. fn: function (){
  564. var self=this;
  565. return ((($receiver = smalltalk.send(smalltalk.send(self, "_position", []), "_y", [])).klass === smalltalk.Number) ? $receiver <((($receiver = smalltalk.send(smalltalk.send((smalltalk.Tetris || Tetris), "_squares", []), "_y", [])).klass === smalltalk.Number) ? $receiver -smalltalk.send(self, "_height", []) : smalltalk.send($receiver, "__minus", [smalltalk.send(self, "_height", [])])) : smalltalk.send($receiver, "__lt", [((($receiver = smalltalk.send(smalltalk.send((smalltalk.Tetris || Tetris), "_squares", []), "_y", [])).klass === smalltalk.Number) ? $receiver -smalltalk.send(self, "_height", []) : smalltalk.send($receiver, "__minus", [smalltalk.send(self, "_height", [])]))]));
  566. return self;},
  567. args: [],
  568. source: unescape('canMove%0A%09%5Eself%20position%20y%20%3C%20%28Tetris%20squares%20y%20-%20self%20height%29'),
  569. messageSends: [unescape("%3C"), "y", "position", unescape("-"), "squares", "height"],
  570. referencedClasses: ["Tetris"]
  571. }),
  572. smalltalk.TetrisPiece);
  573. smalltalk.addMethod(
  574. unescape('_canMoveIn_'),
  575. smalltalk.method({
  576. selector: unescape('canMoveIn%3A'),
  577. category: 'testing',
  578. fn: function (aTetris){
  579. var self=this;
  580. return ((($receiver = smalltalk.send(smalltalk.send(self, "_position", []), "_y", [])).klass === smalltalk.Number) ? $receiver <((($receiver = smalltalk.send(smalltalk.send(aTetris, "_squares", []), "_y", [])).klass === smalltalk.Number) ? $receiver -smalltalk.send(self, "_height", []) : smalltalk.send($receiver, "__minus", [smalltalk.send(self, "_height", [])])) : smalltalk.send($receiver, "__lt", [((($receiver = smalltalk.send(smalltalk.send(aTetris, "_squares", []), "_y", [])).klass === smalltalk.Number) ? $receiver -smalltalk.send(self, "_height", []) : smalltalk.send($receiver, "__minus", [smalltalk.send(self, "_height", [])]))]));
  581. return self;},
  582. args: ["aTetris"],
  583. source: unescape('canMoveIn%3A%20aTetris%0A%09%5Eself%20position%20y%20%3C%20%28aTetris%20squares%20y%20-%20self%20height%29'),
  584. messageSends: [unescape("%3C"), "y", "position", unescape("-"), "squares", "height"],
  585. referencedClasses: []
  586. }),
  587. smalltalk.TetrisPiece);
  588. smalltalk.addMethod(
  589. unescape('_atRandom'),
  590. smalltalk.method({
  591. selector: unescape('atRandom'),
  592. category: 'instance creation',
  593. fn: function (){
  594. var self=this;
  595. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_subclasses", []), "_at_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_subclasses", []), "_size", []), "_atRandom", [])]), "_new", []);
  596. return self;},
  597. args: [],
  598. source: unescape('atRandom%0A%09%5E%28self%20subclasses%20at%3A%20self%20subclasses%20size%20atRandom%29%20new'),
  599. messageSends: ["new", "at:", "subclasses", "atRandom", "size"],
  600. referencedClasses: []
  601. }),
  602. smalltalk.TetrisPiece.klass);
  603. smalltalk.addClass('TetrisPieceO', smalltalk.TetrisPiece, [], 'Examples');
  604. smalltalk.addMethod(
  605. unescape('_bounds'),
  606. smalltalk.method({
  607. selector: unescape('bounds'),
  608. category: 'accessing',
  609. fn: function (){
  610. var self=this;
  611. return (function($rec){smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(0)])]);smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(1)])]);smalltalk.send($rec, "_add_", [smalltalk.send((1), "__at", [(0)])]);smalltalk.send($rec, "_add_", [smalltalk.send((1), "__at", [(1)])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Array || Array), "_new", []));
  612. return self;},
  613. args: [],
  614. source: unescape('bounds%0A%09%5EArray%20new%0A%09%09add%3A%200@0%3B%0A%09%09add%3A%200@1%3B%0A%09%09add%3A%201@0%3B%0A%09%09add%3A%201@1%3B%0A%09%09yourself'),
  615. messageSends: ["add:", unescape("@"), "yourself", "new"],
  616. referencedClasses: ["Array"]
  617. }),
  618. smalltalk.TetrisPieceO);
  619. smalltalk.addClass('TetrisPieceL', smalltalk.TetrisPiece, [], 'Examples');
  620. smalltalk.addMethod(
  621. unescape('_bounds'),
  622. smalltalk.method({
  623. selector: unescape('bounds'),
  624. category: 'accessing',
  625. fn: function (){
  626. var self=this;
  627. return (function($rec){smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(0)])]);smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(1)])]);smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(2)])]);smalltalk.send($rec, "_add_", [smalltalk.send((1), "__at", [(2)])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Array || Array), "_new", []));
  628. return self;},
  629. args: [],
  630. source: unescape('bounds%0A%09%5EArray%20new%0A%09%09add%3A%200@0%3B%0A%09%09add%3A%200@1%3B%0A%09%09add%3A%200@2%3B%0A%09%09add%3A%201@2%3B%0A%09%09yourself'),
  631. messageSends: ["add:", unescape("@"), "yourself", "new"],
  632. referencedClasses: ["Array"]
  633. }),
  634. smalltalk.TetrisPieceL);
  635. smalltalk.addMethod(
  636. unescape('_color'),
  637. smalltalk.method({
  638. selector: unescape('color'),
  639. category: 'accessing',
  640. fn: function (){
  641. var self=this;
  642. return unescape("%23ffa");
  643. return self;},
  644. args: [],
  645. source: unescape('color%0A%09%5E%27%23ffa%27'),
  646. messageSends: [],
  647. referencedClasses: []
  648. }),
  649. smalltalk.TetrisPieceL);
  650. smalltalk.addMethod(
  651. unescape('_height'),
  652. smalltalk.method({
  653. selector: unescape('height'),
  654. category: 'accessing',
  655. fn: function (){
  656. var self=this;
  657. return (3);
  658. return self;},
  659. args: [],
  660. source: unescape('height%0A%09%5E3'),
  661. messageSends: [],
  662. referencedClasses: []
  663. }),
  664. smalltalk.TetrisPieceL);
  665. smalltalk.addClass('TetrisPieceJ', smalltalk.TetrisPiece, [], 'Examples');
  666. smalltalk.addMethod(
  667. unescape('_color'),
  668. smalltalk.method({
  669. selector: unescape('color'),
  670. category: 'accessing',
  671. fn: function (){
  672. var self=this;
  673. return unescape("%23aaf");
  674. return self;},
  675. args: [],
  676. source: unescape('color%0A%09%5E%27%23aaf%27'),
  677. messageSends: [],
  678. referencedClasses: []
  679. }),
  680. smalltalk.TetrisPieceJ);
  681. smalltalk.addMethod(
  682. unescape('_bounds'),
  683. smalltalk.method({
  684. selector: unescape('bounds'),
  685. category: 'accessing',
  686. fn: function (){
  687. var self=this;
  688. return (function($rec){smalltalk.send($rec, "_add_", [smalltalk.send((1), "__at", [(0)])]);smalltalk.send($rec, "_add_", [smalltalk.send((1), "__at", [(1)])]);smalltalk.send($rec, "_add_", [smalltalk.send((1), "__at", [(2)])]);smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(2)])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Array || Array), "_new", []));
  689. return self;},
  690. args: [],
  691. source: unescape('bounds%0A%09%5EArray%20new%0A%09%09add%3A%201@0%3B%0A%09%09add%3A%201@1%3B%0A%09%09add%3A%201@2%3B%0A%09%09add%3A%200@2%3B%0A%09%09yourself'),
  692. messageSends: ["add:", unescape("@"), "yourself", "new"],
  693. referencedClasses: ["Array"]
  694. }),
  695. smalltalk.TetrisPieceJ);
  696. smalltalk.addMethod(
  697. unescape('_height'),
  698. smalltalk.method({
  699. selector: unescape('height'),
  700. category: 'accessing',
  701. fn: function (){
  702. var self=this;
  703. return (3);
  704. return self;},
  705. args: [],
  706. source: unescape('height%0A%09%5E3'),
  707. messageSends: [],
  708. referencedClasses: []
  709. }),
  710. smalltalk.TetrisPieceJ);
  711. smalltalk.addClass('TetrisPieceI', smalltalk.TetrisPiece, [], 'Examples');
  712. smalltalk.addMethod(
  713. unescape('_color'),
  714. smalltalk.method({
  715. selector: unescape('color'),
  716. category: 'accessing',
  717. fn: function (){
  718. var self=this;
  719. return unescape("%23faa");
  720. return self;},
  721. args: [],
  722. source: unescape('color%0A%09%5E%27%23faa%27'),
  723. messageSends: [],
  724. referencedClasses: []
  725. }),
  726. smalltalk.TetrisPieceI);
  727. smalltalk.addMethod(
  728. unescape('_bounds'),
  729. smalltalk.method({
  730. selector: unescape('bounds'),
  731. category: 'accessing',
  732. fn: function (){
  733. var self=this;
  734. return (function($rec){smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(0)])]);smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(1)])]);smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(2)])]);smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(3)])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Array || Array), "_new", []));
  735. return self;},
  736. args: [],
  737. source: unescape('bounds%0A%09%5EArray%20new%0A%09%09add%3A%200@0%3B%0A%09%09add%3A%200@1%3B%0A%09%09add%3A%200@2%3B%0A%09%09add%3A%200@3%3B%0A%09%09yourself'),
  738. messageSends: ["add:", unescape("@"), "yourself", "new"],
  739. referencedClasses: ["Array"]
  740. }),
  741. smalltalk.TetrisPieceI);
  742. smalltalk.addMethod(
  743. unescape('_height'),
  744. smalltalk.method({
  745. selector: unescape('height'),
  746. category: 'accessing',
  747. fn: function (){
  748. var self=this;
  749. return (4);
  750. return self;},
  751. args: [],
  752. source: unescape('height%0A%09%5E4'),
  753. messageSends: [],
  754. referencedClasses: []
  755. }),
  756. smalltalk.TetrisPieceI);
  757. smalltalk.addClass('TetrisPieceT', smalltalk.TetrisPiece, [], 'Examples');
  758. smalltalk.addMethod(
  759. unescape('_bounds'),
  760. smalltalk.method({
  761. selector: unescape('bounds'),
  762. category: 'accessing',
  763. fn: function (){
  764. var self=this;
  765. return (function($rec){smalltalk.send($rec, "_add_", [smalltalk.send((0), "__at", [(0)])]);smalltalk.send($rec, "_add_", [smalltalk.send((1), "__at", [(0)])]);smalltalk.send($rec, "_add_", [smalltalk.send((2), "__at", [(0)])]);smalltalk.send($rec, "_add_", [smalltalk.send((1), "__at", [(1)])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Array || Array), "_new", []));
  766. return self;},
  767. args: [],
  768. source: unescape('bounds%0A%09%5EArray%20new%0A%09%09add%3A%200@0%3B%0A%09%09add%3A%201@0%3B%0A%09%09add%3A%202@0%3B%0A%09%09add%3A%201@1%3B%0A%09%09yourself'),
  769. messageSends: ["add:", unescape("@"), "yourself", "new"],
  770. referencedClasses: ["Array"]
  771. }),
  772. smalltalk.TetrisPieceT);
  773. smalltalk.addMethod(
  774. unescape('_color'),
  775. smalltalk.method({
  776. selector: unescape('color'),
  777. category: 'accessing',
  778. fn: function (){
  779. var self=this;
  780. return unescape("%23aaf");
  781. return self;},
  782. args: [],
  783. source: unescape('color%0A%09%5E%27%23aaf%27'),
  784. messageSends: [],
  785. referencedClasses: []
  786. }),
  787. smalltalk.TetrisPieceT);