Examples.deploy.js 21 KB

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