cmpsc330hw4/main.cpp
Sandipsinh Rathod 45085e7434 add description
2024-11-19 20:49:12 -05:00

62 lines
2.0 KiB
C++

//------------------------------------------------------------------------------------------------------------
// Team member 1:
// Name: Sandipsinh Rathod
// Email: sdr5549@psu.edu
// Class: CMPSC 330
//
// Team member 2:
// Name: Sapan Shah
// Email: scs6041@psu.edu
// Class: CMPSC 330
//
// Description: This program generates moves from two-player board game where
// wither one player plays strategically and the other plays randomly. Or both players
// play randomly or strategically.
//--------------------------------------------------------------------------------------------------------------
#include "gameplay.h"
#include <iostream>
#include <fstream>
#include "random_player.h"
#include "utils.h"
using namespace std;
int main() {
int rows, cols;
char player1Name, player2Name;
string player1Type, player2Type;
// Read board dimensions
cin >> rows >> cols;
// Read player 1 details
cin >> player1Name >> player1Type;
// Read player 2 details
cin >> player2Name >> player2Type;
// Determine player types and initialize gameplay
Player *randomPlayerName, *strategicPlayerName;
if (toLowerCase(player1Type[0]) == 'r' && toLowerCase(player2Type[0]) == 's') {
randomPlayerName = new RandomPlayer(player1Name);
strategicPlayerName = new StrategicPlayer(player2Name);
} else if (toLowerCase(player1Type[0]) == 's' && toLowerCase(player2Type[0]) == 'r') {
randomPlayerName = new RandomPlayer(player2Name);
strategicPlayerName = new StrategicPlayer(player1Name);
} else if (toLowerCase(player1Type[0]) == 'r' && toLowerCase(player2Type[0]) == 'r') {
randomPlayerName = new RandomPlayer(player2Name);
strategicPlayerName = new RandomPlayer(player1Name);
} else {
randomPlayerName = new StrategicPlayer(player2Name);
strategicPlayerName = new StrategicPlayer(player1Name);
}
Gameplay(rows, cols, randomPlayerName, strategicPlayerName)
.playGame();
return 0;
}