Examples.deploy.js 19 KB

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