mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2024-12-27 09:58:44 +01:00
use for each
This commit is contained in:
parent
f3fce15101
commit
f5b2f1300d
1 changed files with 3 additions and 4 deletions
|
@ -59,8 +59,8 @@ levels = [ "#################@## x#H## x #### ##x ##
|
|||
|
||||
function count_gifts( state ) {
|
||||
n = 0;
|
||||
for ( i = 0 ; i < LEVEL_HEIGHT * LEVEL_WIDTH ; i++ ) {
|
||||
if ( state.board[ i ] == cell.GIFT ) {
|
||||
for each ( c in state.board ) {
|
||||
if ( c == cell.GIFT ) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
@ -97,8 +97,7 @@ function won_or_not( state ) {
|
|||
|
||||
function format_level( state ) {
|
||||
dl = "";
|
||||
for ( i = 0 ; i < LEVEL_HEIGHT * LEVEL_WIDTH ; i++ ) {
|
||||
c = state.board[ i ];
|
||||
for each ( c in state.board ) {
|
||||
classes = [ "starcell ", css_classes[ c ] ].join( '' );
|
||||
if ( state.moving == c) {
|
||||
classes = [ classes, " selected " ].join( '' );
|
||||
|
|
Loading…
Reference in a new issue