Question
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
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.
I have provided you with an interface for the chicken class. Your base class will implement this interface and add the required methods. This first assignment will be to create a design document that details the base class as well as the board class and game class necessary to play a game of chicken.
I can't upload the program because I haven't done much.
I am especially having more trouble with the classes. Interface class, Abstract class...
An example could be very helpful. Thank you.
The language is Java. Using Eclipse.
This was my plan for the program. I hope these pages will help. Thank you.
I'm having trouble creating Interface and abstract classes for the program. I might also need help with the board. The language is Java.
Two chickensface 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. ita 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. List the Classes and their methods and variables used. public interface Shicken public String getName(): public void change dicestion(int direction 7/public void get locatio(int location); public void hit(int damage): public double fire public abstra class Chicken implements Shicken private String name: private int direction: Hl/private int location: private int damage: Public class Hun. Chicken Private Scanner scan: Public Humo. Chicken(String name, Scanner scan) Public int fire) Public class Some..Shisken Public Hum_Chicken(String name) Public double fired) MORE public void move_left(): public void move_right(): public void move_up: public void move_down public boolean alive(): public int set_vars(int min, int max,intvar: public class Game private hum_Chicken comp_chicken scanner scan Bool game_over Take_turns Hum turn Comp turn Check_wins initialize_game initialize_ hum_Chicken initialize_ comp_Chicken public void play_game .......... Public class GoChicken_Main Public static void main(String] args) Simple flow chart. GoChicken_Main.main Game Game( -> Game.initialize_gamel initialize_game] initialize_Chickens initialize_chicken() initialize_hum_Chicken initialize_Chicken() initialize_comp_Chicken: Game) Play_game Take_turns Human computer Two chickensface 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. ita 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. List the Classes and their methods and variables used. public interface Shicken public String getName(): public void change dicestion(int direction 7/public void get locatio(int location); public void hit(int damage): public double fire public abstra class Chicken implements Shicken private String name: private int direction: Hl/private int location: private int damage: Public class Hun. Chicken Private Scanner scan: Public Humo. Chicken(String name, Scanner scan) Public int fire) Public class Some..Shisken Public Hum_Chicken(String name) Public double fired) MORE public void move_left(): public void move_right(): public void move_up: public void move_down public boolean alive(): public int set_vars(int min, int max,intvar: public class Game private hum_Chicken comp_chicken scanner scan Bool game_over Take_turns Hum turn Comp turn Check_wins initialize_game initialize_ hum_Chicken initialize_ comp_Chicken public void play_game .......... Public class GoChicken_Main Public static void main(String] args) Simple flow chart. GoChicken_Main.main Game Game( -> Game.initialize_gamel initialize_game] initialize_Chickens initialize_chicken() initialize_hum_Chicken initialize_Chicken() initialize_comp_Chicken: Game) Play_game Take_turns Human computerStep 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