fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <assert.h>
  4.  
  5. using namespace std;
  6.  
  7. const int NUM_ROWS = 9;
  8. const int NUM_COLS = 9;
  9.  
  10.  
  11. // **************** CLASS: CELL *******************
  12. class Cell {
  13. char piece;
  14. char color;
  15. public:
  16. Cell();
  17. void place(char color, char piece);
  18. string take();
  19. string getPiece();
  20. string look();
  21. };
  22.  
  23. Cell::Cell() {
  24. piece = ' ';
  25. color = ' ';
  26. }
  27.  
  28. string Cell::look() {
  29. string result = "";
  30. result = result.append(1, color);
  31. result = result.append(1, piece);
  32. return result;
  33. }
  34.  
  35. string Cell::take() {
  36. string result = look();
  37. piece = ' ';
  38. color = ' ';
  39. return result;
  40. }
  41.  
  42. void Cell::place(char newColor, char newPiece) {
  43. //assert((newColor == 'W') || (newColor == 'B'));
  44. color = newColor;
  45. //assert((newPiece == 'R') || (newPiece == 'K') || (newPiece == 'B') || (newPiece == 'Q') || (newPiece == 'K') || (newPiece == 'N') || (newPiece == 'P'));
  46. piece = newPiece;
  47.  
  48. }
  49.  
  50. string Cell::getPiece() {
  51. string result = "";
  52. result = result.append(1, color);
  53. result = result.append(1, piece);
  54. return result;
  55. }
  56.  
  57. // **************** CLASS: BOARD *******************
  58. class Board {
  59. Cell board[NUM_ROWS][NUM_COLS]; // <-- Not a good idea in the long run
  60. void displayLine();
  61. bool moveRook(int row, int col, string direction, int steps);
  62. bool movePawn(int row, int col, string direction, int steps);
  63. bool moveBishop(int row, int col, string direction, int steps);
  64. bool moveQueen(int row, int col, string direction, int steps);
  65. bool moveKing(int row, int col, string direction, int steps);
  66. bool moveKnight(int row, int col, string direction, int steps);
  67.  
  68. public:
  69. Board(string = "WITHPAWNS");
  70. Board(string, int, int, char, char); // Constructor for board with only one piece
  71. void displayBoard();
  72. void place(int, int, char, char);
  73. string take(int, int);
  74. bool cellEmpty(int, int);
  75. string look(int, int);
  76. bool movePieceOneStep(string, string, int&, int&);
  77. bool movePiece(int row, int col, string direction, int steps);
  78. bool turn(int row, int col, string direction, int numSpaces);
  79. };
  80. bool Board::cellEmpty(int row, int col) {
  81. if (board[row][col].getPiece() == " ")
  82. return true;
  83. return false;
  84. }
  85.  
  86. void Board::place(int row, int col, char color, char peice) {
  87. assert((row >= 0) && (row < NUM_ROWS));
  88. assert((col >= 0) && (col < NUM_COLS));
  89. board[row][col].place(color, peice);
  90.  
  91. }
  92.  
  93. string Board::look(int row, int col) {
  94. assert((row >= 0) && (row < NUM_ROWS));
  95. assert((col >= 0) && (col < NUM_COLS));
  96. return board[row][col].look();
  97.  
  98. }
  99. string Board::take(int row, int col) {
  100. assert((row >= 0) && (row < NUM_ROWS));
  101. assert((col >= 0) && (col < NUM_COLS));
  102. return board[row][col].take();
  103.  
  104. }
  105. Board::Board(string command, int row, int col, char color, char piece) {
  106. if (command == "ONEPIECE") {
  107. board[row][col].place(color, piece);
  108. return;
  109. }
  110. }
  111. Board::Board(string command) {
  112. board[0][1].place('0', ' ');
  113. board[0][2].place('1', ' ');
  114. board[0][3].place('2', ' ');
  115. board[0][4].place('3', ' ');
  116. board[0][5].place('4', ' ');
  117. board[0][6].place('5', ' ');
  118. board[0][7].place('6', ' ');
  119. board[0][8].place('7', ' ');
  120.  
  121. board[1][0].place('0', ' ');
  122. board[2][0].place('1', ' ');
  123. board[3][0].place('2', ' ');
  124. board[4][0].place('3', ' ');
  125. board[5][0].place('4', ' ');
  126. board[6][0].place('5', ' ');
  127. board[7][0].place('6', ' ');
  128. board[8][0].place('7', ' ');
  129.  
  130. board[1][1].place('B', 'R');
  131. board[1][2].place('B', 'N');
  132. board[1][3].place('B', 'B');
  133. board[1][4].place('B', 'Q');
  134. board[1][5].place('B', 'K');
  135. board[1][6].place('B', 'B');
  136. board[1][7].place('B', 'N');
  137. board[1][8].place('B', 'R');
  138. if (command != "NOPAWNS") {
  139. for (int c = 1; c < NUM_COLS; c++) {
  140. board[2][c].place('B', 'P');
  141. }
  142. }
  143.  
  144. board[NUM_ROWS - 1][1].place('W', 'R');
  145. board[NUM_ROWS - 1][2].place('W', 'N');
  146. board[NUM_ROWS - 1][3].place('W', 'B');
  147. board[NUM_ROWS - 1][4].place('W', 'K');
  148. board[NUM_ROWS - 1][5].place('W', 'Q');
  149. board[NUM_ROWS - 1][6].place('W', 'B');
  150. board[NUM_ROWS - 1][7].place('W', 'N');
  151. board[NUM_ROWS - 1][8].place('W', 'R');
  152. if (command != "NOPAWNS") {
  153. for (int c = 1; c < NUM_COLS; c++) {
  154. board[NUM_COLS - 2][c].place('W', 'P');
  155. }
  156. }
  157.  
  158. }
  159. void Board::displayLine() {
  160. cout << endl;
  161. for (int x = 0; x < NUM_COLS; x++) {
  162. cout << " | ";
  163. }
  164. cout << endl;
  165. for (int x = 0; x < NUM_COLS; x++) {
  166. cout << "----| ";
  167. }
  168. cout << endl;
  169.  
  170. }
  171.  
  172. void Board::displayBoard() {
  173. //return; // DEBUG
  174. cout << endl << "CURRENT BOARD:" << endl << endl;
  175. for (int r = 0; r < NUM_ROWS; r++) {
  176. for (int c = 0; c < NUM_COLS; c++) {
  177. cout << " " << board[r][c].getPiece() << " | ";
  178. }
  179. displayLine();
  180. }
  181. cout << endl << endl;
  182. }
  183.  
  184. bool Board::movePieceOneStep(string piece, string direction, int &row, int &col) {
  185. assert((row >= 1) && (row < NUM_ROWS));
  186. assert((col >= 1) && (col < NUM_COLS));
  187. int toRow = row;
  188. int toCol = col;
  189. if (direction == "S")
  190. toRow = row + 1;
  191. else if (direction == "N")
  192. toRow = row - 1;
  193. else if (direction == "E")
  194. toCol = col + 1;
  195. else if (direction == "W")
  196. toCol = col - 1;
  197. else if (direction == "NW") {
  198. toRow = row - 1;
  199. toCol = col - 1;
  200. }
  201. else if (direction == "NE") {
  202. toRow = row - 1;
  203. toCol = col + 1;
  204. }
  205. else if (direction == "SW") {
  206. toRow = row + 1;
  207. toCol = col - 1;
  208. }
  209. else if (direction == "SE") {
  210. toRow = row + 1;
  211. toCol = col + 1;
  212. }
  213. else {
  214. cout << "INVALID DIRECTION!" << endl;
  215. assert(false); // force a failure
  216. }
  217.  
  218. assert((toRow >= 1) && (toRow < NUM_ROWS));
  219. assert((toCol >= 1) && (toCol < NUM_COLS));
  220.  
  221. if (!cellEmpty(toRow, toCol)) {
  222. string movingPiece = look(row, col);
  223. string blockingPiece = look(toRow, toCol);
  224. if(movingPiece.at(0) == 'W' && blockingPiece.at(0) == 'B'){
  225. piece = take(toRow, toCol);
  226. }
  227. else if(movingPiece.at(0) == 'W' && blockingPiece.at(0) == 'W'){
  228. cout << "Space [ " << toRow << ", " << toCol <<
  229. "] Contains [" << look(toRow, toCol) << "]" << endl;
  230. return false;
  231. }
  232. else if(movingPiece.at(0) == 'B' && blockingPiece.at(0) == 'W'){
  233. piece = take(toRow, toCol);
  234. }
  235. else if(movingPiece.at(0) == 'B' && blockingPiece.at(0) == 'B'){
  236. cout << "Space [ " << toRow << ", " << toCol <<
  237. "] Contains [" << look(toRow, toCol) << "]" << endl;
  238. return false;
  239. }
  240. }
  241.  
  242. piece = take(row, col);
  243. place(toRow, toCol, piece.at(0), piece.at(1));
  244. row = toRow;
  245. col = toCol;
  246.  
  247. return true;
  248. }
  249.  
  250. bool Board::moveQueen(int row, int col, string direction, int steps) {
  251. string piece = look(row, col);
  252. assert(piece.at(1) == 'Q');
  253.  
  254. for (int x = 0; x < steps; x++) {
  255. if (!movePieceOneStep(piece, direction, row, col))
  256. return false;
  257. }
  258. return true;
  259. }
  260.  
  261. bool Board::moveKing(int row, int col, string direction, int steps) {
  262. string piece = look(row, col);
  263. assert(piece.at(1) == 'K');
  264.  
  265. if (steps > 1) {
  266. cout << "Kings can not move " << steps << " steps at a time!" << endl;
  267. return false;
  268. }
  269.  
  270. if (!movePieceOneStep(piece, direction, row, col))
  271. return false;
  272.  
  273. return true;
  274. }
  275.  
  276. bool Board::moveBishop(int row, int col, string direction, int steps) {
  277. string piece = look(row, col);
  278. assert(piece.at(1) == 'B');
  279.  
  280. if (!((direction == "NE") || (direction == "SE") || (direction == "NW") || (direction == "SW"))) {
  281. cout << "Bishops can not move " << direction << "!" << endl;
  282. return false;
  283. }
  284. for (int x = 0; x < steps; x++) {
  285. if (!movePieceOneStep(piece, direction, row, col))
  286. return false;
  287. }
  288. return true;
  289. }
  290.  
  291. bool Board::moveRook(int row, int col, string direction, int steps) {
  292. string piece = look(row, col);
  293. assert(piece.at(1) == 'R');
  294.  
  295. if (!((direction == "N") || (direction == "S") || (direction == "W") || (direction == "E"))) {
  296. cout << "Rooks can not move " << direction << "!" << endl;
  297. return false;
  298. }
  299. for (int x = 0; x < steps; x++) {
  300. if (!movePieceOneStep(piece, direction, row, col))
  301. return false;
  302. }
  303. return true;
  304. }
  305. bool Board::moveKnight(int row, int col, string direction, int steps) {
  306. string piece = look(row, col);
  307. assert(piece.at(1) == 'N');
  308.  
  309. if (steps > 1) {
  310. cout << "Knights can not move " << steps << " steps at a time!" << endl;
  311. return false;
  312. }
  313. int toRow = row;
  314. int toCol = col;
  315. if (direction == "NNE") {
  316. toRow -= 2;
  317. toCol += 1;
  318. }
  319. else if (direction == "NEE") {
  320. toRow -= 1;
  321. toCol += 2;
  322. }
  323. else if (direction == "SEE") {
  324. toRow += 1 ;
  325. toCol += 2;
  326. }
  327. else if (direction == "SSE") {
  328. toRow += 2 ;
  329. toCol += 1;
  330. }
  331. else if (direction == "SSW") {
  332. toRow += 2;
  333. toCol -= 1;
  334. }
  335. else if (direction == "SWW") {
  336. toRow += 1;
  337. toCol -= 2;
  338. }
  339. else if (direction == "NWW") {
  340. toRow -= 1;
  341. toCol -= 2;
  342. }
  343. else if (direction == "NNW") {
  344. toRow -= 2;
  345. toCol -= 1;
  346. }
  347. else {
  348. cout << "Knights can not move " << direction << "!" << endl;
  349. return false;
  350. }
  351.  
  352. if (!cellEmpty(toRow, toCol)) {
  353. string movingPiece = look(row, col);
  354. string blockingPiece = look(toRow, toCol);
  355. if(movingPiece.at(0) == 'W' && blockingPiece.at(0) == 'B'){
  356. piece = take(toRow, toCol);
  357. }
  358. else if(movingPiece.at(0) == 'W' && blockingPiece.at(0) == 'W'){
  359. cout << "Space [ " << toRow << ", " << toCol <<
  360. "] Contains [" << look(toRow, toCol) << "]" << endl;
  361. return false;
  362. }
  363. else if(movingPiece.at(0) == 'B' && blockingPiece.at(0) == 'W'){
  364. piece=take(toRow, toCol);
  365. }
  366. else if(movingPiece.at(0) == 'B' && blockingPiece.at(0) == 'B'){
  367. cout << "Space [ " << toRow << ", " << toCol <<
  368. "] Contains [" << look(toRow, toCol) << "]" << endl;
  369. return false;
  370. }
  371. }
  372.  
  373.  
  374. piece = take(row, col);
  375. place(toRow, toCol, piece.at(0), piece.at(1));
  376.  
  377. return true;
  378. }
  379.  
  380. bool Board::movePawn(int row, int col, string direction, int steps) {
  381. string piece = look(row, col);
  382. assert(piece.at(1) == 'P');
  383.  
  384. if ((piece.at(0) == 'W') && (direction != "N")) {
  385. cout << "White pawns can not move " << direction << "!" << endl;
  386. return false;
  387. }
  388. if ((piece.at(0) == 'B') && (direction != "S")) {
  389. cout << "Black pawns can not move " << direction << "!" << endl;
  390. return false;
  391. }
  392. if (steps > 2) {
  393. cout << "Pawns can not move " << steps << " steps at a time!" << endl;
  394. return false;
  395. }
  396. else if ((row == 2 && steps <= 2) || (row == 7 && steps <=2)){
  397. for (int x = 0; x < steps; x++) {
  398. if (!movePieceOneStep(piece, direction, row, col))
  399. return false;
  400. }
  401. }
  402. else if (steps == 1){
  403. for (int x = 0; x < steps; x++) {
  404. if (!movePieceOneStep(piece, direction, row, col))
  405. return false;
  406. }
  407. }
  408. return true;
  409. }
  410.  
  411. bool Board::movePiece(int row, int col, string direction, int steps) {
  412. int holdRow = row, holdCol = col; // <---- CHANGED!
  413. bool result = false; // <---- CHANGED!
  414. string piece = look(row, col);
  415. cout << "*** MOVING " << piece << " FROM [" << row << ", " << col
  416. << "] Direction:" << direction << " #steps: " << steps << endl;
  417. if (piece.at(1) == 'R')
  418. result = moveRook(row, col, direction, steps);
  419. else if (piece.at(1) == 'P')
  420. result = movePawn(row, col, direction, steps);
  421. else if (piece.at(1) == 'B')
  422. result = moveBishop(row, col, direction, steps);
  423. else if (piece.at(1) == 'Q')
  424. result = moveQueen(row, col, direction, steps);
  425. else if (piece.at(1) == 'K')
  426. result = moveKing(row, col, direction, steps);
  427. else if (piece.at(1) == 'N')
  428. result = moveKnight(row, col, direction, steps);
  429. else {
  430. cout << "Invalid piece " << piece << " at position [" << row << ", " << col << "]" << endl;
  431. assert(false);
  432. }
  433. if (result) { // <---- CHANGED!
  434. return true; // <---- CHANGED!
  435. }
  436. else{// did not work, put it back
  437. piece = take(row, col); // <---- CHANGED!
  438. place(holdRow, holdCol, piece.at(0), piece.at(1)); // <---- CHANGED!
  439.  
  440. return false;
  441. } // <---- CHANGED!
  442.  
  443. }
  444.  
  445.  
  446. bool Board::turn(int row, int col, string direction, int numSpaces) {
  447. if ((row < 1) || (row >= NUM_ROWS)) {
  448. cout << "OUT OF BOUNDS!" << endl;
  449. assert(false); // temporary
  450. return false;
  451. }
  452. if ((col < 1) || (col >= NUM_COLS)) {
  453. cout << "OUT OF BOUNDS!" << endl;
  454. assert(false); // temporary
  455. return false;
  456. }
  457. if (!movePiece(row, col, direction, numSpaces)) {
  458. cout << "Failed to move the piece the entire way!" << endl;
  459. // assert(false); // temporary
  460. }
  461. displayBoard();
  462.  
  463. return true;
  464. }
  465. bool makeMove(Board &x, char c){
  466. x;
  467. int row;
  468. int col;
  469. string direction = "";
  470. int numSteps;
  471. if(c=='W'){
  472. cout << "White's Turn!" << endl;
  473. cout << "Enter row: ";
  474. cin >> row;
  475. cout << row << endl;
  476. cout << "Enter column: ";
  477. cin >> col;
  478. cout << col << endl;
  479. cout << "Enter direction: ";
  480. cin >> direction;
  481. cout << direction << endl;
  482. cout << "Enter number of steps: ";
  483. cin >> numSteps;
  484. cout << numSteps << endl;
  485. string piece = x.look((row + 1), (col +1));
  486. if(piece.at(0) == 'W'){
  487. if(!x.turn(row + 1, col + 1, direction, numSteps)){
  488. cout << "Invalid Move. Try another move." << endl;
  489. return false;
  490. }
  491. return true;
  492. }
  493. else{
  494. cout << "White Player can't move that." << endl;
  495. return false;
  496. }
  497. }
  498. else if (c == 'B'){
  499. cout << "Black's Turn!" << endl;
  500. cout << "Enter row: ";
  501. cin >> row;
  502. cout << row << endl;
  503. cout << "Enter column: ";
  504. cin >> col;
  505. cout << col << endl;
  506. cout << "Enter direction: ";
  507. cin >> direction;
  508. cout << direction << endl;
  509. cout << "Enter number of steps: ";
  510. cin >> numSteps;
  511. cout << numSteps << endl;
  512. string piece = x.look((row +1), (col + 1));
  513. if(piece.at(0) == 'B'){
  514. if(!x.turn(row + 1, col + 1, direction, numSteps)){
  515. cout << "Invalid Move. Try another move." << endl;
  516. return false;
  517. }
  518. return true;
  519. }
  520. else{
  521. cout << "Black Player can't move that." << endl;
  522. return false;
  523. }
  524. }
  525. }
  526. bool mated(){
  527. return false;
  528. }
  529. int main() {
  530.  
  531. Board board;
  532.  
  533. string goOn = "";
  534.  
  535. cout << "BEGINNING BOARD:" << endl;
  536.  
  537. board.displayBoard();
  538.  
  539. while ((goOn != "N") && (goOn != "n")) {
  540.  
  541. if (mated())
  542.  
  543. break;
  544.  
  545. while (!makeMove(board, 'W')){
  546. continue;
  547. }
  548.  
  549. if (mated())
  550.  
  551. break;
  552.  
  553. while (!makeMove(board, 'B')){
  554. continue;
  555. }
  556.  
  557. cout << "Continue? (Y/N) ";
  558.  
  559. cin >> goOn;
  560. cout << goOn << endl;
  561.  
  562. }
  563.  
  564. cout << "ENDING BOARD:" << endl;
  565.  
  566. board.displayBoard();
  567.  
  568. return 0;
  569.  
  570. }
  571.  
