1
1
"use strict" ;
2
- // Transcrypt'ed from Python, 2016-06-28 12:36:56
2
+ // Transcrypt'ed from Python, 2016-06-28 16:26:22
3
3
function memory ( ) {
4
4
var __all__ = { } ;
5
5
var __world__ = __all__ ;
@@ -945,16 +945,15 @@ function memory () {
945
945
} ;
946
946
__all__ . __call__ = __call__ ;
947
947
( function ( ) {
948
- var rgb2hex = JS . rgb2hex ;
949
- var color1 = rgb2hex ( 'rgba(255,0,0,0)' ) ;
950
- var color2 = rgb2hex ( 'rgba(255,255,0,0)' ) ;
951
- var color3 = rgb2hex ( 'rgba(255,255,255,0)' ) ;
952
- var color4 = rgb2hex ( 'rgba(255,0,255,0)' ) ;
953
- var color5 = rgb2hex ( 'rgba(255,80,80,0)' ) ;
954
- var color6 = rgb2hex ( 'rgba(255,128,0,0)' ) ;
955
- var color7 = rgb2hex ( 'rgba(255,128,255,0)' ) ;
956
- var color8 = rgb2hex ( 'rgba(255,0,128,0)' ) ;
957
- var colors = list ( [ color1 , color2 , color3 , color4 , color5 , color6 , color7 , color8 ] ) ;
948
+ var colors = function ( ) {
949
+ var __accu0__ = [ ] ;
950
+ 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 ] ) ] ) ;
951
+ for ( var __index0__ = 0 ; __index0__ < __iter0__ . length ; __index0__ ++ ) {
952
+ var color = __iter0__ [ __index0__ ] ;
953
+ __accu0__ . append ( JS . rgb2hex ( 'rgba({}, 0)' . format ( color ) ) ) ;
954
+ }
955
+ return __accu0__ ;
956
+ } ( ) ;
958
957
var allcolors = function ( ) {
959
958
var __accu0__ = [ ] ;
960
959
var __iter0__ = zip ( colors , colors ) ;
@@ -1039,7 +1038,7 @@ function memory () {
1039
1038
sprite . num = num ;
1040
1039
sprite . content = color ;
1041
1040
sprite . showed = false ;
1042
- var rectb = self . game . rectangle ( 128 , 128 , 'blue ' ) ;
1041
+ var rectb = self . game . rectangle ( 128 , 128 , 'lightGray ' ) ;
1043
1042
rectb . x = posx ;
1044
1043
rectb . y = posy ;
1045
1044
rectb . num = num ;
@@ -1051,13 +1050,13 @@ function memory () {
1051
1050
var Memory = __class__ ( 'Memory' , [ object ] , {
1052
1051
get __init__ ( ) { return __get__ ( this , function ( self , width , height ) {
1053
1052
if ( typeof width == 'undefined' || ( width != null && width . __class__ == __kwargdict__ ) ) { ;
1054
- var width = 512 ;
1053
+ var width = 524 ;
1055
1054
} ;
1056
1055
if ( typeof height == 'undefined' || ( height != null && height . __class__ == __kwargdict__ ) ) { ;
1057
- var height = 512 ;
1056
+ var height = 524 ;
1058
1057
} ;
1059
1058
self . game = hexi ( width , height , self . setup ) ;
1060
- self . game . backgroundColor = 'seagrean ' ;
1059
+ self . game . backgroundColor = 'seaGreen ' ;
1061
1060
self . mouse = self . game . pointer ;
1062
1061
self . mouse . tap = self . tap ;
1063
1062
self . grid = Grid ( self . game ) ;
@@ -1099,7 +1098,11 @@ function memory () {
1099
1098
var __left0__ = self . clickedcells . __getslice__ ( 0 , 2 , 1 ) ;
1100
1099
var cella = __left0__ [ 0 ] ;
1101
1100
var cellb = __left0__ [ 1 ] ;
1102
- if ( cella . num != cellb . num ) {
1101
+ if ( cella . num == cellb . num ) {
1102
+ self . clickedcells = self . clickedcells . __getslice__ ( 0 , 1 , 1 ) ;
1103
+ return ;
1104
+ }
1105
+ else {
1103
1106
var __left0__ = tuple ( [ cella . num % numcols , Math . floor ( cella . num ) / Math . floor ( numrows ) ] ) ;
1104
1107
var icella = __left0__ [ 0 ] ;
1105
1108
var jcella = __left0__ [ 1 ] ;
@@ -1113,7 +1116,7 @@ function memory () {
1113
1116
cellb . alpha = 0 ;
1114
1117
cella . alpha = 0 ;
1115
1118
if ( contenta != contentb ) {
1116
- setTimeout ( resetcell ( list ( [ cella , cellb ] ) ) , 1000 ) ;
1119
+ setTimeout ( resetcell ( list ( [ cella , cellb ] ) ) , 500 ) ;
1117
1120
}
1118
1121
else {
1119
1122
spritea . showed = true ;
@@ -1123,6 +1126,14 @@ function memory () {
1123
1126
}
1124
1127
} ) ; } ,
1125
1128
get check_endgame ( ) { return __get__ ( this , function ( self ) {
1129
+ var endgame = function ( ) {
1130
+ var __iter0__ = lst_spr ;
1131
+ for ( var __index0__ = 0 ; __index0__ < __iter0__ . length ; __index0__ ++ ) {
1132
+ var s = __iter0__ [ __index0__ ] ;
1133
+ s . alpha = 0 ;
1134
+ }
1135
+ self . game . state = self . end ;
1136
+ } ;
1126
1137
var lst_spr = function ( ) {
1127
1138
var __accu0__ = [ ] ;
1128
1139
var __iter0__ = self . grid . spr ;
@@ -1146,19 +1157,15 @@ function memory () {
1146
1157
return __accu0__ ;
1147
1158
} ( ) ;
1148
1159
if ( all ( showed_values ) ) {
1149
- var __iter0__ = lst_spr ;
1150
- for ( var __index0__ = 0 ; __index0__ < __iter0__ . length ; __index0__ ++ ) {
1151
- var s = __iter0__ [ __index0__ ] ;
1152
- s . alpha = 0 ;
1153
- }
1154
- self . game . state = self . end ;
1160
+ setTimeout ( endgame , 2000 ) ;
1155
1161
}
1156
1162
} ) ; } ,
1157
1163
get play ( ) { return __get__ ( this , function ( self ) {
1158
1164
self . check_endgame ( ) ;
1159
1165
self . get_curcell ( ) ;
1160
1166
if ( self . mouse . tapped ) {
1161
- ( ! __in__ ( self . curcell , self . clickedcells ) ? self . clickedcells . append ( self . curcell ) : null ) ;
1167
+ var lc = len ( self . clickedcells ) ;
1168
+ self . clickedcells . append ( self . curcell ) ;
1162
1169
self . mouse . tapped = false ;
1163
1170
self . compare_cells ( ) ;
1164
1171
}
@@ -1177,17 +1184,8 @@ function memory () {
1177
1184
__all__ . Memory = Memory ;
1178
1185
__all__ . all = all ;
1179
1186
__all__ . allcolors = allcolors ;
1180
- __all__ . color1 = color1 ;
1181
- __all__ . color2 = color2 ;
1182
- __all__ . color3 = color3 ;
1183
- __all__ . color4 = color4 ;
1184
- __all__ . color5 = color5 ;
1185
- __all__ . color6 = color6 ;
1186
- __all__ . color7 = color7 ;
1187
- __all__ . color8 = color8 ;
1188
1187
__all__ . colors = colors ;
1189
1188
__all__ . memory = memory ;
1190
- __all__ . rgb2hex = rgb2hex ;
1191
1189
__pragma__ ( '</all>' )
1192
1190
} ) ( ) ;
1193
1191
return __all__ ;
0 commit comments