I’m making a small game in JAVA, I’m not going to get into the full details but what I have right now is basically a Player (YOU) and the CPU battling to win Territory . Each territory has Weights suppose it’s an array of
int and each index refers to the order of the territory. If you have the most number of Weights you win! To get ahold of a territory the opponents (Player and CPU) needs to recover the most number of Outposts inside it.
I want to make a prompt that displays if the Player can win at a certain point in the game and based on that notifies the player can still win it or that the game has ended otherwise. If the Player can Win then it displays the optimal path that the Player can take to win with the least number of Outposts recovered as there is an energy mechanic in the game.
Assume there is a method that computes the minimum number of Outposts the Player needs to recover in a given territory at a given time ->
minOutposts(int cpuRecoveries, int playerRecoveries, int outpostsLeftToBeRecovered)
Suppose after everything is computed and the case is Player can Win I have an
int weight and
int minOutpost . My coding objective now is to find out a suitable data structure that uses both these integer arrays to formulate the Minimum number of Outposts to recover to achieve Maximum number of Weights and hence finding an Optimal Path to Victory .
Note: I thought about resolving this with a Priority-Queue where the Weight is the priority, but as you can guess there will be cases where the I might get the maximal Weights but not the minimal number of Outposts. The more I rubber-duck (type my problem out) the more it seems like this a needs a graph/tree ADT of some sorts. Any tip/direction will be much appreciated, thank you!