Untitled
unknown
plain_text
8 months ago
1.5 kB
4
Indexable
#include <iostream>
#include <vector>
#include <string>
class Player {
public:
std::string name;
bool isInCircle;
Player(std::string playerName) : name(playerName), isInCircle(false) {}
};
class Team {
public:
std::vector<Player> players;
Team(std::vector<std::string> playerNames) {
for (const auto& name : playerNames) {
players.emplace_back(name);
}
}
};
class KabaddiGame {
private:
Team teamA;
Team teamB;
int points;
public:
KabaddiGame(Team a, Team b) : teamA(a), teamB(b), points(0) {}
void startGame() {
std::cout << "Kabaddi Game Started!" << std::endl;
// Game logic goes here
}
void playerAction(Player& player, Team& oppositeTeam) {
// Simulate player action
std::cout << player.name << " is trying to touch an opponent!" << std::endl;
// Logic for touching and scoring points
}
void scorePoint() {
points += 20;
std::cout << "Points scored! Total points: " << points << std::endl;
}
};
int main() {
Team teamA({"Player1", "Player2", "Player3", "Player4", "Player5", "Player6", "Player7", "Player8"});
Team teamB({"Player9", "Player10", "Player11", "Player12", "Player13", "Player14", "Player15", "Player16"});
KabaddiGame game(teamA, teamB);
game.startGame();
// Example of player action
game.playerAction(teamA.players[0], teamB);
game.scorePoint();
return 0;
}
Editor is loading...
Leave a Comment