1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
pychu [463]
3 years ago
9

Write a class called OrthokonBoard that represents the board for a two-player game that is played on a 4x4 grid.

Computers and Technology
1 answer:
Elden [556K]3 years ago
6 0

Answer:

Explanation:

The following code is written in Java. It creates the class OrthokonBoard which holds a 4x4 grid board in which each space is an "x" . Once the user creates an OrthokonBoard object they need to pass the positions of player 1 and 2 as an integer array of an x and y coordinate on the grid. Then the constructor of the object places the players on the board. A test version of the class was added to the main method and the output can be seen in the attached picture below.

class Brainly {

   public static void main(String[] args) {

       int[] player1Pos = {1, 1};

       int[] player2Pos = {3,3};

       OrthokonBoard newBoard = new OrthokonBoard(player1Pos, player2Pos);

       for (char[] x : newBoard.board) {

           System.out.println("");

           for ( char y : x) {

               System.out.print(y + " ");

           }

       }

   }

}

class OrthokonBoard {

   char[][] board = {{'x', 'x', 'x', 'x'}, {'x', 'x', 'x', 'x'}, {'x', 'x', 'x', 'x'}, {'x', 'x', 'x', 'x'}};

   public OrthokonBoard(int[] playerOnePos, int[] playerTwoPos) {

       board[playerOnePos[0]][playerOnePos[1]] = '1';

       board[playerTwoPos[0]][playerTwoPos[1]] = '2';

   }

}

You might be interested in
What determines how large the crystals in an igneous rock will be?
loris [4]
I would say A or D im leaning towards A more though.
6 0
3 years ago
Read 2 more answers
You want to copy data from one cell or range to an adjacent cell or range in your spreadsheet, without using a shortcut key. Whi
astraxan [27]

How can you insert a new row into your data without disturbing an adjacent set of data on the same sheet? Highlight only the data where you'd like to insert a row. Right-click > Insert > Shift cells down.

3 0
3 years ago
When a workforce scheduling problems is formulated as an integer programming model, it has:?
Dennis_Churaev [7]
More force because it's the impact
6 0
4 years ago
How to get out of the verify your identity page on a dell laptop because it won’t let me
motikmotik

lol restart te computer and turn it on again

8 0
3 years ago
Why might you complete a 1040 instead of a <br> 1040ez
julia-pushkina [17]
Because compared to 1040EZ, 1040 way more more complex.


3 0
3 years ago
Read 2 more answers
Other questions:
  • What is the term for figures used to measures economic performance?
    9·1 answer
  • You have a network of 300 users. You are finding that you must frequently restore files from backup that users have accidentally
    13·1 answer
  • A short-term job or work project that can be paid or unpaid and can lead to a full-time, paying position is called a(n) _____.
    5·2 answers
  • Refer to the exhibit. A web designer calls to report that the web server web-s1.cisco is not reachable through a web browser. Th
    15·1 answer
  • What is master slide and tell about master slide
    6·1 answer
  • Suppose you want to boot a VM from its virtual DVD drive, but it boots to the VM’s hard drive. Which of the following could be t
    12·1 answer
  • Assume that x and y are boolean variables and have been properly initialized. !(x || y) || (x || y) The result of evaluating the
    10·1 answer
  • How am i able to hear a presenter from a radio station through my fm tuner​
    14·1 answer
  • Write a recursive decent algorithm for a java while statement, a Javas if statement , an logical/mathematical expression based o
    5·1 answer
  • A multiprocessor with 10 processors has 36 attached tape drives. A number of jobs have been submitted to the system where each j
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!