open lift, fix copy paste empty line at water level

This commit is contained in:
Stefan Bühler 2012-07-14 11:47:44 +02:00
parent 6d53b469e7
commit cf1a6ae725
2 changed files with 12 additions and 6 deletions

View File

@ -14,8 +14,9 @@
Select Map: <select id="mineGui_selectMap"></select> Select Map: <select id="mineGui_selectMap"></select>
<div style="white-space: pre">Moves: <input type="text" id="mineGui_moves" value="" style="width: 80%; font-weight: bold; border: 1px solid"></input></div> <div style="white-space: pre">Moves: <input type="text" id="mineGui_moves" value="" style="width: 80%; font-weight: bold; border: 1px solid"></input></div>
<table align=top><tr><td style="padding-right: 50px;vertical-align:top"> <table align=top><tr><td style="padding-right: 50px;vertical-align:top">
<pre id="mineGui_mineMap" style="margin-bottom: 0px"></pre> <pre><span id="mineGui_mineMap" style="margin-bottom: 0px"></span>
<pre id="mineGui_mineMapWater" style="margin-top: 0px; background: lightblue"></pre> <span id="mineGui_mineMapWater" style="margin-top: 0px; background: lightblue"></span>
</pre>
</td><td style="vertical-align:top"> </td><td style="vertical-align:top">
<pre id="mineGui_meta"></pre> <pre id="mineGui_meta"></pre>
</td></tr></table> </td></tr></table>

View File

@ -107,7 +107,8 @@ var Mine = function() {
case ' ': case ' ':
case '.': case '.':
case '\\': return true; case '\\': return true;
case 'L': return 0 == this.lambdas; case 'L': return false;
case 'O': return true;
case '*': case '*':
if (this.robot.x + 2*n < 0) return false; if (this.robot.x + 2*n < 0) return false;
if (this.robot.x + 2*n >= this.width) return false; if (this.robot.x + 2*n >= this.width) return false;
@ -124,7 +125,8 @@ var Mine = function() {
case ' ': case ' ':
case '.': case '.':
case '\\': return true; case '\\': return true;
case 'L': return 0 == this.lambdas; case 'L': return false;
case 'O': return true;
case '*': return false; case '*': return false;
" style="} " style="}
break; break;
@ -153,7 +155,7 @@ var Mine = function() {
this.lambdas--; this.lambdas--;
this.found_lambdas++; this.found_lambdas++;
break; break;
case 'L': case 'O':
this._foundLift(); this._foundLift();
break; break;
} }
@ -169,7 +171,7 @@ var Mine = function() {
this.lambdas--; this.lambdas--;
this.found_lambdas++; this.found_lambdas++;
break; break;
case 'L': case 'O':
this._foundLift(); this._foundLift();
break; break;
} }
@ -182,6 +184,9 @@ var Mine = function() {
} }
} }
this.moves++; this.moves++;
if (0 == this.lambdas) {
if (false !== this.lift) this.map[this.lift.y][this.lift.x] = 'O';
}
var newMap = [], x, y, below; var newMap = [], x, y, below;
for (y = 0; y < this.height; ++y) { newMap[y] = this.map[y].slice(); } for (y = 0; y < this.height; ++y) { newMap[y] = this.map[y].slice(); }