Examples.js 35 KB

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