2
0

Examples.deploy.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  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'], "_clearRect_y_to_y_", [(0), smalltalk.send(self, "_width", []), (0), 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, "_fillRect_y_to_y_", [(0), (0), smalltalk.send(self, "_width", []), 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_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']);
  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.send(canvas, "_element", []), "_getContext_", ["2d"]);
  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 nil;})]);})(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){var from=nil;
  377. var to=nil;
  378. 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);})]);
  379. return self;}
  380. }),
  381. smalltalk.TetrisPiece);
  382. smalltalk.addMethod(
  383. '_canMove',
  384. smalltalk.method({
  385. selector: 'canMove',
  386. fn: function (){
  387. var self=this;
  388. 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", [])]))]));
  389. return self;}
  390. }),
  391. smalltalk.TetrisPiece);
  392. smalltalk.addMethod(
  393. '_canMoveIn_',
  394. smalltalk.method({
  395. selector: 'canMoveIn:',
  396. fn: function (aTetris){
  397. var self=this;
  398. 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", [])]))]));
  399. return self;}
  400. }),
  401. smalltalk.TetrisPiece);
  402. smalltalk.addMethod(
  403. '_atRandom',
  404. smalltalk.method({
  405. selector: 'atRandom',
  406. fn: function (){
  407. var self=this;
  408. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_subclasses", []), "_at_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_subclasses", []), "_size", []), "_atRandom", [])]), "_new", []);
  409. return self;}
  410. }),
  411. smalltalk.TetrisPiece.klass);
  412. smalltalk.addClass('TetrisPieceO', smalltalk.TetrisPiece, [], 'Examples');
  413. smalltalk.addMethod(
  414. '_bounds',
  415. smalltalk.method({
  416. selector: 'bounds',
  417. fn: function (){
  418. var self=this;
  419. 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", []));
  420. return self;}
  421. }),
  422. smalltalk.TetrisPieceO);
  423. smalltalk.addClass('TetrisPieceL', smalltalk.TetrisPiece, [], 'Examples');
  424. smalltalk.addMethod(
  425. '_bounds',
  426. smalltalk.method({
  427. selector: 'bounds',
  428. fn: function (){
  429. var self=this;
  430. 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", []));
  431. return self;}
  432. }),
  433. smalltalk.TetrisPieceL);
  434. smalltalk.addMethod(
  435. '_color',
  436. smalltalk.method({
  437. selector: 'color',
  438. fn: function (){
  439. var self=this;
  440. return unescape("%23ffa");
  441. return self;}
  442. }),
  443. smalltalk.TetrisPieceL);
  444. smalltalk.addMethod(
  445. '_height',
  446. smalltalk.method({
  447. selector: 'height',
  448. fn: function (){
  449. var self=this;
  450. return (3);
  451. return self;}
  452. }),
  453. smalltalk.TetrisPieceL);
  454. smalltalk.addClass('TetrisPieceJ', smalltalk.TetrisPiece, [], 'Examples');
  455. smalltalk.addMethod(
  456. '_color',
  457. smalltalk.method({
  458. selector: 'color',
  459. fn: function (){
  460. var self=this;
  461. return unescape("%23aaf");
  462. return self;}
  463. }),
  464. smalltalk.TetrisPieceJ);
  465. smalltalk.addMethod(
  466. '_bounds',
  467. smalltalk.method({
  468. selector: 'bounds',
  469. fn: function (){
  470. var self=this;
  471. 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", []));
  472. return self;}
  473. }),
  474. smalltalk.TetrisPieceJ);
  475. smalltalk.addMethod(
  476. '_height',
  477. smalltalk.method({
  478. selector: 'height',
  479. fn: function (){
  480. var self=this;
  481. return (3);
  482. return self;}
  483. }),
  484. smalltalk.TetrisPieceJ);
  485. smalltalk.addClass('TetrisPieceI', smalltalk.TetrisPiece, [], 'Examples');
  486. smalltalk.addMethod(
  487. '_color',
  488. smalltalk.method({
  489. selector: 'color',
  490. fn: function (){
  491. var self=this;
  492. return unescape("%23faa");
  493. return self;}
  494. }),
  495. smalltalk.TetrisPieceI);
  496. smalltalk.addMethod(
  497. '_bounds',
  498. smalltalk.method({
  499. selector: 'bounds',
  500. fn: function (){
  501. var self=this;
  502. 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", []));
  503. return self;}
  504. }),
  505. smalltalk.TetrisPieceI);
  506. smalltalk.addMethod(
  507. '_height',
  508. smalltalk.method({
  509. selector: 'height',
  510. fn: function (){
  511. var self=this;
  512. return (4);
  513. return self;}
  514. }),
  515. smalltalk.TetrisPieceI);
  516. smalltalk.addClass('TetrisPieceT', smalltalk.TetrisPiece, [], 'Examples');
  517. smalltalk.addMethod(
  518. '_bounds',
  519. smalltalk.method({
  520. selector: 'bounds',
  521. fn: function (){
  522. var self=this;
  523. 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", []));
  524. return self;}
  525. }),
  526. smalltalk.TetrisPieceT);
  527. smalltalk.addMethod(
  528. '_color',
  529. smalltalk.method({
  530. selector: 'color',
  531. fn: function (){
  532. var self=this;
  533. return unescape("%23aaf");
  534. return self;}
  535. }),
  536. smalltalk.TetrisPieceT);