1
0

Examples.deploy.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. smalltalk.addClass('Counter', smalltalk.Widget, ['count', 'header'], 'Examples');
  2. smalltalk.addMethod(
  3. '_increase',
  4. smalltalk.method({
  5. selector: 'increase',
  6. fn: function (){
  7. var self=this;
  8. self['@count']=((($receiver = self['@count']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));
  9. smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [smalltalk.send(self['@count'], "_asString", [])]);})]);
  10. return self;}
  11. }),
  12. smalltalk.Counter);
  13. smalltalk.addMethod(
  14. '_decrease',
  15. smalltalk.method({
  16. selector: 'decrease',
  17. fn: function (){
  18. var self=this;
  19. self['@count']=((($receiver = self['@count']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]));
  20. smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [smalltalk.send(self['@count'], "_asString", [])]);})]);
  21. return self;}
  22. }),
  23. smalltalk.Counter);
  24. smalltalk.addMethod(
  25. '_initialize',
  26. smalltalk.method({
  27. selector: 'initialize',
  28. fn: function (){
  29. var self=this;
  30. smalltalk.send(self, "_initialize", [], smalltalk.Widget);
  31. self['@count']=(0);
  32. return self;}
  33. }),
  34. smalltalk.Counter);
  35. smalltalk.addMethod(
  36. '_renderOn_',
  37. smalltalk.method({
  38. selector: 'renderOn:',
  39. fn: function (html){
  40. var self=this;
  41. self['@header']=(function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(self['@count'], "_asString", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(html, "_h1", []));
  42. (function($rec){smalltalk.send($rec, "_with_", [unescape("++")]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_increase", []);})]);})(smalltalk.send(html, "_button", []));
  43. (function($rec){smalltalk.send($rec, "_with_", [unescape("--")]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_decrease", []);})]);})(smalltalk.send(html, "_button", []));
  44. return self;}
  45. }),
  46. smalltalk.Counter);
  47. smalltalk.addClass('Tetris', smalltalk.Widget, ['renderingContext', 'timer', 'speed', 'score', 'rows', 'movingPiece'], 'Examples');
  48. smalltalk.addMethod(
  49. '_width',
  50. smalltalk.method({
  51. selector: 'width',
  52. fn: function (){
  53. var self=this;
  54. return smalltalk.send(smalltalk.send(self, "_class", []), "_width", []);
  55. return self;}
  56. }),
  57. smalltalk.Tetris);
  58. smalltalk.addMethod(
  59. '_height',
  60. smalltalk.method({
  61. selector: 'height',
  62. fn: function (){
  63. var self=this;
  64. return smalltalk.send(smalltalk.send(self, "_class", []), "_height", []);
  65. return self;}
  66. }),
  67. smalltalk.Tetris);
  68. smalltalk.addMethod(
  69. '_squares',
  70. smalltalk.method({
  71. selector: 'squares',
  72. fn: function (){
  73. var self=this;
  74. return smalltalk.send(smalltalk.send(self, "_class", []), "_squares", []);
  75. return self;}
  76. }),
  77. smalltalk.Tetris);
  78. smalltalk.addMethod(
  79. '_gluePiece_',
  80. smalltalk.method({
  81. selector: 'gluePiece:',
  82. fn: function (aPiece){
  83. var self=this;
  84. smalltalk.send(aPiece, "_glueOn_", [self]);
  85. return self;}
  86. }),
  87. smalltalk.Tetris);
  88. smalltalk.addMethod(
  89. '_rows',
  90. smalltalk.method({
  91. selector: 'rows',
  92. fn: function (){
  93. var self=this;
  94. return self['@rows'];
  95. return self;}
  96. }),
  97. smalltalk.Tetris);
  98. smalltalk.addMethod(
  99. '_addRow_',
  100. smalltalk.method({
  101. selector: 'addRow:',
  102. fn: function (aCollection){
  103. var self=this;
  104. smalltalk.send(smalltalk.send(self, "_rows", []), "_add_", [aCollection]);
  105. return self;}
  106. }),
  107. smalltalk.Tetris);
  108. smalltalk.addMethod(
  109. '_startNewGame',
  110. smalltalk.method({
  111. selector: 'startNewGame',
  112. fn: function (){
  113. var self=this;
  114. smalltalk.send(self, "_newGame", []);
  115. (($receiver = self['@timer']) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self['@timer'], "_clearInterval", []);})() : nil;
  116. self['@timer']=smalltalk.send((function(){return smalltalk.send(self, "_nextStep", []);}), "_valueWithInterval_", [self['@speed']]);
  117. return self;}
  118. }),
  119. smalltalk.Tetris);
  120. smalltalk.addMethod(
  121. '_nextStep',
  122. smalltalk.method({
  123. selector: 'nextStep',
  124. fn: function (){
  125. var self=this;
  126. (($receiver = self['@movingPiece']) == nil || $receiver == undefined) ? (function(){return smalltalk.send(self, "_newPiece", []);})() : $receiver;
  127. ((($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", []);})]));
  128. smalltalk.send(self, "_redraw", []);
  129. return self;}
  130. }),
  131. smalltalk.Tetris);
  132. smalltalk.addMethod(
  133. '_redraw',
  134. smalltalk.method({
  135. selector: 'redraw',
  136. fn: function (){
  137. var self=this;
  138. smalltalk.send(self['@renderingContext'], "_clearRectFrom_to_", [smalltalk.send((0), "__at", [smalltalk.send(self, "_width", [])]), smalltalk.send((0), "__at", [smalltalk.send(self, "_height", [])])]);
  139. (function($rec){smalltalk.send($rec, "_drawMap", []);return smalltalk.send($rec, "_drawPiece", []);})(self);
  140. return self;}
  141. }),
  142. smalltalk.Tetris);
  143. smalltalk.addMethod(
  144. '_drawMap',
  145. smalltalk.method({
  146. selector: 'drawMap',
  147. fn: function (){
  148. var self=this;
  149. (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']);
  150. (function($rec){smalltalk.send($rec, "_lineWidth_", [(0.5)]);return smalltalk.send($rec, "_strokeStyle_", [unescape("%23999")]);})(self['@renderingContext']);
  151. smalltalk.send((0), "_to_do_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_squares", []), "_x", []), (function(each){var x=nil;
  152. 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", [])])]);})]);
  153. smalltalk.send((0), "_to_do_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_squares", []), "_y", []), (function(each){var y=nil;
  154. 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])]);})]);
  155. return self;}
  156. }),
  157. smalltalk.Tetris);
  158. smalltalk.addMethod(
  159. '_drawLineFrom_to_',
  160. smalltalk.method({
  161. selector: 'drawLineFrom:to:',
  162. fn: function (aPoint, anotherPoint){
  163. var self=this;
  164. (function($rec){smalltalk.send($rec, "_beginPath", []);smalltalk.send($rec, "_moveTo_", [aPoint]);smalltalk.send($rec, "_lineTo_", [anotherPoint]);return smalltalk.send($rec, "_stroke", []);})(self['@renderingContext']);
  165. return self;}
  166. }),
  167. smalltalk.Tetris);
  168. smalltalk.addMethod(
  169. '_newGame',
  170. smalltalk.method({
  171. selector: 'newGame',
  172. fn: function (){
  173. var self=this;
  174. self['@rows']=[];
  175. self['@movingPiece']=nil;
  176. self['@speed']=(200);
  177. self['@score']=(0);
  178. return self;}
  179. }),
  180. smalltalk.Tetris);
  181. smalltalk.addMethod(
  182. '_newPiece',
  183. smalltalk.method({
  184. selector: 'newPiece',
  185. fn: function (){
  186. var self=this;
  187. self['@movingPiece']=smalltalk.send((smalltalk.TetrisPiece || TetrisPiece), "_atRandom", []);
  188. return self;}
  189. }),
  190. smalltalk.Tetris);
  191. smalltalk.addMethod(
  192. '_drawRows',
  193. smalltalk.method({
  194. selector: 'drawRows',
  195. fn: function (){
  196. var self=this;
  197. smalltalk.send(smalltalk.send(self, "_rows", []), "_do_", [(function(each){return nil;})]);
  198. (($receiver = self['@movingPiece']) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self['@movingPiece'], "_drawOn_", [self['@renderingContext']]);})() : nil;
  199. return self;}
  200. }),
  201. smalltalk.Tetris);
  202. smalltalk.addMethod(
  203. '_drawPiece',
  204. smalltalk.method({
  205. selector: 'drawPiece',
  206. fn: function (){
  207. var self=this;
  208. (($receiver = self['@movingPiece']) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self['@movingPiece'], "_drawOn_", [self['@renderingContext']]);})() : nil;
  209. return self;}
  210. }),
  211. smalltalk.Tetris);
  212. smalltalk.addMethod(
  213. '_initialize',
  214. smalltalk.method({
  215. selector: 'initialize',
  216. fn: function (){
  217. var self=this;
  218. smalltalk.send(self, "_initialize", [], smalltalk.Widget);
  219. smalltalk.send(self, "_newGame", []);
  220. return self;}
  221. }),
  222. smalltalk.Tetris);
  223. smalltalk.addMethod(
  224. '_renderOn_',
  225. smalltalk.method({
  226. selector: 'renderOn:',
  227. fn: function (html){
  228. var self=this;
  229. (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", []));
  230. return self;}
  231. }),
  232. smalltalk.Tetris);
  233. smalltalk.addMethod(
  234. '_renderCanvasOn_',
  235. smalltalk.method({
  236. selector: 'renderCanvasOn:',
  237. fn: function (html){
  238. var self=this;
  239. var canvas=nil;
  240. canvas=smalltalk.send(html, "_canvas", []);
  241. smalltalk.send(canvas, "_at_put_", ["width", smalltalk.send(smalltalk.send(self, "_width", []), "_asString", [])]);
  242. smalltalk.send(canvas, "_at_put_", ["height", smalltalk.send(smalltalk.send(self, "_height", []), "_asString", [])]);
  243. self['@renderingContext']=smalltalk.send((smalltalk.CanvasRenderingContext || CanvasRenderingContext), "_tagBrush_", [canvas]);
  244. smalltalk.send(self, "_redraw", []);
  245. return self;}
  246. }),
  247. smalltalk.Tetris);
  248. smalltalk.addMethod(
  249. '_renderButtonsOn_',
  250. smalltalk.method({
  251. selector: 'renderButtonsOn:',
  252. fn: function (html){
  253. var self=this;
  254. (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", []));
  255. return self;}
  256. }),
  257. smalltalk.Tetris);
  258. smalltalk.addMethod(
  259. '_squareSize',
  260. smalltalk.method({
  261. selector: 'squareSize',
  262. fn: function (){
  263. var self=this;
  264. return (22);
  265. return self;}
  266. }),
  267. smalltalk.Tetris.klass);
  268. smalltalk.addMethod(
  269. '_width',
  270. smalltalk.method({
  271. selector: 'width',
  272. fn: function (){
  273. var self=this;
  274. 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", [])]));
  275. return self;}
  276. }),
  277. smalltalk.Tetris.klass);
  278. smalltalk.addMethod(
  279. '_height',
  280. smalltalk.method({
  281. selector: 'height',
  282. fn: function (){
  283. var self=this;
  284. 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", [])]));
  285. return self;}
  286. }),
  287. smalltalk.Tetris.klass);
  288. smalltalk.addMethod(
  289. '_squares',
  290. smalltalk.method({
  291. selector: 'squares',
  292. fn: function (){
  293. var self=this;
  294. return smalltalk.send((10), "__at", [(15)]);
  295. return self;}
  296. }),
  297. smalltalk.Tetris.klass);
  298. smalltalk.addClass('TetrisPiece', smalltalk.Widget, ['rotation', 'position'], 'Examples');
  299. smalltalk.addMethod(
  300. '_rotation',
  301. smalltalk.method({
  302. selector: 'rotation',
  303. fn: function (){
  304. var self=this;
  305. return (($receiver = self['@rotation']) == nil || $receiver == undefined) ? (function(){return self['@rotation']=(1);})() : $receiver;
  306. return self;}
  307. }),
  308. smalltalk.TetrisPiece);
  309. smalltalk.addMethod(
  310. '_rotation_',
  311. smalltalk.method({
  312. selector: 'rotation:',
  313. fn: function (aNumber){
  314. var self=this;
  315. self['@rotation']=aNumber;
  316. return self;}
  317. }),
  318. smalltalk.TetrisPiece);
  319. smalltalk.addMethod(
  320. '_position',
  321. smalltalk.method({
  322. selector: 'position',
  323. fn: function (){
  324. var self=this;
  325. 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;
  326. return self;}
  327. }),
  328. smalltalk.TetrisPiece);
  329. smalltalk.addMethod(
  330. '_position_',
  331. smalltalk.method({
  332. selector: 'position:',
  333. fn: function (aPoint){
  334. var self=this;
  335. return self['@position']=aPoint;
  336. return self;}
  337. }),
  338. smalltalk.TetrisPiece);
  339. smalltalk.addMethod(
  340. '_bounds',
  341. smalltalk.method({
  342. selector: 'bounds',
  343. fn: function (){
  344. var self=this;
  345. smalltalk.send(self, "_subclassResponsibility", []);
  346. return self;}
  347. }),
  348. smalltalk.TetrisPiece);
  349. smalltalk.addMethod(
  350. '_color',
  351. smalltalk.method({
  352. selector: 'color',
  353. fn: function (){
  354. var self=this;
  355. return unescape("%23afa");
  356. return self;}
  357. }),
  358. smalltalk.TetrisPiece);
  359. smalltalk.addMethod(
  360. '_height',
  361. smalltalk.method({
  362. selector: 'height',
  363. fn: function (){
  364. var self=this;
  365. return (2);
  366. return self;}
  367. }),
  368. smalltalk.TetrisPiece);
  369. smalltalk.addMethod(
  370. '_drawOn_',
  371. smalltalk.method({
  372. selector: 'drawOn:',
  373. fn: function (aRenderingContext){
  374. var self=this;
  375. smalltalk.send(aRenderingContext, "_fillStyle_", [smalltalk.send(self, "_color", [])]);
  376. 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);})]);
  377. return self;}
  378. }),
  379. smalltalk.TetrisPiece);
  380. smalltalk.addMethod(
  381. '_canMove',
  382. smalltalk.method({
  383. selector: 'canMove',
  384. fn: function (){
  385. var self=this;
  386. 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", [])]))]));
  387. return self;}
  388. }),
  389. smalltalk.TetrisPiece);
  390. smalltalk.addMethod(
  391. '_canMoveIn_',
  392. smalltalk.method({
  393. selector: 'canMoveIn:',
  394. fn: function (aTetris){
  395. var self=this;
  396. 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", [])]))]));
  397. return self;}
  398. }),
  399. smalltalk.TetrisPiece);
  400. smalltalk.addMethod(
  401. '_atRandom',
  402. smalltalk.method({
  403. selector: 'atRandom',
  404. fn: function (){
  405. var self=this;
  406. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_subclasses", []), "_at_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_subclasses", []), "_size", []), "_atRandom", [])]), "_new", []);
  407. return self;}
  408. }),
  409. smalltalk.TetrisPiece.klass);
  410. smalltalk.addClass('TetrisPieceO', smalltalk.TetrisPiece, [], 'Examples');
  411. smalltalk.addMethod(
  412. '_bounds',
  413. smalltalk.method({
  414. selector: 'bounds',
  415. fn: function (){
  416. var self=this;
  417. 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", []));
  418. return self;}
  419. }),
  420. smalltalk.TetrisPieceO);
  421. smalltalk.addClass('TetrisPieceL', smalltalk.TetrisPiece, [], 'Examples');
  422. smalltalk.addMethod(
  423. '_bounds',
  424. smalltalk.method({
  425. selector: 'bounds',
  426. fn: function (){
  427. var self=this;
  428. 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", []));
  429. return self;}
  430. }),
  431. smalltalk.TetrisPieceL);
  432. smalltalk.addMethod(
  433. '_color',
  434. smalltalk.method({
  435. selector: 'color',
  436. fn: function (){
  437. var self=this;
  438. return unescape("%23ffa");
  439. return self;}
  440. }),
  441. smalltalk.TetrisPieceL);
  442. smalltalk.addMethod(
  443. '_height',
  444. smalltalk.method({
  445. selector: 'height',
  446. fn: function (){
  447. var self=this;
  448. return (3);
  449. return self;}
  450. }),
  451. smalltalk.TetrisPieceL);
  452. smalltalk.addClass('TetrisPieceJ', smalltalk.TetrisPiece, [], 'Examples');
  453. smalltalk.addMethod(
  454. '_color',
  455. smalltalk.method({
  456. selector: 'color',
  457. fn: function (){
  458. var self=this;
  459. return unescape("%23aaf");
  460. return self;}
  461. }),
  462. smalltalk.TetrisPieceJ);
  463. smalltalk.addMethod(
  464. '_bounds',
  465. smalltalk.method({
  466. selector: 'bounds',
  467. fn: function (){
  468. var self=this;
  469. 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", []));
  470. return self;}
  471. }),
  472. smalltalk.TetrisPieceJ);
  473. smalltalk.addMethod(
  474. '_height',
  475. smalltalk.method({
  476. selector: 'height',
  477. fn: function (){
  478. var self=this;
  479. return (3);
  480. return self;}
  481. }),
  482. smalltalk.TetrisPieceJ);
  483. smalltalk.addClass('TetrisPieceI', smalltalk.TetrisPiece, [], 'Examples');
  484. smalltalk.addMethod(
  485. '_color',
  486. smalltalk.method({
  487. selector: 'color',
  488. fn: function (){
  489. var self=this;
  490. return unescape("%23faa");
  491. return self;}
  492. }),
  493. smalltalk.TetrisPieceI);
  494. smalltalk.addMethod(
  495. '_bounds',
  496. smalltalk.method({
  497. selector: 'bounds',
  498. fn: function (){
  499. var self=this;
  500. 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", []));
  501. return self;}
  502. }),
  503. smalltalk.TetrisPieceI);
  504. smalltalk.addMethod(
  505. '_height',
  506. smalltalk.method({
  507. selector: 'height',
  508. fn: function (){
  509. var self=this;
  510. return (4);
  511. return self;}
  512. }),
  513. smalltalk.TetrisPieceI);
  514. smalltalk.addClass('TetrisPieceT', smalltalk.TetrisPiece, [], 'Examples');
  515. smalltalk.addMethod(
  516. '_bounds',
  517. smalltalk.method({
  518. selector: 'bounds',
  519. fn: function (){
  520. var self=this;
  521. 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", []));
  522. return self;}
  523. }),
  524. smalltalk.TetrisPieceT);
  525. smalltalk.addMethod(
  526. '_color',
  527. smalltalk.method({
  528. selector: 'color',
  529. fn: function (){
  530. var self=this;
  531. return unescape("%23aaf");
  532. return self;}
  533. }),
  534. smalltalk.TetrisPieceT);