Commit dd94b26f authored by Teddy BARKOU's avatar Teddy BARKOU
Browse files

résolution pb dangerous case et echec() a tester horizontal bas et gauche

parent aca5daff
...@@ -273,7 +273,7 @@ export function isDangerousCase(chessboard: Chessboard,rank:number,file:number,i ...@@ -273,7 +273,7 @@ export function isDangerousCase(chessboard: Chessboard,rank:number,file:number,i
break; break;
} }
} }
for(let i: number=1; i<rank ; i++){ for(let i: number=1; i<=rank ; i++){
if(!isEmpty(chessboard,position(file,rank-i))){ if(!isEmpty(chessboard,position(file,rank-i))){
...@@ -307,7 +307,7 @@ export function isDangerousCase(chessboard: Chessboard,rank:number,file:number,i ...@@ -307,7 +307,7 @@ export function isDangerousCase(chessboard: Chessboard,rank:number,file:number,i
break; break;
} }
} }
for(let i: number=1; i<file ; i++){ for(let i: number=1; i<=file ; i++){
if(!isEmpty(chessboard,position(file-i,rank))){ if(!isEmpty(chessboard,position(file-i,rank))){
...@@ -344,7 +344,7 @@ export function isDangerousCase(chessboard: Chessboard,rank:number,file:number,i ...@@ -344,7 +344,7 @@ export function isDangerousCase(chessboard: Chessboard,rank:number,file:number,i
break; break;
} }
} }
for(let i: number=1; (i<8-file && i<rank) ; i++){ for(let i: number=1; (i<8-file && i<=rank) ; i++){
if(!isEmpty(chessboard,position(file+i,rank-i))){ if(!isEmpty(chessboard,position(file+i,rank-i))){
...@@ -362,7 +362,7 @@ export function isDangerousCase(chessboard: Chessboard,rank:number,file:number,i ...@@ -362,7 +362,7 @@ export function isDangerousCase(chessboard: Chessboard,rank:number,file:number,i
break; break;
} }
} }
for(let i: number=1; (i<file && i<rank) ; i++){ for(let i: number=1; (i<=file && i<=rank) ; i++){
if(!isEmpty(chessboard,position(file-i,rank-i))){ if(!isEmpty(chessboard,position(file-i,rank-i))){
...@@ -380,7 +380,7 @@ export function isDangerousCase(chessboard: Chessboard,rank:number,file:number,i ...@@ -380,7 +380,7 @@ export function isDangerousCase(chessboard: Chessboard,rank:number,file:number,i
break; break;
} }
} }
for(let i: number=1; (i<file && i<8-rank) ; i++){ for(let i: number=1; (i<=file && i<8-rank) ; i++){
if(!isEmpty(chessboard,position(file-i,rank+i))){ if(!isEmpty(chessboard,position(file-i,rank+i))){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment