?
.
?
.

,
« ».
— , , , .
, , , , . : C#, JavaScript, PHP, HTML, CSS.
, . , .
, «» , . , . , .
?
64 . .
— 64 * 64 * 64 * 64 = 16,777,216.
.
: 64 * 32 * 64 * 64 = 8,388,608.
.
: , , . , 5,609,790 , 67%.
« » .
:
    struct Combo
    {
        public Coord whiteKing;
        public Coord whiteBishop;
        public Coord whiteKnight;
        public Coord blackKing;
    }
Coord , 0 63, .
    public struct Coord
    {
        public byte x; 
        public byte y; 
        
        public int index
        {
            get { return x + y * 8; }
            set { x = (byte) (value % 8); 
                  y = (byte) (value / 8); }
        }
        
        public static bool operator == (Coord a, Coord b)
        {
            return a.x == b.x && a.y == b.y;
        }
    }
, :
    bool isCheck (Combo combo); 
    bool isCheckmate (Combo combo); 
    bool isCheckByBishop (Combo combo); 
, …
« », , « », — , .
« » :
    struct WhitesMove
    {
        public Combo combo;
        public byte moves;     
        public Coord moveFrom; 
        public Coord moveTo;   
    }
« » . :
    WhitesMove [ , , , ] box = new WhitesMove [64, 32, 64, 64];
— .
— / 2.
— .
— .
— :) 33% , . 8,388,608 .
, , , , - . , , 64 , Turbo Pascal 7.0.
. , , . — «» «».
    Queue<BlacksMove> blackQueue = new Queue<BlacksMove>();
    Queue<WhitesMove> whiteQueue = new Queue<WhitesMove>();
WhitesMove . BlacksMove , .
struct BlacksMove
    {
        public Combo combo;
        public byte moves; 
    }
« » , . « » — , .
.
:
       " ", " ", " "
         
         " "
      
      {
           " "  
                 " "
                    
                      
                           " "
                             " "
                             " "
           " "  
                 " "
                      
                        
                      " "
                         " "
      }  " "  
       " "   
. .
    foreach (Combo combo in AllCheckmates())
    {
        BlacksMove checkmate = new BlacksMove { combo = combo, moves = 0 };
        blackQueue.Enqueue(checkmate);
    }
232 . , .
, «», .

, . . , :)
— . , 
.
? , , — , .
« », , , . « ».
:
    
    while (blackQueue.Count > 0)
    {
        
        BlacksMove black = blackQueue.Dequeue();
        
        foreach (WhitesMove white in AllWhiteBackMoves(black))
            
            if (!isCheck(white.combo))
                
                if (!whiteBox.Exists(white.combo))
                {
                    
                    whiteBox.Put (white);
                    
                    whiteQueue.Enqueue(white);
                }
    }
, yieldyield- , , :
        IEnumerable<WhitesMove> AllWhiteBackMoves(BlacksMove black)
        {
            foreach (WhitesMove white in AllWhiteKingMoves(black))
                yield return white;
            foreach (WhitesMove white in AllWhiteBishopMoves(black))
                yield return white;
            foreach (WhitesMove white in AllWhiteKnightMoves(black))
                yield return white;
        }
 920 , :
:
 
  
 
:
 
 
:

— . , , .
, : « » . « » — , — — , .
. «» , . , , .
: N , , « », . N « ». N «», . , .
:
    
    while (whiteQueue.Count > 0)
    {
        
        WhitesMove white = whiteQueue.Dequeue();
        Combo whiteFigures = white.combo;
        
        foreach (BlacksMove black in AllBlackBackMoves(white))
        {
            bool solved = true;
            
            foreach (Coord blackKing in AllKingMoves(black.combo.blackKing))
            {
                whiteFigures.blackKing = blackKing; 
                if (isCheck(whiteFigures)) 
                    continue;
                if (box.Exists(whiteFigures)) 
                    continue;
                solved = false; 
                break;
            }
            
            
            if (solved)
                
                blackQueue.Enqueue(black);
        }
    }
156 « ».
. « » « », — «» «». , . « » « », , .
- 12 33 . , .
, « » , 156, :

!
, . . .
 
 
 
 
?
— . 1.7 (!) . , .
, , . , . .
! . , .
— . , .
? , — , . .
6 . — 0 33.
2 . — , , .
6 . — 0 63.
, :
1 — , 0, .
2 — FFNNNNNN
FF — , (1 — , 2 — , 3 — )
NNNNNN — — ( 0 63).
, 64 * 32 * 64 * 64 = 16 . , — ( 0 ), .
, , .
. «-» .
. , «». Y , X 7-X. . .

, «» . . «» .
, !
.
?
— web-, . « » "
-", HTML, CSS, JavaScript PHP . .
, , - « » JavaScript.
www.videosharp.info/chess .

, .
— , .
— .
, .
, , .
, .
, .
— 
.
!