diff --git a/xtrn/tankbattle/tanks.js b/xtrn/tankbattle/tanks.js
index 43e9100ee8467db48fcdf33e2a2f87099d42c0b9..b9d2e3476d84bb69e3a61ec718b8b4b7089c2dbc 100644
--- a/xtrn/tankbattle/tanks.js
+++ b/xtrn/tankbattle/tanks.js
@@ -781,9 +781,10 @@ function playGame(battle)
 	}
 	function moveShot(shot)
 	{
-		var newPosition=new Coords(0,0);
 		var count=0;
-		while(count<2) {
+		while(count<=2) {
+			count++;
+			var newPosition=new Coords(0,0);
 			switch(Number(shot.heading))
 			{
 			case 0:
@@ -853,7 +854,7 @@ function playGame(battle)
 			}
 			break;
 		}
-		if(count == 2) {
+		if(count > 2) {
 			log("ERROR: infinite loop detected!");
 			exit();
 		}