Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

please dont use chat gpt 1 8 4 . " "

Answered: 1 week ago