public String winner()
    {
        int blackcount = 0;
        int whitecount = 0;

        for (int[] row : board)
        {
            for (int value : row)
            {
                if(value == B)
                    blackcount++;
                else if(value == W)
                    whitecount++;
            }
        }
        if (blackcount > whitecount)
            return black;
        else if(blackcount < whitecount)
            return white;
        else //(blackcount == whitecount)
            return tie;
    }