Increase color for the board and clear screen for winning message

Dependencies:   4DGL-uLCD-SE EthernetInterface HTTPClient mbed-rtos mbed

Fork of Final_test by Jonathon Deriso

Files at this revision

API Documentation at this revision

Comitter:
honelight
Date:
Thu Apr 30 01:27:56 2015 +0000
Parent:
3:b834ab4a53d1
Commit message:
ECE4180 Final Project TicTacToe Version 2

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r b834ab4a53d1 -r 427dbdf3ccd5 main.cpp
--- a/main.cpp	Mon Apr 27 17:38:55 2015 +0000
+++ b/main.cpp	Thu Apr 30 01:27:56 2015 +0000
@@ -33,17 +33,17 @@
 void printBoard(int ** board)
 {
     lcd.cls();
-    lcd.line(0, 42 , 127, 42 , 0xFF0000);
-    lcd.line(0, 84 , 127, 84 , 0xFF0000);
-    lcd.line(42, 0 , 42, 127, 0xFF0000);
-    lcd.line(84, 0, 84, 127, 0xFF0000);
+    lcd.line(0, 42 , 127, 42 , BLUE);
+    lcd.line(0, 84 , 127, 84 , BLUE);
+    lcd.line(42, 0 , 42, 127, BLUE);
+    lcd.line(84, 0, 84, 127, BLUE);
     for(int i=0; i<3; i++) {
         for(int j=0; j<3; j++) {
             if(board[i][j] == 0) {
                 lcd.line( j*42+2 , i*42 + 2 ,(j+1)*42-2 , (i+1)*42-2 , GREEN);
                 lcd.line( j*42+2 , (i+1)*42 - 2 ,(j+1)*42-2 , (i)*42+2 , GREEN);
             } else if(board[i][j] == 1) {
-                lcd.circle(42*j+21, 42*i+21, 19, BLUE);
+                lcd.circle(42*j+21, 42*i+21, 19, RED);
             }
         }
     }
@@ -371,6 +371,7 @@
     }
     int winner = GetWinner(gameId);
     pc.printf("Player %d Won!\n", winner);
+    lcd.cls();
     lcd.printf("Player %d Won!\n", winner);
     /* lcd.line(0, 42 , 127, 42 , 0xFF0000);
      lcd.line(0, 84 , 127, 84 , 0xFF0000);
@@ -491,7 +492,7 @@
 
     int r = socket.connect("4180.azurewebsites.net", 80);
     if (r != 0)
-        pc.printf("Failed to connect to 4180.azurewebsites.net:80!\r\n");
+        pc.printf("\n\nFailed to connect to 4180.azurewebsites.net:80!\r\n");
     char http_cmd[] = "GET / HTTP/1.0\n\n";
     socket.send_all(http_cmd, sizeof(http_cmd)-1);