Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a two player chess or checkers program and identify any areas that you wi

ID: 3742266 • Letter: C

Question

Create a two player chess or checkers program and identify any areas that you will need to include searching and sorting algorithms. For each array you identify, define it fully using pseudocode including the type of data to be held in the array, the length of the array, and is it a two or more dimensional array. For each searching and/or sorting algorithm you identify create pseudocode for the algorithm and create flow chart representations of the algorithm.

"YOU FIRST HAVE TO CREATE THE PROGRAM AND INCLUDE A SEARCHING AND/OR SORTING ALGORITHM. CREATE A PSEUDOCODE AND FLOWCHART REPRESENTATION'

Explanation / Answer

Answer:

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>


class Chesssnippet {
    public:
    const std::string location;
    const std::string snippet;
    bool is_captured;
    Chesssnippet(std::string location, std::string snippet, bool is_captured) :
    location(location), snippet(snippet), is_captured(is_captured) {};
};

class PlayerBase {
    public:
        bool is_checked = false;      
        std::vector<const Chesssnippet*> snippets;
        char specificcolor;
        void print_snippets() {
            for(auto &cp : snippets) {
                std::cout << cp->snippet << " is_alive "
                    << cp->is_captured << std::endl;
            }
        }

      
        void add_snippets(const Chesssnippet*);
        void remove_snippets(const Chesssnippet&);
      
        virtual Chesssnippet next_move(Chesssnippet cp)
        {
            return cp;
        };

};

void PlayerBase::add_snippets(const Chesssnippet *cp) {
        snippets.push_back(cp);
};

void PlayerBase::remove_snippets(const Chesssnippet& cp) {
        auto it = std::remove(snippets.begin(), snippets.end(), &cp);
        snippets.erase(it , snippets.end());
};

class HumanPlayer : PlayerBase {
    Chesssnippet next_move(Chesssnippet cp) { return cp; };
};

class Computer : PlayerBase {
    Chesssnippet move;
  
    Chesssnippet next_move() { return move; };
};

class Player_1 : public PlayerBase {
    public:
        char specificcolor = 'W';


};

class Player_2 : public PlayerBase {
    public:
        char specificcolor = 'B';

};

class GameManager {
    public:
        Chesssnippet method2(PlayerBase player)
        {
            std::cout << "processing " << player.specificcolor << std::endl;
          
            Chesssnippet cp("foo", "bar", false);
            return cp;

        };
        bool accept_turn(Chesssnippet turn)
        {
          
            return true;
        };
      
        void setup(PlayerBase&, PlayerBase&);

        void teardown(PlayerBase&, PlayerBase&);
};


void GameManager::setup(PlayerBase& player1, PlayerBase& player2) {
    for(int i = 0; i < 16; i++) {
        if(i < 8) {
            Chesssnippet *p = new Chesssnippet("a1", "Pawn", false);
            player1.add_snippets(p);

        }
    }
}

void GameManager::teardown(PlayerBase& player1, PlayerBase& player2) {


};

int main()
{
    Player_1 player1;
    Player_2 player2;
    GameManager game;
    game.setup(player1, player2);
    player1.print_snippets();
    }
    game.teardown(player1, player2);
    return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote