single loop in format_level
This commit is contained in:
parent
5b8a904530
commit
d5b18f2e6c
2 changed files with 7 additions and 10 deletions
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
<div id="main" role="main">
|
<div id="main" role="main">
|
||||||
<style>
|
<style>
|
||||||
#blackboard{width:16em;background:#333}
|
#blackboard{width:16em;background:#333;float:left}
|
||||||
.starcell{width:1em;height:1em;display:block;float:left;text-align:center}
|
.starcell{width:1em;height:1em;display:block;float:left;text-align:center}
|
||||||
.selected{font-weight:bold}
|
.selected{font-weight:bold}
|
||||||
.wall{color:#000}
|
.wall{color:#000}
|
||||||
|
|
|
@ -97,17 +97,14 @@ function won_or_not( state ) {
|
||||||
|
|
||||||
function format_level( state ) {
|
function format_level( state ) {
|
||||||
dl = "";
|
dl = "";
|
||||||
for ( i = 0 ; i < LEVEL_HEIGHT ; i++ ) {
|
for ( i = 0 ; i < LEVEL_HEIGHT * LEVEL_WIDTH ; i++ ) {
|
||||||
for ( j = 0 ; j < LEVEL_WIDTH ; j++ ) {
|
c = state.board[ i ];
|
||||||
c = get_cell( state, j, i );
|
|
||||||
classes = "starcell " + css_classes[ c ];
|
classes = "starcell " + css_classes[ c ];
|
||||||
if ( state.moving == c) {
|
if ( state.moving == c) {
|
||||||
classes = classes + " selected ";
|
classes = classes + " selected ";
|
||||||
}
|
}
|
||||||
dl = dl + "<span class=\"" + classes + "\">" + c + "</span>";
|
dl = dl + "<span class=\"" + classes + "\">" + c + "</span>";
|
||||||
}
|
}
|
||||||
dl = dl + "<br />";
|
|
||||||
}
|
|
||||||
return dl;
|
return dl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue