game_board class might need more function but this is for now

Dependents:   Final_Project

Revision:
3:e21ecfae42e4
Parent:
2:1a54e4ed2669
--- a/game_board.cpp	Sat Dec 05 10:23:50 2015 +0000
+++ b/game_board.cpp	Mon Dec 07 22:10:04 2015 +0000
@@ -5,7 +5,16 @@
 
 void game_board::new_game_board ()
 {
-   //int i,j;
+   ship_lose = 0; 
+   for (i = 0; i < 6; i++);
+    {
+        _my_ship[i][0] = 0;
+        _my_ship[i][1] = 0;
+        _my_ship[i][2] = 0;
+        _my_ship[i][3] = 0;
+        _my_ship[i][4] = 0;
+        _my_ship[i][5] = 0;
+    }
    F_row = "F _ _ _ _ _ _   F _ _ _ _ _ _\n\r";
    E_row = "E _ _ _ _ _ _   E _ _ _ _ _ _\n\r";
    D_row = "D _ _ _ _ _ _   D _ _ _ _ _ _\n\r";
@@ -19,6 +28,7 @@
 bool game_board::place_hit_miss_friendly  (int row, int colum){
     if (_my_ship[row-1][colum-1] >= 1){
         _my_ship[row-1][colum-1] = 2; //freindly got destroy
+        ship_lose = ship_lose + 1;
         switch (row - 1)
             {
                 case 0: F_row[(colum)*2] = '*'; 
@@ -104,21 +114,9 @@
     return (r_row);
 };
 bool game_board::looser(){
-    int i,j,ship_lost = 0;
-
-    for (i = 0; i < 6; i++) 
-    {
-        for (j = 0; j < 6; j++) 
-        {
-            if (_my_ship[i][j] == 2) 
-            {
-                ship_lost = ship_lost + 1;
-            }
-        }
-    }
     //check for the number of ship is destroy;
     //if 5 or more ship is destroy player lose the game
-    if (ship_lost > 5) 
+    while (ship_lose > 5) 
     {
         return true; //you lose
     }