1
1
"use strict" ;
2
- // Transcrypt'ed from Python, 2016-06-27 22:26:49
2
+ // Transcrypt'ed from Python, 2016-06-28 18:45:07
3
3
function memory ( ) {
4
4
var __all__ = { } ;
5
5
var __world__ = __all__ ;
@@ -1461,16 +1461,15 @@ function memory () {
1461
1461
__all__ . __call__ = __call__ ;
1462
1462
1463
1463
( 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
+ } ( ) ;
1474
1473
var allcolors = function ( ) {
1475
1474
var __accu0__ = [ ] ;
1476
1475
var __iter0__ = zip ( colors , colors ) ;
@@ -1555,7 +1554,7 @@ function memory () {
1555
1554
sprite . num = num ;
1556
1555
sprite . content = color ;
1557
1556
sprite . showed = false ;
1558
- var rectb = self . game . rectangle ( 128 , 128 , 'blue ' ) ;
1557
+ var rectb = self . game . rectangle ( 128 , 128 , 'lightGray ' ) ;
1559
1558
rectb . x = posx ;
1560
1559
rectb . y = posy ;
1561
1560
rectb . num = num ;
@@ -1567,13 +1566,13 @@ function memory () {
1567
1566
var Memory = __class__ ( 'Memory' , [ object ] , {
1568
1567
get __init__ ( ) { return __get__ ( this , function ( self , width , height ) {
1569
1568
if ( typeof width == 'undefined' || ( width != null && width . __class__ == __kwargdict__ ) ) { ;
1570
- var width = 512 ;
1569
+ var width = 524 ;
1571
1570
} ;
1572
1571
if ( typeof height == 'undefined' || ( height != null && height . __class__ == __kwargdict__ ) ) { ;
1573
- var height = 512 ;
1572
+ var height = 524 ;
1574
1573
} ;
1575
1574
self . game = hexi ( width , height , self . setup ) ;
1576
- self . game . backgroundColor = '#898999 ' ;
1575
+ self . game . backgroundColor = 'seaGreen ' ;
1577
1576
self . mouse = self . game . pointer ;
1578
1577
self . mouse . tap = self . tap ;
1579
1578
self . grid = Grid ( self . game ) ;
@@ -1615,7 +1614,11 @@ function memory () {
1615
1614
var __left0__ = self . clickedcells . __getslice__ ( 0 , 2 , 1 ) ;
1616
1615
var cella = __left0__ [ 0 ] ;
1617
1616
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 {
1619
1622
var __left0__ = tuple ( [ cella . num % numcols , Math . floor ( cella . num / numrows ) ] ) ;
1620
1623
var icella = __left0__ [ 0 ] ;
1621
1624
var jcella = __left0__ [ 1 ] ;
@@ -1639,6 +1642,14 @@ function memory () {
1639
1642
}
1640
1643
} ) ; } ,
1641
1644
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
+ } ;
1642
1653
var lst_spr = function ( ) {
1643
1654
var __accu0__ = [ ] ;
1644
1655
var __iter0__ = self . grid . spr ;
@@ -1662,12 +1673,7 @@ function memory () {
1662
1673
return __accu0__ ;
1663
1674
} ( ) ;
1664
1675
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 ) ;
1671
1677
}
1672
1678
} ) ; } ,
1673
1679
get play ( ) { return __get__ ( this , function ( self ) {
@@ -1694,17 +1700,8 @@ function memory () {
1694
1700
__all__ . Memory = Memory ;
1695
1701
__all__ . all = all ;
1696
1702
__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 ;
1705
1703
__all__ . colors = colors ;
1706
1704
__all__ . memory = memory ;
1707
- __all__ . rgb2hex = rgb2hex ;
1708
1705
__pragma__ ( '</all>' )
1709
1706
} ) ( ) ;
1710
1707
return __all__ ;
0 commit comments