Mert Us Matthew Hannay Logan Starr

Dependencies:   mbed 4DGL-uLCD-SE

Committer:
mus3
Date:
Fri Nov 11 07:13:53 2022 +0000
Revision:
3:0f979d8d3fa1
Parent:
2:80f1d1056ae4
changed bitset to array, now compiles

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mhannay3 1:cd78922f70fa 1 #include <bitset>
mus3 3:0f979d8d3fa1 2 #include "mbed.h"
mus3 3:0f979d8d3fa1 3 #include "uLCD_4DGL.h"
mhannay3 1:cd78922f70fa 4
mus3 3:0f979d8d3fa1 5 enum Piece : uint8_t {e, wK, bK, wQ, bQ, wR, bR, wB, bB, wN, bN, w, b};
mhannay3 1:cd78922f70fa 6
mhannay3 1:cd78922f70fa 7 struct coord {
mhannay3 1:cd78922f70fa 8 uint8_t x;
mhannay3 1:cd78922f70fa 9 uint8_t y;
mus3 3:0f979d8d3fa1 10 };
mhannay3 1:cd78922f70fa 11
mhannay3 1:cd78922f70fa 12 class Board {
mhannay3 1:cd78922f70fa 13 private:
mus3 3:0f979d8d3fa1 14 Piece boardState[64];
mhannay3 1:cd78922f70fa 15 const uint32_t BOARD_DARK_COLOR = 0x769656;
mhannay3 1:cd78922f70fa 16 const uint32_t BOARD_LIGHT_COLOR = 0xbaca44;
mhannay3 1:cd78922f70fa 17 const uint32_t HOVER_COLOR = 0x0000ff;
mhannay3 1:cd78922f70fa 18 const uint32_t SELECTED_COLOR = 0xff8800;
mhannay3 1:cd78922f70fa 19
mhannay3 1:cd78922f70fa 20 // piece sprites (12 x 12)
mhannay3 1:cd78922f70fa 21 uint32_t* spritePawn(bool white, bool light) {
mhannay3 1:cd78922f70fa 22 uint32_t X = white ? 0xffffff : 0x000000;
mhannay3 1:cd78922f70fa 23 uint32_t _ = light ? BOARD_LIGHT_COLOR : BOARD_DARK_COLOR;
mus3 3:0f979d8d3fa1 24 uint32_t r[] = {_, _, _, _, _, _, _, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 25 _, _, _, _, _, _, _, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 26 _, _, _, _, _, _, _, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 27 _, _, _, _, _, _, _, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 28 _, _, _, _, _, X, X, _, _, _, _, _,
mhannay3 1:cd78922f70fa 29 _, _, _, _, X, X, X, X, _, _, _, _,
mhannay3 1:cd78922f70fa 30 _, _, _, _, X, X, X, X, _, _, _, _,
mhannay3 1:cd78922f70fa 31 _, _, _, _, _, X, X, _, _, _, _, _,
mhannay3 1:cd78922f70fa 32 _, _, _, _, _, X, X, _, _, _, _, _,
mhannay3 1:cd78922f70fa 33 _, _, _, _, X, X, X, X, _, _, _, _,
mhannay3 2:80f1d1056ae4 34 _, _, X, X, X, X, X, X, X, X, _, _,
mus3 3:0f979d8d3fa1 35 _, _, X, X, X, X, X, X, X, X, _, _};
mus3 3:0f979d8d3fa1 36 return r;
mhannay3 1:cd78922f70fa 37 }
mhannay3 1:cd78922f70fa 38
mhannay3 1:cd78922f70fa 39 uint32_t* spriteRook(bool white, bool light) {
mhannay3 1:cd78922f70fa 40 uint32_t X = white ? 0xffffff : 0x000000;
mhannay3 1:cd78922f70fa 41 uint32_t _ = light ? BOARD_LIGHT_COLOR : BOARD_DARK_COLOR;
mus3 3:0f979d8d3fa1 42 uint32_t r[] = {X, X, _, X, X, _, _, X, X, _, X, X,
mhannay3 2:80f1d1056ae4 43 X, X, _, X, X, _, _, X, X, _, X, X,
mhannay3 2:80f1d1056ae4 44 X, X, X, X, X, X, X, X, X, X, X, X,
mhannay3 2:80f1d1056ae4 45 X, X, X, X, X, X, X, X, X, X, X, X,
mhannay3 2:80f1d1056ae4 46 _, X, X, X, _, X, X, _, X, X, X, _,
mhannay3 2:80f1d1056ae4 47 _, X, X, X, _, X, X, _, X, X, X, _,
mhannay3 2:80f1d1056ae4 48 _, _, X, X, _, X, X, _, X, X, _, _,
mhannay3 2:80f1d1056ae4 49 _, _, X, X, _, X, X, _, X, X, _, _,
mhannay3 2:80f1d1056ae4 50 _, _, X, X, _, X, X, _, X, X, _, _,
mhannay3 2:80f1d1056ae4 51 _, X, X, X, X, X, X, X, X, X, X, _,
mhannay3 1:cd78922f70fa 52 X, X, X, X, X, X, X, X, X, X, X, X,
mhannay3 2:80f1d1056ae4 53 X, X, X, X, X, X, X, X, X, X, X, X};
mus3 3:0f979d8d3fa1 54 return r;
mhannay3 2:80f1d1056ae4 55 }
mhannay3 2:80f1d1056ae4 56
mhannay3 2:80f1d1056ae4 57 uint32_t* spriteKnight(bool white, bool light) {
mhannay3 2:80f1d1056ae4 58 uint32_t X = white ? 0xffffff : 0x000000;
mhannay3 2:80f1d1056ae4 59 uint32_t _ = light ? BOARD_LIGHT_COLOR : BOARD_DARK_COLOR;
mus3 3:0f979d8d3fa1 60 uint32_t r[] = {_, _, _, _, _, _, _, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 61 _, _, _, _, _, X, X, _, X, X, _, _,
mhannay3 2:80f1d1056ae4 62 _, _, _, _, _, X, X, _, X, X, _, _,
mhannay3 2:80f1d1056ae4 63 _, _, _, X, X, X, X, X, X, _, _, _,
mhannay3 2:80f1d1056ae4 64 _, _, X, X, X, X, X, _, X, _, _, _,
mhannay3 2:80f1d1056ae4 65 _, _, X, X, X, X, X, X, X, _, _, _,
mhannay3 2:80f1d1056ae4 66 _, _, _, _, _, X, X, X, X, _, _, _,
mhannay3 2:80f1d1056ae4 67 _, _, _, _, X, X, X, X, X, _, _, _,
mhannay3 2:80f1d1056ae4 68 _, _, _, X, X, X, X, X, X, X, _, _,
mhannay3 2:80f1d1056ae4 69 _, _, X, X, X, X, X, X, X, X, _, _,
mhannay3 2:80f1d1056ae4 70 _, X, X, X, X, X, X, X, X, X, X, _,
mhannay3 2:80f1d1056ae4 71 _, X, X, X, X, X, X, X, X, X, X, _};
mus3 3:0f979d8d3fa1 72 return r;
mhannay3 2:80f1d1056ae4 73 }
mhannay3 2:80f1d1056ae4 74
mhannay3 2:80f1d1056ae4 75 uint32_t* spriteBishop(bool white, bool light) {
mhannay3 2:80f1d1056ae4 76 uint32_t X = white ? 0xffffff : 0x000000;
mhannay3 2:80f1d1056ae4 77 uint32_t _ = light ? BOARD_LIGHT_COLOR : BOARD_DARK_COLOR;
mus3 3:0f979d8d3fa1 78 uint32_t r[] = {_, _, _, _, _, X, X, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 79 _, _, _, _, X, X, X, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 80 _, _, _, X, X, X, _, _, X, _, _, _,
mhannay3 2:80f1d1056ae4 81 _, _, _, X, X, _, _, X, X, _, _, _,
mhannay3 2:80f1d1056ae4 82 _, _, _, X, X, X, X, X, X, _, _, _,
mhannay3 2:80f1d1056ae4 83 _, _, _, _, X, X, X, X, _, _, _, _,
mhannay3 2:80f1d1056ae4 84 _, _, _, _, _, X, X, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 85 _, _, _, _, X, X, X, X, _, _, _, _,
mhannay3 2:80f1d1056ae4 86 _, _, _, X, X, X, X, X, X, _, _, _,
mhannay3 2:80f1d1056ae4 87 _, _, _, X, X, X, X, X, X, _, _, _,
mhannay3 2:80f1d1056ae4 88 _, _, X, X, X, X, X, X, X, X, _, _,
mhannay3 2:80f1d1056ae4 89 _, _, X, X, X, X, X, X, X, X, _, _};
mus3 3:0f979d8d3fa1 90 return r;
mhannay3 2:80f1d1056ae4 91 }
mhannay3 2:80f1d1056ae4 92
mhannay3 2:80f1d1056ae4 93 uint32_t* spriteQueen(bool white, bool light) {
mhannay3 2:80f1d1056ae4 94 uint32_t X = white ? 0xffffff : 0x000000;
mhannay3 2:80f1d1056ae4 95 uint32_t _ = light ? BOARD_LIGHT_COLOR : BOARD_DARK_COLOR;
mus3 3:0f979d8d3fa1 96 uint32_t r[] = {_, _, _, _, _, X, X, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 97 _, _, X, _, _, X, X, _, _, X, _, _,
mhannay3 2:80f1d1056ae4 98 X, _, X, X, _, X, X, _, X, X, _, X,
mhannay3 2:80f1d1056ae4 99 X, _, X, X, _, X, X, _, X, X, _, X,
mhannay3 2:80f1d1056ae4 100 X, _, X, X, _, X, X, _, X, X, _, X,
mhannay3 2:80f1d1056ae4 101 X, X, X, X, X, X, X, X, X, X, X, X,
mhannay3 2:80f1d1056ae4 102 X, X, X, X, X, X, X, X, X, X, X, X,
mhannay3 2:80f1d1056ae4 103 X, X, _, X, X, X, X, X, X, _, X, X,
mhannay3 2:80f1d1056ae4 104 X, X, X, X, _, X, X, _, X, X, X, X,
mhannay3 2:80f1d1056ae4 105 _, X, X, X, X, X, X, X, X, X, X, _,
mhannay3 2:80f1d1056ae4 106 _, _, X, X, X, X, X, X, X, X, _, _,
mhannay3 2:80f1d1056ae4 107 _, X, X, X, X, X, X, X, X, X, X, _};
mus3 3:0f979d8d3fa1 108 return r;
mhannay3 2:80f1d1056ae4 109 }
mhannay3 2:80f1d1056ae4 110
mhannay3 2:80f1d1056ae4 111 uint32_t* spriteKing(bool white, bool light) {
mhannay3 2:80f1d1056ae4 112 uint32_t X = white ? 0xffffff : 0x000000;
mhannay3 2:80f1d1056ae4 113 uint32_t _ = light ? BOARD_LIGHT_COLOR : BOARD_DARK_COLOR;
mus3 3:0f979d8d3fa1 114 uint32_t r[] = {_, _, _, _, _, X, X, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 115 _, _, _, _, _, X, X, _, _, _, _, _,
mhannay3 2:80f1d1056ae4 116 _, _, _, X, X, X, X, X, X, _, _, _,
mhannay3 2:80f1d1056ae4 117 _, _, _, X, X, X, X, X, X, _, _, _,
mhannay3 2:80f1d1056ae4 118 X, X, _, _, _, X, X, _, _, _, X, X,
mhannay3 2:80f1d1056ae4 119 X, X, X, X, _, X, X, _, X, X, X, X,
mhannay3 2:80f1d1056ae4 120 X, _, X, X, X, X, X, X, X, X, _, X,
mhannay3 2:80f1d1056ae4 121 X, X, X, X, X, X, X, X, X, X, X, X,
mhannay3 2:80f1d1056ae4 122 X, X, X, _, X, X, X, X, _, X, X, X,
mhannay3 2:80f1d1056ae4 123 _, X, X, X, X, X, X, X, X, X, X, _,
mhannay3 2:80f1d1056ae4 124 _, _, X, X, X, _, _, X, X, X, _, _,
mhannay3 2:80f1d1056ae4 125 _, X, X, X, X, X, X, X, X, X, X, _};
mus3 3:0f979d8d3fa1 126 return r;
mhannay3 1:cd78922f70fa 127 }
mhannay3 1:cd78922f70fa 128
mhannay3 1:cd78922f70fa 129 public:
mus3 3:0f979d8d3fa1 130 Piece* getBoardState() {
mhannay3 1:cd78922f70fa 131 return boardState;
mhannay3 1:cd78922f70fa 132 }
mus3 3:0f979d8d3fa1 133
mus3 3:0f979d8d3fa1 134 void setBoardState(Piece newBoardState[]) {
mus3 3:0f979d8d3fa1 135 for (int i = 0; i < 64; i++) {
mus3 3:0f979d8d3fa1 136 boardState[i] = newBoardState[i];
mus3 3:0f979d8d3fa1 137 }
mhannay3 1:cd78922f70fa 138 }
mus3 3:0f979d8d3fa1 139
mhannay3 1:cd78922f70fa 140 // initializes the starting board state
mhannay3 1:cd78922f70fa 141 Board() {
mus3 3:0f979d8d3fa1 142 for (int i = 0; i < 64; i++) {
mus3 3:0f979d8d3fa1 143 placePiece(e, i / 8, i % 8);
mus3 3:0f979d8d3fa1 144 }
mhannay3 1:cd78922f70fa 145 placePiece(wR, 0, 0);
mhannay3 1:cd78922f70fa 146 placePiece(wN, 0, 1);
mhannay3 1:cd78922f70fa 147 placePiece(wB, 0, 2);
mhannay3 1:cd78922f70fa 148 placePiece(wQ, 0, 3);
mhannay3 1:cd78922f70fa 149 placePiece(wK, 0, 4);
mhannay3 1:cd78922f70fa 150 placePiece(wB, 0, 5);
mhannay3 1:cd78922f70fa 151 placePiece(wN, 0, 6);
mhannay3 1:cd78922f70fa 152 placePiece(wR, 0, 7);
mhannay3 1:cd78922f70fa 153 placePiece(bR, 7, 0);
mhannay3 1:cd78922f70fa 154 placePiece(bN, 7, 1);
mhannay3 1:cd78922f70fa 155 placePiece(bB, 7, 2);
mhannay3 1:cd78922f70fa 156 placePiece(bQ, 7, 3);
mhannay3 1:cd78922f70fa 157 placePiece(bK, 7, 4);
mhannay3 1:cd78922f70fa 158 placePiece(bB, 7, 5);
mhannay3 1:cd78922f70fa 159 placePiece(bN, 7, 6);
mhannay3 1:cd78922f70fa 160 placePiece(bR, 7, 7);
mhannay3 1:cd78922f70fa 161 for (int i = 0; i < 8; i++) {
mhannay3 1:cd78922f70fa 162 placePiece(w, 1, i);
mhannay3 1:cd78922f70fa 163 placePiece(b, 6, i);
mhannay3 1:cd78922f70fa 164 }
mhannay3 1:cd78922f70fa 165 }
mus3 3:0f979d8d3fa1 166
mhannay3 1:cd78922f70fa 167 // returns the piece at a given location
mhannay3 1:cd78922f70fa 168 Piece getPiece(int row, int column) {
mus3 3:0f979d8d3fa1 169 return boardState[row * 8 + column];
mhannay3 1:cd78922f70fa 170 }
mus3 3:0f979d8d3fa1 171
mhannay3 1:cd78922f70fa 172 /* puts the bit representation of a piece at the set position of the board
mhannay3 1:cd78922f70fa 173 assumes that the position of the board is emptied beforehand
mhannay3 1:cd78922f70fa 174 */
mhannay3 1:cd78922f70fa 175 void placePiece(Piece piece, int row, int column) {
mus3 3:0f979d8d3fa1 176 boardState[row * 8 + column] = piece;
mhannay3 1:cd78922f70fa 177 }
mus3 3:0f979d8d3fa1 178
mhannay3 1:cd78922f70fa 179 /* removes a piece from the set position of the board
mhannay3 1:cd78922f70fa 180 returns the bit representation of the piece
mhannay3 1:cd78922f70fa 181 */
mhannay3 1:cd78922f70fa 182 Piece removePiece(int row, int column) {
mus3 3:0f979d8d3fa1 183 Piece removedPiece = getPiece(row, column);
mus3 3:0f979d8d3fa1 184 boardState[row * 8 + column] = e;
mus3 3:0f979d8d3fa1 185 return removedPiece;
mhannay3 1:cd78922f70fa 186 }
mus3 3:0f979d8d3fa1 187
mhannay3 1:cd78922f70fa 188 /* moves a piece from one position to another
mhannay3 1:cd78922f70fa 189 returns the captured piece
mhannay3 1:cd78922f70fa 190 */
mhannay3 1:cd78922f70fa 191 Piece movePiece(int startRow, int startColumn, int endRow, int endColumn) {
mhannay3 1:cd78922f70fa 192 Piece movingPiece = removePiece(startRow, startColumn);
mhannay3 1:cd78922f70fa 193 Piece capturedPiece = removePiece(endRow, endColumn);
mhannay3 1:cd78922f70fa 194 placePiece(movingPiece, endRow, endColumn);
mhannay3 1:cd78922f70fa 195 return capturedPiece;
mhannay3 1:cd78922f70fa 196 }
mus3 3:0f979d8d3fa1 197
mhannay3 1:cd78922f70fa 198 // calculates the advantage difference for the board state
mhannay3 1:cd78922f70fa 199 float calculateBoardState() {
mhannay3 1:cd78922f70fa 200 return 0.0;
mhannay3 1:cd78922f70fa 201 }
mus3 3:0f979d8d3fa1 202
mhannay3 1:cd78922f70fa 203 coord getTopLeftOfSquare(int row, int column) {
mhannay3 1:cd78922f70fa 204 coord topLeft;
mhannay3 1:cd78922f70fa 205 topLeft.x = 16 * column;
mhannay3 1:cd78922f70fa 206 topLeft.y = 112 - 16 * row;
mhannay3 1:cd78922f70fa 207 }
mus3 3:0f979d8d3fa1 208
mhannay3 1:cd78922f70fa 209 // removes selection border around square
mhannay3 1:cd78922f70fa 210 void unselectSquare(int row, int column) {
mhannay3 1:cd78922f70fa 211 coord tl = getTopLeftOfSquare(row, column);
mhannay3 1:cd78922f70fa 212 uint64_t color;
mhannay3 1:cd78922f70fa 213 if ((row + column) % 2 == 0) {
mhannay3 1:cd78922f70fa 214 color = BOARD_DARK_COLOR;
mhannay3 1:cd78922f70fa 215 } else {
mhannay3 1:cd78922f70fa 216 color = BOARD_LIGHT_COLOR;
mhannay3 1:cd78922f70fa 217 }
mhannay3 1:cd78922f70fa 218 //uLCD.rectangle(tl.x, tl.y, tl.x + 15, tl.y + 15, color);
mhannay3 1:cd78922f70fa 219 }
mus3 3:0f979d8d3fa1 220
mhannay3 1:cd78922f70fa 221 void hoverSquare(int row, int column) {
mhannay3 1:cd78922f70fa 222 coord tl = getTopLeftOfSquare(row, column);
mhannay3 1:cd78922f70fa 223 //uLCD.rectangle(tl.x, tl.y, tl.x + 15, tl.y + 15, HOVER_COLOR);
mhannay3 1:cd78922f70fa 224 }
mus3 3:0f979d8d3fa1 225
mhannay3 1:cd78922f70fa 226 // draws selection border around square
mhannay3 1:cd78922f70fa 227 void selectSquare(int row, int column) {
mhannay3 1:cd78922f70fa 228 coord tl = getTopLeftOfSquare(row, column);
mhannay3 1:cd78922f70fa 229 //uLCD.rectangle(tl.x, tl.y, tl.x + 15, tl.y + 15, SELECTED_COLOR);
mhannay3 1:cd78922f70fa 230 }
mus3 3:0f979d8d3fa1 231 };
mus3 3:0f979d8d3fa1 232
mus3 3:0f979d8d3fa1 233 DigitalOut led(LED1);
mus3 3:0f979d8d3fa1 234 uLCD_4DGL uLCD(p28,p27,p30); // serial tx, serial rx, reset pin;
mus3 3:0f979d8d3fa1 235
mus3 3:0f979d8d3fa1 236 void drawPiece(int row, int column, uLCD_4DGL uLCD, uint32_t boardColor, uint32_t pieceColor, uint32_t pieceGraphic[]) {
mus3 3:0f979d8d3fa1 237 uLCD.filled_rectangle(column * 16, row * 16, column * 16 + 16, row * 16 + 2, boardColor);
mus3 3:0f979d8d3fa1 238 uLCD.filled_rectangle(column * 16, row * 16 + 14, column * 16 + 16, row * 16 + 16, boardColor);
mus3 3:0f979d8d3fa1 239 uLCD.filled_rectangle(column * 16, row * 16, column * 16 + 2, row * 16 + 16, boardColor);
mus3 3:0f979d8d3fa1 240 uLCD.filled_rectangle(column * 16 + 14, row * 16, column * 16 + 16, row * 16 + 16, boardColor);
mus3 3:0f979d8d3fa1 241 for (int x = 0; x < 12; x++) {
mus3 3:0f979d8d3fa1 242 for (int y = 0; y < 12; y++) {
mus3 3:0f979d8d3fa1 243 if (pieceGraphic[y * 12 + x] == 0x000001) {
mus3 3:0f979d8d3fa1 244 uLCD.pixel(column * 16 + x + 2, row * 16 + y + 2, boardColor);
mus3 3:0f979d8d3fa1 245 } else {
mus3 3:0f979d8d3fa1 246 uLCD.pixel(column * 16 + x + 2, row * 16 + y + 2, pieceColor);
mus3 3:0f979d8d3fa1 247 }
mus3 3:0f979d8d3fa1 248 }
mus3 3:0f979d8d3fa1 249 }
mhannay3 1:cd78922f70fa 250 }
mus3 0:d16cc59110a3 251
mus3 0:d16cc59110a3 252 int main() {
mus3 3:0f979d8d3fa1 253 Board game;
mus3 3:0f979d8d3fa1 254 //Piece* bs = game.getBoardState();
mus3 3:0f979d8d3fa1 255 //for (int i = 0; i < 8; i++) {
mus3 3:0f979d8d3fa1 256 //uLCD.printf("%d\n", static_cast<uint8_t>(bs[i+8]));
mus3 3:0f979d8d3fa1 257 //}
mus3 3:0f979d8d3fa1 258 led = 0;
mus3 3:0f979d8d3fa1 259 uint32_t X = 0x000002;
mus3 3:0f979d8d3fa1 260 uint32_t _ = 0x000001;
mus3 3:0f979d8d3fa1 261 uint32_t boardColor;
mus3 3:0f979d8d3fa1 262 uint32_t pieceColor;
mus3 3:0f979d8d3fa1 263 for (int row = 0; row < 8; row++) {
mus3 3:0f979d8d3fa1 264 for (int column = 0; column < 8; column++) {
mus3 3:0f979d8d3fa1 265 Piece currPiece = game.getPiece(row, column);
mus3 3:0f979d8d3fa1 266 if ((row+column) % 2) {
mus3 3:0f979d8d3fa1 267 boardColor = 0x769656;
mus3 3:0f979d8d3fa1 268 } else {
mus3 3:0f979d8d3fa1 269 boardColor = 0xbaca44;
mus3 3:0f979d8d3fa1 270 }
mus3 3:0f979d8d3fa1 271 uLCD.filled_rectangle(column * 16, row * 16, column * 16 + 16, row * 16 + 16, boardColor);
mus3 3:0f979d8d3fa1 272 if (currPiece == e) {
mus3 3:0f979d8d3fa1 273 continue;
mus3 3:0f979d8d3fa1 274 } else {
mus3 3:0f979d8d3fa1 275 // e, wK, bK, wQ, bQ, wR, bR, wB, bB, wN, bN, w, b
mus3 3:0f979d8d3fa1 276 if (currPiece == wK) {
mus3 3:0f979d8d3fa1 277 pieceColor = 0xffffff;
mus3 3:0f979d8d3fa1 278 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 8, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 279 uLCD.filled_rectangle(column * 16 + 7, row * 16 + 2, column * 16 + 8, row * 16 + 8, pieceColor);
mus3 3:0f979d8d3fa1 280 uLCD.filled_rectangle(column * 16 + 5, row * 16 + 4, column * 16 + 10, row * 16 + 5, pieceColor);
mus3 3:0f979d8d3fa1 281 } else if (currPiece == bK) {
mus3 3:0f979d8d3fa1 282 pieceColor = 0x000000;
mus3 3:0f979d8d3fa1 283 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 8, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 284 uLCD.filled_rectangle(column * 16 + 7, row * 16 + 2, column * 16 + 8, row * 16 + 8, pieceColor);
mus3 3:0f979d8d3fa1 285 uLCD.filled_rectangle(column * 16 + 5, row * 16 + 4, column * 16 + 10, row * 16 + 5, pieceColor);
mus3 3:0f979d8d3fa1 286 } else if (currPiece == wQ) {
mus3 3:0f979d8d3fa1 287 pieceColor = 0xffffff;
mus3 3:0f979d8d3fa1 288 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 8, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 289 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 4, column * 16 + 3, row * 16 + 8, pieceColor);
mus3 3:0f979d8d3fa1 290 uLCD.filled_rectangle(column * 16 + 7, row * 16 + 4, column * 16 + 8, row * 16 + 8, pieceColor);
mus3 3:0f979d8d3fa1 291 uLCD.filled_rectangle(column * 16 + 12, row * 16 + 4, column * 16 + 13, row * 16 + 8, pieceColor);
mus3 3:0f979d8d3fa1 292 uLCD.filled_circle(column * 16 + 3, row * 16 + 4, 2, pieceColor);
mus3 3:0f979d8d3fa1 293 uLCD.filled_circle(column * 16 + 8, row * 16 + 4, 2, pieceColor);
mus3 3:0f979d8d3fa1 294 uLCD.filled_circle(column * 16 + 12, row * 16 + 4, 2, pieceColor);
mus3 3:0f979d8d3fa1 295 } else if (currPiece == bQ) {
mus3 3:0f979d8d3fa1 296 pieceColor = 0x000000;
mus3 3:0f979d8d3fa1 297 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 8, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 298 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 4, column * 16 + 3, row * 16 + 8, pieceColor);
mus3 3:0f979d8d3fa1 299 uLCD.filled_rectangle(column * 16 + 7, row * 16 + 4, column * 16 + 8, row * 16 + 8, pieceColor);
mus3 3:0f979d8d3fa1 300 uLCD.filled_rectangle(column * 16 + 12, row * 16 + 4, column * 16 + 13, row * 16 + 8, pieceColor);
mus3 3:0f979d8d3fa1 301 uLCD.filled_circle(column * 16 + 3, row * 16 + 4, 2, pieceColor);
mus3 3:0f979d8d3fa1 302 uLCD.filled_circle(column * 16 + 8, row * 16 + 4, 2, pieceColor);
mus3 3:0f979d8d3fa1 303 uLCD.filled_circle(column * 16 + 12, row * 16 + 4, 2, pieceColor);
mus3 3:0f979d8d3fa1 304 } else if (currPiece == wR) {
mus3 3:0f979d8d3fa1 305 pieceColor = 0xffffff;
mus3 3:0f979d8d3fa1 306 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 5, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 307 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 2, column * 16 + 4, row * 16 + 5, pieceColor);
mus3 3:0f979d8d3fa1 308 uLCD.filled_rectangle(column * 16 + 6, row * 16 + 2, column * 16 + 9, row * 16 + 5, pieceColor);
mus3 3:0f979d8d3fa1 309 uLCD.filled_rectangle(column * 16 + 11, row * 16 + 2, column * 16 + 13, row * 16 + 5, pieceColor);
mus3 3:0f979d8d3fa1 310 } else if (currPiece == bR) {
mus3 3:0f979d8d3fa1 311 pieceColor = 0x000000;
mus3 3:0f979d8d3fa1 312 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 5, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 313 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 2, column * 16 + 4, row * 16 + 5, pieceColor);
mus3 3:0f979d8d3fa1 314 uLCD.filled_rectangle(column * 16 + 6, row * 16 + 2, column * 16 + 9, row * 16 + 5, pieceColor);
mus3 3:0f979d8d3fa1 315 uLCD.filled_rectangle(column * 16 + 11, row * 16 + 2, column * 16 + 13, row * 16 + 5, pieceColor);
mus3 3:0f979d8d3fa1 316 } else if (currPiece == wB) {
mus3 3:0f979d8d3fa1 317 pieceColor = 0xffffff;
mus3 3:0f979d8d3fa1 318 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 11, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 319 uLCD.filled_rectangle(column * 16 + 4, row * 16 + 8, column * 16 + 11, row * 16 + 10, pieceColor);
mus3 3:0f979d8d3fa1 320 uLCD.filled_circle(column * 16 + 7, row * 16 + 5, 3, pieceColor);
mus3 3:0f979d8d3fa1 321 uLCD.filled_circle(column * 16 + 8, row * 16 + 5, 3, pieceColor);
mus3 3:0f979d8d3fa1 322 } else if (currPiece == bB) {
mus3 3:0f979d8d3fa1 323 pieceColor = 0x000000;
mus3 3:0f979d8d3fa1 324 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 11, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 325 uLCD.filled_rectangle(column * 16 + 4, row * 16 + 8, column * 16 + 11, row * 16 + 10, pieceColor);
mus3 3:0f979d8d3fa1 326 uLCD.filled_circle(column * 16 + 7, row * 16 + 5, 3, pieceColor);
mus3 3:0f979d8d3fa1 327 uLCD.filled_circle(column * 16 + 8, row * 16 + 5, 3, pieceColor);
mus3 3:0f979d8d3fa1 328 } else if (currPiece == wN) {
mus3 3:0f979d8d3fa1 329 pieceColor = 0xffffff;
mus3 3:0f979d8d3fa1 330 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 11, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 331 uLCD.filled_rectangle(column * 16 + 8, row * 16 + 2, column * 16 + 11, row * 16 + 10, pieceColor);
mus3 3:0f979d8d3fa1 332 uLCD.filled_rectangle(column * 16 + 6, row * 16 + 3, column * 16 + 7, row * 16 + 8, pieceColor);
mus3 3:0f979d8d3fa1 333 uLCD.filled_rectangle(column * 16 + 4, row * 16 + 4, column * 16 + 5, row * 16 + 7, pieceColor);
mus3 3:0f979d8d3fa1 334 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 5, column * 16 + 3, row * 16 + 6, pieceColor);
mus3 3:0f979d8d3fa1 335 } else if (currPiece == bN) {
mus3 3:0f979d8d3fa1 336 pieceColor = 0x000000;
mus3 3:0f979d8d3fa1 337 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 11, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 338 uLCD.filled_rectangle(column * 16 + 8, row * 16 + 2, column * 16 + 11, row * 16 + 10, pieceColor);
mus3 3:0f979d8d3fa1 339 uLCD.filled_rectangle(column * 16 + 6, row * 16 + 3, column * 16 + 7, row * 16 + 8, pieceColor);
mus3 3:0f979d8d3fa1 340 uLCD.filled_rectangle(column * 16 + 4, row * 16 + 4, column * 16 + 5, row * 16 + 7, pieceColor);
mus3 3:0f979d8d3fa1 341 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 5, column * 16 + 3, row * 16 + 6, pieceColor);
mus3 3:0f979d8d3fa1 342 } else if (currPiece == w) {
mus3 3:0f979d8d3fa1 343 pieceColor = 0xffffff;
mus3 3:0f979d8d3fa1 344 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 11, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 345 uLCD.filled_rectangle(column * 16 + 6, row * 16 + 8, column * 16 + 9, row * 16 + 10, pieceColor);
mus3 3:0f979d8d3fa1 346 uLCD.filled_circle(column * 16 + 7, row * 16 + 5, 2, pieceColor);
mus3 3:0f979d8d3fa1 347 uLCD.filled_circle(column * 16 + 8, row * 16 + 5, 2, pieceColor);
mus3 3:0f979d8d3fa1 348 } else if (currPiece == b) {
mus3 3:0f979d8d3fa1 349 pieceColor = 0x000000;
mus3 3:0f979d8d3fa1 350 uLCD.filled_rectangle(column * 16 + 2, row * 16 + 11, column * 16 + 13, row * 16 + 13, pieceColor);
mus3 3:0f979d8d3fa1 351 uLCD.filled_rectangle(column * 16 + 6, row * 16 + 8, column * 16 + 9, row * 16 + 10, pieceColor);
mus3 3:0f979d8d3fa1 352 uLCD.filled_circle(column * 16 + 7, row * 16 + 5, 2, pieceColor);
mus3 3:0f979d8d3fa1 353 uLCD.filled_circle(column * 16 + 8, row * 16 + 5, 2, pieceColor);
mus3 3:0f979d8d3fa1 354 }
mus3 3:0f979d8d3fa1 355 }
mus3 3:0f979d8d3fa1 356 }
mus3 3:0f979d8d3fa1 357 }
mus3 3:0f979d8d3fa1 358 while (1) {
mus3 3:0f979d8d3fa1 359 led = !led;
mus3 3:0f979d8d3fa1 360 wait(.2);
mus3 3:0f979d8d3fa1 361 }
mhannay3 1:cd78922f70fa 362 }