simple snake game

Dependencies:   C12832_lcd EthernetInterface WebSocketClient mbed-rtos mbed

Revision:
0:2e5a51003afe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Snake.h	Thu Dec 08 11:20:34 2016 +0000
@@ -0,0 +1,39 @@
+/****************************
+* A LCD-based snake game.   *
+*****************************/
+#include "mbed.h"
+#include "C12832_lcd.h"
+#include <math.h>
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <stdio.h>
+
+using namespace std;
+
+// 40 * 32 -> 5 Byte * 32
+// LCD controll class
+class Screen{
+public:
+    void init(); // Initial the screen data
+    void generate_lcd();    // Generate lcd data from raw screen data
+    void write_to_screen(); // Write the screen data to 
+};
+
+class SnakeControll{
+public:
+    int point;
+    void init();    // Initial the game status
+    int direction;  // Direction list:
+                    //      0 - left
+                    //      1 - right
+                    //      2 - up
+                    //      3 - down
+    int step();
+    void set_direction(int d);
+    void generate_food();
+    string get_gamedata();  // Return a json string
+private:
+    string num2str(int num);
+    string pos2str(int x, int y);
+};