Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I am a fresh learner in Java and trying to make an 8 by 8 Reversi/Othello. Now I'm getting a few confusions - as

Hi, I am a fresh learner in Java and trying to make an 8 by 8 Reversi/Othello. Now I'm getting a few confusions - as such I can update values and print the board but also trying to make other methods which would help to make the code work. Here are given the below methods - and their descriptions.

public Point[] getPlaceableLocations(char player, char opponent): This method checks which locations are possible / valid for the player in turn. Then, it returns these valid positions. There are only 64 positions in our 8x8 board, so 64 is the higher limit. 8 cases need to be checked: top down, bottom up, left to right, right to left and the 4 diagonals.

public void showPlaceableLocations(Point[] locations, char player, char opponent): This method mark any valid positions with a *, so as to give some hints for the players.

public void placeMove(Point p, char player, char opponent): This method updates the situation of the board according to the moves/actions taken by the players.

There's also a point class with the code has added below for it.

image text in transcribed

Thanks a lot and let me know if more information is needed. I'll rate good.

public class Point t public int x, y; Point(int x, int y)t this.x X this.y-y public class Point t public int x, y; Point(int x, int y)t this.x X this.y-y

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

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions