Question: http://people.cs.umass.edu/~liberato/courses/2017-spring-compsci190d/assignments/programming-assignment-11-war/ go to this link. It is just a simple war card game. Below contains psuedocode: findWinner(): instantiate a War object War: constructor: initialize decks,

http://people.cs.umass.edu/~liberato/courses/2017-spring-compsci190d/assignments/programming-assignment-11-war/

go to this link. It is just a simple war card game. Below contains psuedocode:

findWinner(): instantiate a War object War: constructor: initialize decks, other values simulateGame(): while !gameOver: battle() return outcome battle(): if game over (winner or draw or technical draw): set outcome return increment battle count take card from each player, add to spoils if a player wins: allocate spoils else war() war(): if game over (not enough cards for war): set outcome return remove three cards from each player, add to to spoils

public class War {

/**

* Determines the winner of a game of War, returning 1 if player A wins, -1 if player B wins, 0 if a draw.

*

* The rules of the game are defined in the assignment writeup.

*

* @param deck

* @return 1 if player A wins, -1 if player B wins, 0 if a draw

*/

public static int findWinner(List deck) {

return 0;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The question seems incomplete because it requests acce... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!