/*we call this function to end the game if one of the players won or if the board is full and the game ended with draw*/
        /* if the player call this function with flag =true then he/she is the winner */
        /* else he/she is loser or if game is ended with draw the two players call this function with flag=false*/
        private int GameOver(bool falg)
        {
            int p = 0;

            try
            {
                CloseGame = true;
                int  c = 0;
                bool b = true;
                //the 100 bouns
                for (int i = 0; i < 6; i++)
                {
                    c = c + CountMyMoves[i];
                    if (CountMyMoves[i] == 0)
                    {
                        b = false;
                    }
                }
                if (b)
                {
                    p = 100;
                }
                if (!falg)//if not winner he/she get 10 points for each ball she/he added to the board
                {
                    p = c * 10 + p;
                }
                if (falg)
                {
                    p = p + 1000;
                }

                Client.MyPoints(Username, GameId, p);
                if (falg)
                {
                    MessageBox.Show("YOU WIN, you gained " + p + " points", Username);
                    this.Close();
                }
            }
            catch (FaultException <LiveGameFault> fault)
            {
                thr.Abort();
                MessageBox.Show(fault.Detail.Details, Username);
                CloseGame = true;
                this.Close();
            }
            catch (TimeoutException)
            {
                thr.Abort();
                MessageBox.Show(" connection unstable , it took to long to get a response this game is canceled", Username + " connection unstable");
                CloseGame = true;
                this.Close();
            }
            catch (CommunicationObjectFaultedException)
            {
                thr.Abort();
                MessageBox.Show(" connection failed , this game is canceled", Username + " connection unstable");
                CloseGame = true;
                this.Close();
            }
            catch (Exception ex)
            {
                thr.Abort();
                MessageBox.Show(ex.ToString(), Username + " connection unstable");
                CloseGame = true;
                this.Close();
            }
            return(p);
        }