Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 735 Bytes

stalemate.md

File metadata and controls

34 lines (26 loc) · 735 Bytes

Stalemate ?

get status by $chess->inStalemate()

example:

<?php
use \Ryanhs\Chess\Chess;

$chess = new Chess();

// fen source: https://www.redhotpawn.com/forum/only-chess/interesting-stalemate-position.152109
// start fen : 3b3k/p6p/1p5P/3q4/8/n7/PP6/K4Q2 w - - 0 1
$chess->load('7k/p6p/1p3b1P/3q4/8/n7/PP6/K7 w - - 0 2');

var_dump($chess->inStalemate()); // return TRUE

board:

   +------------------------+
 8 | .  .  .  .  .  .  .  k |
 7 | p  .  .  .  .  .  .  p |
 6 | .  p  .  .  .  b  .  P |
 5 | .  .  .  q  .  .  .  . |
 4 | .  .  .  .  .  .  .  . |
 3 | n  .  .  .  .  .  .  . |
 2 | P  P  .  .  .  .  .  . |
 1 | K  .  .  .  .  .  .  . |
   +------------------------+
     a  b  c  d  e  f  g  h