Success #stdin #stdout 0s 3484KB
stdin
6
1
N
2
1
1
S
2
n
stdout
BEGINNING BOARD:

CURRENT BOARD:

    |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 0  |  BR |  BN |  BB |  BQ |  BK |  BB |  BN |  BR | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 1  |  BP |  BP |  BP |  BP |  BP |  BP |  BP |  BP | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 2  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 3  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 4  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 5  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 6  |  WP |  WP |  WP |  WP |  WP |  WP |  WP |  WP | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 7  |  WR |  WN |  WB |  WK |  WQ |  WB |  WN |  WR | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 


White's Turn!
Enter row: 6
Enter column: 1
Enter direction: N
Enter number of steps: 2
*** MOVING WP FROM [7, 2] Direction:N #steps: 2

CURRENT BOARD:

    |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 0  |  BR |  BN |  BB |  BQ |  BK |  BB |  BN |  BR | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 1  |  BP |  BP |  BP |  BP |  BP |  BP |  BP |  BP | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 2  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 3  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 4  |     |  WP |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 5  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 6  |  WP |     |  WP |  WP |  WP |  WP |  WP |  WP | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 7  |  WR |  WN |  WB |  WK |  WQ |  WB |  WN |  WR | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 


Black's Turn!
Enter row: 1
Enter column: 1
Enter direction: S
Enter number of steps: 2
*** MOVING BP FROM [2, 2] Direction:S #steps: 2

CURRENT BOARD:

    |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 0  |  BR |  BN |  BB |  BQ |  BK |  BB |  BN |  BR | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 1  |  BP |     |  BP |  BP |  BP |  BP |  BP |  BP | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 2  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 3  |     |  BP |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 4  |     |  WP |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 5  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 6  |  WP |     |  WP |  WP |  WP |  WP |  WP |  WP | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 7  |  WR |  WN |  WB |  WK |  WQ |  WB |  WN |  WR | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 


Continue? (Y/N) n
ENDING BOARD:

CURRENT BOARD:

    |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 0  |  BR |  BN |  BB |  BQ |  BK |  BB |  BN |  BR | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 1  |  BP |     |  BP |  BP |  BP |  BP |  BP |  BP | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 2  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 3  |     |  BP |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 4  |     |  WP |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 5  |     |     |     |     |     |     |     |     | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 6  |  WP |     |  WP |  WP |  WP |  WP |  WP |  WP | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----| 
 7  |  WR |  WN |  WB |  WK |  WQ |  WB |  WN |  WR | 
    |     |     |     |     |     |     |     |     | 
----| ----| ----| ----| ----| ----| ----| ----| ----|