=current class design (psuedo-code)=
Code: Select all
class player
{
string name
char symbol //used for displaying ownership on the board
bool still_playing //to tell if they've lost yet so we can skip their turn
bool first_turn //because you don't get reinforcements on the first turn
void turn(){} /*defines the player's turn, so main will only have to call player.turn(). will contain calls to other member functions.*/
void reinforce(){} //checks if it's the first turn. if not, compute reinforcement amount and give.
void redistribute(){} //redistributes troops at the end of a turn.
void attack(&attacker.troops, &defender.troops){} //contains the attack process, like rolling dice and reducing troop count accordingly. should call by reference to alter the values.
}
Code: Select all
class NPC
{
/* this should essentially be a carbon-copy of the player class, but all cin and cout statements should be stripped, and replaced with some facility for the AI to make decisions. alpha-alpha will have no AI, alpha will have shitty AI using rand() and modulus, and after that i'll try working on AI that evaluates the situation and tries to formulate the best solution. if i don't run into too much trouble i might also have personality variables like 'aggressive' or 'vengeance' to affect decisions. but really, i'm betting on it being complete shit.*/
}
Code: Select all
class territory
{
string name //name of the territory. ie: kamchatka, egypt, chile
int troops //how many troops are currently in the territory
string owner // to determine ownership of the troops
/* some way to list the other territories it touches/can attack? i dunno, still workin' on this one. */
}
=problems=
1: how to represent/compute what territories a certain one is touching, so i can have a proper attack function that follows the rules.
2: similar to #1; how to check ownership & find paths between two territories, which i'd use in the troop movement function to enforce rules while moving troops
3: how am i going to create different territories? they've got their name member variable, but i'm not sure how i'd set their identifiers, since in the long run i'd like a dynamic solution that doesn't need hard-coded values. for example, if i make a map-making feature, having to set identifiers for different territories then recompile is just stupid.
4: i can't avoid it forever: AI. i'll settle for rand()%choices for a while, but i'd like something at least semi-intelligent in the final build, so i won't have a bot attack from it's weakest flank then end it's turn after it reinforces it's innermost country. i can put it off for a while though while i learn more about the subject.
5: there's bound to be more issues popping up, i'll come back here when i find 'em since it's been a good day since i've sat down and really thought about this.