Question
****How can I create a Chicken, Board and Game class for the following game in Java? Two chickens face each other on a 10x10 grid.
****How can I create a Chicken, Board and Game class for the following game in Java?
Two chickens face each other on a 10x10 grid. One chicken is controlled by the computer. One chicken starts in the upper left corner and the other in the lower right corner. The chicken can move or shoot, but not both. The way the chicken moves is the way the chicken is pointed. It can change its direction, but this is one turn.
The base chicken class can only move two squares in the direction it faces. The chicken can only shoot two squares away in a straight line the way it is facing. The chicken will have variables to store the Hit points. Hit points represent how many times it can be hit before it dies. I.E. if a chicken has 10 hit points and it is hit for 1 damage point it will have 9 hit points left. The amount of damage could change depending on which sub chicken is firing at it.
A turn consists of:
Chicken 1 Move: Pick a direction and update square 2 spaces in that direction. If the chicken is at the end of the grid it can only go that far.
Or
Chicken 1 fire: Fire two squares away in the direction the chicken is facing. Check to see if chicken 2 is there, if so, deduct point(s) from chicken 2s hit points. If chicken 2s hit points are zero game is over. If not, chicken two takes turn.
Or
Chicken 1 will change directions and prepare to move or fire the next turn.
HERE IS AN INTERFACE FOR THE GAME.
public interface IChicken { public void move(); public int[] fire(); public void change_direction(int direction); public int[] get_location(); public void hit(int damage); public boolean is_alive(); public int set_vars(int min, int max,int var); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started