func TestSimpleMateWithRook(t *testing.T) { s := "k.......\n" + "...K....\n" + "........\n" + "......R.\n" + "........\n" + "........\n" + "........\n" + "........\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 3) expecting := "g5→a5,a8→a7,d7→c7" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Moravec 1953, mate in 3 */ func TestPuzzle5(t *testing.T) { s := ".....qn.\n" + "r.nNb...\n" + "pQ.p.p..\n" + "p..k....\n" + "....R..N\n" + "..p...P.\n" + "..PP...p\n" + "K..B....\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 5) expecting := "b6→b4,d5→e4,f5→e3,a5→a4,h4→f5" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Jakab 1950, mate in 3 */ func TestPuzzle3(t *testing.T) { s := ".B.Q.R.n\n" + ".....p..\n" + "B...k...\n" + "..r.P.pP\n" + "..p.....\n" + "......K.\n" + "........\n" + ".......b\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 5) expecting := "d1→g4,e6→f5,f8→e8,c4→c3,d8→d1" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Bakcsi 1981, selfmate in 3 */ func TestPuzzle6(t *testing.T) { s := "...R....\n" + "........\n" + ".N..p...\n" + "...b.B..\n" + "..R.r...\n" + "...k....\n" + ".P.p.Q..\n" + "...K....\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "d5→b3,b4→b3,e5→d4,f2→d4,e6→e5,c4→b4" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Fokin 2004, mate in 4 */ func TestPuzzle11(t *testing.T) { s := "K.......\n" + "........\n" + "........\n" + "........\n" + "....k...\n" + "........\n" + "B..Q....\n" + "......N.\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 7) expecting := "d5→d3,e4→e3,d2→d5,e5→e4,a2→c4,e4→e5,g1→h3" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Fokin & Pochtarev 1991, mate in 3 */ func TestPuzzle1(t *testing.T) { s := "........\n" + "........\n" + "........\n" + "........\n" + ".......p\n" + "...kN..K\n" + "...PNQ..\n" + "........\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 5) expecting := "f5→d5,h4→g3,f2→f5,d3→d4,e2→g3" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Baird 1891, selfmate in 3 */ func TestPuzzle11(t *testing.T) { s := ".......n\n" + "..N....Q\n" + "......r.\n" + "..K.p...\n" + ".P..k..N\n" + ".....q..\n" + "..P.bPB.\n" + "..B.R...\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "f3→c3,b5→c3,g2→f3,f2→f3,f3→g2,c7→b5" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Dombrovskis 1955, mate in 3 */ func TestPuzzle9(t *testing.T) { s := ".....n.B\n" + "........\n" + "..N.....\n" + "..p....R\n" + ".Rbb.k..\n" + "Q...pp.P\n" + ".n..PP..\n" + ".......K\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 5) expecting := "e2→f3,f4→e4,h5→f5,b2→a4,c6→e7" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Brown 1974, selfmate in 3 */ func TestPuzzle9(t *testing.T) { s := "........\n" + "........\n" + "........\n" + "........\n" + ".....N.p\n" + ".......B\n" + "........\n" + "....RKBk\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "h3→g2,f4→e2,h4→h3,h3→g2,h1→h2,g1→f2" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Agnel 1868, selfmate in 3 */ func TestPuzzle10(t *testing.T) { s := "......b.\n" + "........\n" + "....RQ..\n" + "......p.\n" + ".......q\n" + "........\n" + "........\n" + "K.k.....\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "d1→c2,c3→c2,h4→e1,e6→e1,c1→d1,f6→c3" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Kubbel 1933, selfmate in 3 */ func TestPuzzle8(t *testing.T) { s := "....k.q.\n" + "p....np.\n" + "....K.B.\n" + "..B.QN.p\n" + "..NR...p\n" + ".p......\n" + "bP......\n" + "....b...\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "f7→d6,d5→c4,e8→d8,e6→d5,a2→b1,c4→b6" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Labai 2007, selfmate in 3 */ func TestPuzzle7(t *testing.T) { s := "..B.....\n" + "...RN...\n" + ".....p..\n" + "........\n" + "....knRK\n" + "....n.B.\n" + "....Q...\n" + "........\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "f6→g5,g4→g5,e5→f5,e2→e3,e4→e5,e7→f5" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Grin 1999, selfmate in 2 */ func TestPuzzle1(t *testing.T) { s := "........\n" + "........\n" + "........\n" + "........\n" + ".p......\n" + "k.......\n" + "..Q.....\n" + "KB......\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 4) expecting := "b3→b2,d1→g4,b4→b3,c2→d1" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Palkoska 1951, mate in 3 */ func TestPuzzle7(t *testing.T) { s := "........\n" + "....p...\n" + "...pN.nb\n" + "K......p\n" + "nNk.....\n" + "..p...Q.\n" + "..B..pp.\n" + ".....q.b\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 5) expecting := "f3→e4,d5→c4,g3→f3,c4→d5,b4→d5" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Heathcote, selfmate in 3 */ func TestPuzzle12(t *testing.T) { s := "........\n" + ".nN.Q...\n" + "..p...pr\n" + "..pp.kpb\n" + "..N...nP\n" + ".....K.B\n" + "..P..RP.\n" + "B.......\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "h5→g4,h3→g4,g5→f4,d6→f4,b7→a5,e7→d6" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Havel 1954, mate in 3 */ func TestPuzzle8(t *testing.T) { s := "....K...\n" + "..B....p\n" + "...N....\n" + "....k...\n" + "..r.....\n" + "...Q....\n" + "......B.\n" + "b.......\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 5) expecting := "d3→e4,c4→c7,d6→e8,a1→b2,e8→f8" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Vladimirov, Kopaev et al. 1975, selfmate in 3 */ func TestPuzzle13(t *testing.T) { s := "..b.....\n" + ".rBr..p.\n" + "p.p..pN.\n" + "..P..Kp.\n" + "....P.B.\n" + ".....R..\n" + "....QPk.\n" + "....R...\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "d7→d2,f2→f3,a5→a4,e2→c2,a6→a5,f3→b3" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Bolton 1842, mate in 3 */ func TestPuzzle10(t *testing.T) { s := "r....q..\n" + "rn.p..p.\n" + ".....k..\n" + "..NPN...\n" + "....p..P\n" + "....P.PQ\n" + "PP......\n" + ".K......\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 5) expecting := "d7→e6,e7→f6,f5→d7,f6→e7,h3→f5" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Mikan 1963, selfmate in 3 */ func TestPuzzle2(t *testing.T) { s := "........\n" + "........\n" + "........\n" + "...R....\n" + ".....N.Q\n" + ".p.Bpk..\n" + ".p..R..p\n" + ".N.KB.nr\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "e2→c3,b1→c3,f3→e4,g6→h5,g1→e2,d3→g6" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Fokin 2003, mate in 4 */ func TestPuzzle12(t *testing.T) { s := "...N....\n" + "...N....\n" + "....B...\n" + "........\n" + ".....k.B\n" + "...K....\n" + "........\n" + "........\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 7) expecting := "d7→e5,f4→f3,d8→e6,f3→f4,h4→e1,f4→f3,e6→h3" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Avner & Gordian 1995, selfmate in 3 */ func TestPuzzle3(t *testing.T) { s := "........\n" + "Bpp.....\n" + ".rr..p..\n" + "KBk..N..\n" + "R.......\n" + "p.......\n" + "Q....N..\n" + "........\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "b6→b5,c4→b5,c5→c6,f2→e4,c6→d6,b5→c4" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Fokin 1983, mate in 3 */ func TestPuzzle2(t *testing.T) { s := "........\n" + ".....Q.R\n" + "........\n" + "K.......\n" + "..N.k...\n" + ".......p\n" + "........\n" + "........\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 5) expecting := "h7→h3,d3→c3,c4→d6,e4→d3,f7→f2" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Mikan 1955, selfmate in 3 */ func TestPuzzle4(t *testing.T) { s := "........\n" + "...N...p\n" + "....R.BQ\n" + ".R..bq..\n" + "....k..K\n" + "....P...\n" + "....PP..\n" + ".......N\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "g6→h7,h6→h7,e4→f5,f2→f3,f5→g6,e6→e8" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }
/** * Breuer 1951, mate in 3 */ func TestPuzzle4(t *testing.T) { s := "......q.\n" + "........\n" + "........\n" + "...pB...\n" + "...NpN..\n" + "....k...\n" + ".pQ.....\n" + ".Kn.....\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) mate := Find(logger, board, 5) expecting := "h2→e2,e3→f3,d4→f5,c1→a2,c2→h2" if mate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, mate)) } }
/** * Mikan 1977, selfmate in 3 */ func TestPuzzle5(t *testing.T) { s := "......R.\n" + "......NR\n" + "........\n" + "........\n" + ".....Pk.\n" + "...N.qp.\n" + "......Qp\n" + "...BB..K\n" board, _ := core.Parse(s, core.White) logger := logger.New(false) selfmate := Find(logger, board, 6) expecting := "e2→h2,g2→h2,g4→h4,h5→g5,f3→e2,h7→h5" if selfmate.String() != expecting { t.Error(fmt.Printf("Expecting: %s, but got %s", expecting, selfmate)) } }