Skip to content

Commit e069584

Browse files
committed
update
1 parent e09781a commit e069584

File tree

5 files changed

+135
-135
lines changed

5 files changed

+135
-135
lines changed

halloffame/memory.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

memory/src/__javascript__/memory.js

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use strict";
2-
// Transcrypt'ed from Python, 2016-06-27 22:26:49
2+
// Transcrypt'ed from Python, 2016-06-28 18:45:07
33
function memory () {
44
var __all__ = {};
55
var __world__ = __all__;
@@ -1461,16 +1461,15 @@ function memory () {
14611461
__all__.__call__ = __call__;
14621462

14631463
(function () {
1464-
var rgb2hex = JS.rgb2hex;
1465-
var color1 = rgb2hex ('rgba(255,0,0,0)');
1466-
var color2 = rgb2hex ('rgba(255,255,0,0)');
1467-
var color3 = rgb2hex ('rgba(255,255,255,0)');
1468-
var color4 = rgb2hex ('rgba(255,0,255,0)');
1469-
var color5 = rgb2hex ('rgba(255,80,80,0)');
1470-
var color6 = rgb2hex ('rgba(255,128,0,0)');
1471-
var color7 = rgb2hex ('rgba(255,128,255,0)');
1472-
var color8 = rgb2hex ('rgba(255,0,128,0)');
1473-
var colors = list ([color1, color2, color3, color4, color5, color6, color7, color8]);
1464+
var colors = function () {
1465+
var __accu0__ = [];
1466+
var __iter0__ = list ([tuple ([0, 0, 0]), tuple ([0, 0, 255]), tuple ([0, 255, 0]), tuple ([0, 255, 255]), tuple ([255, 0, 0]), tuple ([255, 0, 255]), tuple ([255, 255, 0]), tuple ([255, 255, 255])]);
1467+
for (var __index0__ = 0; __index0__ < __iter0__.length; __index0__++) {
1468+
var color = __iter0__ [__index0__];
1469+
__accu0__.append (JS.rgb2hex ('rgba({}, 0)'.format (color)));
1470+
}
1471+
return __accu0__;
1472+
} ();
14741473
var allcolors = function () {
14751474
var __accu0__ = [];
14761475
var __iter0__ = zip (colors, colors);
@@ -1555,7 +1554,7 @@ function memory () {
15551554
sprite.num = num;
15561555
sprite.content = color;
15571556
sprite.showed = false;
1558-
var rectb = self.game.rectangle (128, 128, 'blue');
1557+
var rectb = self.game.rectangle (128, 128, 'lightGray');
15591558
rectb.x = posx;
15601559
rectb.y = posy;
15611560
rectb.num = num;
@@ -1567,13 +1566,13 @@ function memory () {
15671566
var Memory = __class__ ('Memory', [object], {
15681567
get __init__ () {return __get__ (this, function (self, width, height) {
15691568
if (typeof width == 'undefined' || (width != null && width .__class__ == __kwargdict__)) {;
1570-
var width = 512;
1569+
var width = 524;
15711570
};
15721571
if (typeof height == 'undefined' || (height != null && height .__class__ == __kwargdict__)) {;
1573-
var height = 512;
1572+
var height = 524;
15741573
};
15751574
self.game = hexi (width, height, self.setup);
1576-
self.game.backgroundColor = '#898999';
1575+
self.game.backgroundColor = 'seaGreen';
15771576
self.mouse = self.game.pointer;
15781577
self.mouse.tap = self.tap;
15791578
self.grid = Grid (self.game);
@@ -1615,7 +1614,11 @@ function memory () {
16151614
var __left0__ = self.clickedcells.__getslice__ (0, 2, 1);
16161615
var cella = __left0__ [0];
16171616
var cellb = __left0__ [1];
1618-
if (cella.num != cellb.num) {
1617+
if (cella.num == cellb.num) {
1618+
self.clickedcells = self.clickedcells.__getslice__ (0, 1, 1);
1619+
return ;
1620+
}
1621+
else {
16191622
var __left0__ = tuple ([cella.num % numcols, Math.floor (cella.num / numrows)]);
16201623
var icella = __left0__ [0];
16211624
var jcella = __left0__ [1];
@@ -1639,6 +1642,14 @@ function memory () {
16391642
}
16401643
});},
16411644
get check_endgame () {return __get__ (this, function (self) {
1645+
var endgame = function () {
1646+
var __iter0__ = lst_spr;
1647+
for (var __index0__ = 0; __index0__ < __iter0__.length; __index0__++) {
1648+
var s = __iter0__ [__index0__];
1649+
s.alpha = 0;
1650+
}
1651+
self.game.state = self.end;
1652+
};
16421653
var lst_spr = function () {
16431654
var __accu0__ = [];
16441655
var __iter0__ = self.grid.spr;
@@ -1662,12 +1673,7 @@ function memory () {
16621673
return __accu0__;
16631674
} ();
16641675
if (all (showed_values)) {
1665-
var __iter0__ = lst_spr;
1666-
for (var __index0__ = 0; __index0__ < __iter0__.length; __index0__++) {
1667-
var s = __iter0__ [__index0__];
1668-
s.alpha = 0;
1669-
}
1670-
self.game.state = self.end;
1676+
setTimeout (endgame, 2000);
16711677
}
16721678
});},
16731679
get play () {return __get__ (this, function (self) {
@@ -1694,17 +1700,8 @@ function memory () {
16941700
__all__.Memory = Memory;
16951701
__all__.all = all;
16961702
__all__.allcolors = allcolors;
1697-
__all__.color1 = color1;
1698-
__all__.color2 = color2;
1699-
__all__.color3 = color3;
1700-
__all__.color4 = color4;
1701-
__all__.color5 = color5;
1702-
__all__.color6 = color6;
1703-
__all__.color7 = color7;
1704-
__all__.color8 = color8;
17051703
__all__.colors = colors;
17061704
__all__.memory = memory;
1707-
__all__.rgb2hex = rgb2hex;
17081705
__pragma__ ('</all>')
17091706
}) ();
17101707
return __all__;

0 commit comments

Comments
 (0)