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
Kay [80]
4 years ago
12

Design a method for representing the state of a tic-tac-toe board in computer memory. can you fit your representation into three

bytes?
Computers and Technology
2 answers:
ra1l [238]4 years ago
7 0
The combination of Xs,Os, and blanks will approximately be somewhere between 2048 and about 4048. The combination’s total is 19, 683, but since the Xs and Os number will always be equal or off by 1, many cases are eliminated. Thus, the board is represented in 11 or 12 bits.
mote1985 [20]4 years ago
4 0

Answer:

A Tic-Tac-Toe board consist of 9 fields. Each field can take 3 states: Empty, Circle, Cross. To represent each state you need 2 bits: 00, 01, 10.

With two bits for each field, you can easily represent whole board in 3 bytes, by using two bits as each field, and each byte as row of board.

You might be interested in
Document templates are available online.<br> True<br> False
k0ka [10]
True anything is available online.
6 0
3 years ago
Read 2 more answers
Write method reverseString, which takes a string str and returns a new string with the characters in str in reverse order. For e
son4ous [18]

Answer:

The method written in Java is as follows:

public static String reverseString(String str){

    String result = "";

    int lentt = str.length();

    char[] strArray = str.toCharArray();

       for (int i = lentt - 1; i >= 0; i--)

           result+=strArray[i];

    return result;

}

Explanation:

This defines the method

public static String reverseString(String str){

This initializes the result of the reversed string to an empty string

    String result = "";

This calculates the length of the string

    int lentt = str.length();

This converts the string to a char array

    char[] strArray = str.toCharArray();

This iterates through the char array

       for (int i = lentt - 1; i >= 0; i--)

This gets the reversed string

           result+=strArray[i];

This returns the reversed string            

    return result;

}

<em>See attachment for full program that includes the main method</em>

Download txt
3 0
3 years ago
When processing all the elements of row i of a two-dimensional array named grades using a for loop with variable j, what is the
kykrilka [37]

Answer:

D

Explanation:

Two dimensional array contain both rows and columns. Each row represented one record and each column represent one filed in that record.

for ex: int grades[5][3];

here array grades contains 5 rows and in each row we have 3 columns

if we have grades[i][j] then " i " represents number of rows and j represents the number of columns in that row.

j<grades[i].length represents i=0 to 2[here no of columns are 3, array index starts from 0 to 2]

The Answer is D

8 0
3 years ago
Sean is a computer programmer. He has programmed an application
Mila [183]

Answer:

im pretty sure the answer is B            Hope this helps :)

5 0
3 years ago
May someone do this please? Thanks!!
vovangra [49]

Answer:Jeez

Explanation: thats a lot

5 0
3 years ago
Other questions:
  • What is internet protocol? Language computers use to communicate over the internet Small files that websites put on your PC to s
    8·2 answers
  • What is the difference between primary storage,secondary storage and offline storage what type of storage can be
    6·2 answers
  • The code segment below uses the procedure IsPartOf (list, item), which returns true if item appears in list and returns false ot
    13·1 answer
  • Gabriel needs to create a formula that does not change when it is copied to cell b2. which formula should he create?
    14·1 answer
  • In a Web-based database, middleware is used to transfer information from the organization's internal database back to the Web se
    12·1 answer
  • Write the definition of a function reverse, whose first parameter is an array of integers and whose second parameter is the numb
    15·1 answer
  • 4.12 LAB: Using math methods Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to
    10·1 answer
  • Please hurry
    15·2 answers
  • 1. Why do you need to take care of your computer? (Remember: Answer must include 3-5 sentences.)
    13·1 answer
  • Type of cable installed on a patch panel?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!