public Misslefiring(Game g)
        {
            game              = g;
            buttons_0         = new Modified_Button[10, 10];
            buttons_1         = new Modified_Button[10, 10];
            playerhaschanged += checkforcomputermove;

            InitializeComponent();
            player1.Content          = game.players[1].name;
            player2.Content          = game.players[0].name;
            dispatcherTimer          = new DispatcherTimer();
            dispatcherTimer.Tick    += DispatcherTimer_Tick;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            for (int i = 0; i < 10; i++)
            {
                for (int u = 0; u < 10; u++)
                {
                    buttons_0[i, u] = new Modified_Button()
                    {
                        Width = 50, Height = 50, x = u, y = i, Background = new SolidColorBrush(Colors.Aqua), player = game.players[0]
                    };
                    buttons_0[i, u].Click += fire_click;
                    Grid.SetColumn(buttons_0[i, u], u + 1);
                    Grid.SetRow(buttons_0[i, u], i + 1);
                    field_0.Children.Add(buttons_0[i, u]);
                }
            }
            for (int i = 0; i < 10; i++)
            {
                for (int u = 0; u < 10; u++)
                {
                    buttons_1[i, u] = new Modified_Button()
                    {
                        Width = 50, Height = 50, x = u, y = i, Background = new SolidColorBrush(Colors.Aqua), player = game.players[1]
                    };
                    buttons_1[i, u].Click += fire_click;
                    Grid.SetColumn(buttons_1[i, u], u + 1);
                    Grid.SetRow(buttons_1[i, u], i + 1);
                    field_1.Children.Add(buttons_1[i, u]);
                }
            }
            game.players[0].Fired += boardhaschanged;
            game.players[1].Fired += boardhaschanged;
            Button startbattle = new Button()
            {
                Content = "Start battling"
            };

            startbattle.Click += Startbattle_Click;
            game_window.Children.Add(startbattle);
        }
        public Ship_placement(Player p, bool s, Game g)
        {
            game         = g;
            player       = p;
            secondplayer = s;
            buttons      = new Modified_Button[10, 10];
            ship_buttons = new Modified_Button[6];


            InitializeComponent();

            for (int i = 0; i < 6; i++)
            {
                ship_buttons[i] = new Modified_Button()
                {
                    Content = ToString(player.ships[i].type),
                    ship    = player.ships[i],
                    Margin  = new Thickness(5),
                    Padding = new Thickness(3)
                };
                ship_buttons[i].Click += ship_buttons_click;
                Shipllist.Children.Add(ship_buttons[i]);
            }

            for (int i = 0; i < 10; i++)
            {
                for (int u = 0; u < 10; u++)
                {
                    buttons[i, u] = new Modified_Button()
                    {
                        Width = 50, Height = 50, x = u, y = i, Background = new SolidColorBrush(Colors.Aqua)
                    };
                    buttons[i, u].Click      += ship_placement_click;
                    buttons[i, u].MouseEnter += field_MouseEnter;
                    buttons[i, u].MouseLeave += field_MouseLeave;
                    Grid.SetColumn(buttons[i, u], u + 1);
                    Grid.SetRow(buttons[i, u], i + 1);
                    field.Children.Add(buttons[i, u]);
                }
            }
            player.BoardChanged += boardhaschanged;
        }