mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2024-12-26 09:58:48 +01:00
single loop in format_level
This commit is contained in:
parent
575f1b92f5
commit
f775d6ec8e
2 changed files with 7 additions and 10 deletions
|
@ -28,7 +28,7 @@
|
|||
|
||||
<div id="main" role="main">
|
||||
<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}
|
||||
.selected{font-weight:bold}
|
||||
.wall{color:#000}
|
||||
|
|
|
@ -97,16 +97,13 @@ function won_or_not( state ) {
|
|||
|
||||
function format_level( state ) {
|
||||
dl = "";
|
||||
for ( i = 0 ; i < LEVEL_HEIGHT ; i++ ) {
|
||||
for ( j = 0 ; j < LEVEL_WIDTH ; j++ ) {
|
||||
c = get_cell( state, j, i );
|
||||
classes = "starcell " + css_classes[ c ];
|
||||
if ( state.moving == c) {
|
||||
classes = classes + " selected ";
|
||||
}
|
||||
dl = dl + "<span class=\"" + classes + "\">" + c + "</span>";
|
||||
for ( i = 0 ; i < LEVEL_HEIGHT * LEVEL_WIDTH ; i++ ) {
|
||||
c = state.board[ i ];
|
||||
classes = "starcell " + css_classes[ c ];
|
||||
if ( state.moving == c) {
|
||||
classes = classes + " selected ";
|
||||
}
|
||||
dl = dl + "<br />";
|
||||
dl = dl + "<span class=\"" + classes + "\">" + c + "</span>";
|
||||
}
|
||||
return dl;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue