In this game we have a number of players interacting in a

Assignment Help JAVA Programming
Reference no: EM13346384

In this game, we have a number of players interacting in a simple way. The game takes place on a (virtual), two-dimensional piece of land. There are two types of player: Sheep, and Wolves. Sheep start at one point of the land, and they have to get to get to a green pasture to win. They move one step at a time. Usually, there are several sheep that start out at the same time. The more sheep get to the destination, the better. This diagram shows five sheep ("s") and the green pasture at the top:

758_Wolves and Sheep.png

Unfortunately, there is also a wolf. The wolf's objective is to find (and eat) as many sheep as possible. The wolf may be a little faster than the sheep, but it always needs a number of steps to finish eating one.Sheep and wolves are realized as separate Java classes. Each student will submit either a Sheep or a Wolf class. We're going to play a tournament: we're going to have an instance of each wolf and instances of four or five different sheep play the game and tally up the results.

Beware... the rules of the game are simple, but its dynamics can be very complex.

Example: Suppose we have 30 students (numbered 0..29) in this class. We will form 7 teams (A,B,C,D,E,F,G). Teams A,B,C,D will write the sheep - this means we'll have about 16 Sheep classes coming in. Teams E,F,G will write wolves - which makes another 14 Wolf classes.

In the tournament, we'll run many thousand games, each with one combination of the sheep classes from one of the four sheep teams, and exactly one wolf (out of 14) - that's 56 combinations. We need three rules of engagement to make this work.

Rule 1: You may not collaborate with other students outside of the team.

Rule 2: You should collaborate with the other students within your team. While everyone has to do their own implementation, you, for
example may collude to plot joint strategies against the wolf (if you're programming a sheep agent).

Rule 3: You must submit only your own code and may not write code for others. Small, shared functions that are marked as such are OK.

The playing field is a m by n rectangular grid with m*n cells. In each game, there are a number of players (several sheep players, and one wolf). Each player occupies exactly one cell in the grid, and no cell will contain more than one player (except a combination of the wolf and a sheep). Cells may also contain an obstacle, in which case no player can occupy the cell.

Players start at an assigned location. There are multiple steps (iterations): In each iteration, each sheep may move exactly one step to the left, the right, up, down, or diagonally, but not beyond the boundaries of the grid. In each iteration, the wolf may also move a constant k steps (k is to be determined by the game, and fixed throughout the tournament. All players will be told k). All players make one move at a time and see the updated positions. The wolf moves last. The player instance determines a move and communicates it as Δx and Δy (steps in each direction), where Δx and Δy are signed integers. For sheep, (Δx2 + Δy2) <= 2.0. For the wolf, (Δx2 + Δy2) < k2. For instance, if the wolf decides to move 2 steps to the left (Δx=-2) and 3 steps up (Δy=-3), then that would be a legal move if k is at least 2.9, because:

996_Wolves and Sheep1.png

If more than one sheep try to occupy the same cell, one of the sheep's moves fails and the sheep will not move. If the wolf and a sheep attempt to occupy the same location, the wolf begins to eat the sheep. A meal takes a number of steps f, during which the wolf will not move. The sheep perishes. Several green pastures ("goal cells") are determined by the game. Their location is known to all players. If a sheep reaches one these pastures, the sheep wins its game and disappears. The wolf cannot enter a pasture. The game terminates when all sheep have reached pastures or have been eaten, or after m+n steps, whichever comes first.

Parameters: The game parameters are available to the players upon instantiation:

1817_Wolves and Sheep2.png

Reference no: EM13346384

Questions Cloud

Write a paper on boyles law and describe compression and : write a paper on boyles law and describe compression and combustion stroke . also explain charless law and illustrate
Write a research report on software design and answer : write a research report on software design and answer diffrent type of questions related to design.1. describe three
Part 1for the first part of this assignment compare and : part 1for the first part of this assignment compare and contrast the theoretical and practical differences between
Write a paper on orthogonal frequency-division multiplexing : write a paper on orthogonal frequency-division multiplexing with advantages disadvantages and uses.the format
In this game we have a number of players interacting in a : in this game we have a number of players interacting in a simple way. the game takes place on a virtual
There are two questions on financial planningq why do you : there are two questions on financial planning.q why do you think most long term financial planning begins with the
Suppose a ferris wheel with radius of 12 meters is rotating : suppose a ferris wheel with radius of 12 meters is rotating at a rate of 2 rotations per minute.a. how fast is a person
Write a paper about what normal operations of the system : write a paper about what normal operations of the system that has gone wrong with obesity. then the effects of obesity
Exercise prepare a flexible budget gator divers is a : exercise prepare a flexible budget gator divers is a company that provides diving services such as underwater ship

Reviews

Write a Review

JAVA Programming Questions & Answers

  Print the contents of the array

Prepare a second loop that prints the contents of the array

  Write a program using an array that will store

Using java programing : Write a program using an array that will store input data. Prompt the user for and read 6 numbers between 70 and 90. Verify the numbers should be greater than 70 and less than 90. If the number is less than

  Class sorter which contains methods for selection sort

Write a class Sorter which contains methods for selection sort, insertion sort and bubble sort (start with the code below). Then create a client class which asks user to enter ten numbers using arrays. Then the program asks user which sorting algo..

  What is the full path the to location of the web application

suppose that you are creating a java web application named "cset-test" consisting of a JSP file named "main.jsp" , and a java Servlet in a file named "InfoServlet.java". The user's home directory is /home/jdoe.

  Write a string expression that parenthesizes the value

Given a string varible word, write a string expression that parenthesizes the value of word. So if the word contains "sadly" the value of the expression would be the string "(sadly)".

  Allows the user to enter a temperature and whether

Write a program that allows the user to enter a temperature and whether the temperature is stated in Celsius or Fahrenheit...or whethe

  Develop and test stand alone java applications

Gain practical skills in Graphical User Interface (GUI) programming by implementing an event driven application.

  In light of wrestling with ethics

In light of "Wrestling With Ethics" and other research/articles that you are able to draw upon, should profitability drive social responsibility? Be sure to support your discussion question responses with evidence from the readings and/or additional ..

  Simulate a simple version of a game called liar dice

The first player claims a Poker hand (see "Hand Ranks" below for legal calls). When making a claim, a player says what all five dice are, not just the name of the hand. For example, a player should say, "I have a full house: three 4s and two 5s," ..

  Write a program to read a file and encode

Write a program to read a file and encode the file to an encrypted file. And write a program to get an encrypted file and decode to original file. Your program should prompt the user to enter an input file name and an output file name

  Point of sale terminal

a software implementation of a Point of Sale terminal at a typical store. The users of the system are the cashiers sitting at the sales terminals of the store. The users can use the system to manage sales items in the store, customer details and of c..

  Java application that asks a user to enter two integers

Write a Java application that asks a user to enter two integers (A and B) and then display the results of A/B. Catch any division by zero errors and prompt the user to reenter the value of B. Be sure your code compiles and runs as expected. Name your..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd