# Lab 5: Checkers - 43313

Solution Posted by

Rating : (19)A+
Solution Detail
Price: \$20.00
Request Description

Lab 5: Checkers

 In this week's lab you must write a C program to display a checkers board using a 1-D array.   The board will allow players to move their pieces forward, but does not need to handle  jumps and capturing.  Pieces will either be 'X' or 'O' depending on side, blank spots on the  board will be '.', and spots that can be legally moved to must be '-.' The execution of the finished program should look like what is shown below.   (User input is shown in bold, though in your program it will not be bold.) Welcome to Checkers. -------------- Board is: A B C D E F G H X . X . X . X . 1 . X . X . X . X 2 X . X . X . X . 3 . - . - . - . -  4 - . - . - . - . 5 . O . O . O . O 6 O . O . O . O . 7 . O . O . o . O 8 Please enter the current position and desired position of the piece to be moved: A3B4 -------------- Board is: A B C D E F G H X . X . X . X . 1 . X . X . X . X 2 - . X . X . X . 3 . X . - . - . -  4 - . - . - . - . 5 . O . O . O . O 6 O . O . O . O . 7 . O . O . o . O 8 Please enter the current position and desired position of the piece to be moved: A6C5 Stage 1 (1 point): Using a 1-D array (Not a 2D array!), represent and print out a 2D checkers board.   Have '.'s for empty spaces that players cannot move a piece to, and have '-'s for empty spaces a player could eventually move a piece to.  Remember, you can only  move diagonally in checkers so every other space (in any direction) should be a '.'.                                   Example:         - . - . - . - .     . - . - . - . -     - . - . - . - .     . - . - . - . -      - . - . - . - .     . - . - . - . -     - . - . - . - .     . - . - . - . -  Stage 2 (1 point): Add the 'X' and 'O' pieces to the board and allow for movement.   You do not need to enforce turn order, nor do you need to make sure the moves are valid. Print out letters and numbers as shown in the first example to help players know what input to give.  Stage 3 (Extra Credit) (1 point): Validate moves so that no illegal moves are allowed.  You still do not need to enforce turn order.

Solution Description