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
Sliva [168]
3 years ago
7

Write a class named FBoard for playing a game, where player x is trying to get her piece to row 7 and player o is trying to make

it so player x doesn't have any legal moves. It should have: An 8x8 array of char for tracking the positions of the pieces.A data member called gameState that holds one of the following values: X_WON, O_WON, or UNFINISHED - use an enum type for this, not string (the enum definition should go in Board.hpp, before the class, not inside it).Data members to keep track of where the x piece is.A default constructor that initializes the array to empty (you can use whatever character you want to represent empty). It should then put four o pieces on row 7, in columns 0, 2, 4, and 6. It should put an x piece on row 0, column 3. It should also initialize the other data members.A method called getGameState that just returns the value of gameState.A method called moveX that takes as parameters the row and column of the square to move to. If the desired move is not allowed, or if the game has already been won, it should just return false. Otherwise it should make the move and return true. A piece belonging to x can move 1 square diagonally in any direction. A piece is not allowed to move off the board or to an occupied square. If x's move gets her piece to row 7, gameState should be set to X_WON.A method called moveO that takes as parameters the row and column to move from, and the row and column to move to. If the first pair of coordinates doesn't hold o's piece, or if the desired move is not allowed, or if the game has already been won, it should just return false. Othewise it should make the move and return true. A piece belonging to o can move 1 square diagonally, but the row cannot increase, so any o piece has at most two available moves. For example, if player o has a piece at (5, 2), it could move to (4, 1) or (4, 3), but not (6, 1) or (6, 3). It is not allowed to move off the board or to an occupied square. If o's move leaves no legal move for x, gameState should be set to O_WON.You do not need to track whose turn it is. Either move method can be called multiple times in a row. It doesn't matter which index of the array you consider the row and which you consider the column as long as you're consistent.Feel free to add private helper functions if you want. You may also find it useful to add a public print function to help with debugging.Do not access the array out of bounds. Make sure values are in bounds before using them to index into the array.
Engineering
1 answer:
OverLord2011 [107]3 years ago
7 0

Answer:

12345=V

Explanation:

You might be interested in
Compute the volume percent of graphite, VGr, in a 3.2 wt% C cast iron, assuming that all the carbon exists as the graphite phase
Yanka [14]

Answer:

The volume percentage of graphite is 10.197 per cent.

Explanation:

The volume percent of graphite is the ratio of the volume occupied by the graphite phase to the volume occupied by the graphite and ferrite phases. The weight percent in the cast iron is 3.2 wt% (graphite) and 96.8 wt% (ferrite). The volume percentage of graphite is:

\%V_{gr} = \frac{V_{gr}}{V_{gr}+V_{fe}} \times 100\,\%

Where:

V_{gr} - Volume occupied by the graphite phase, measured in cubic centimeters.

V_{fe} - Volume occupied by the graphite phase, measured in cubic centimeters.

The expression is expanded by using the definition of density and subsequently simplified:

\%V_{gr} = \frac{\frac{m_{gr}}{\rho_{gr}} }{\frac{m_{gr}}{\rho_{gr}}+\frac{m_{fe}}{\rho_{fe}}}\times 100\,\%

Where:

m_{fe}, m_{gr} - Masses of the ferrite and graphite phases, measured in grams.

\rho_{fe}, \rho_{gr} - Densities of the ferrite and graphite phases, measured in grams per cubic centimeter.

\%V_{gr} = \frac{1}{1+\frac{\frac{m_{fe}}{\rho_{fe}} }{\frac{m_{gr}}{\rho_{gr}} } }\times 100\,\%

\%V_{gr} = \frac{1}{1 + \left(\frac{\rho_{gr}}{\rho_{fe}} \right)\cdot\left(\frac{m_{fe}}{m_{gr}} \right)} \times 100\,\%

If \rho_{gr} = 2.3\,\frac{g}{cm^{3}}, \rho_{fe} = 7.9\,\frac{g}{cm^{3}}, m_{gr} = 3.2\,g and m_{fe} = 96.8\,g, the volume percentage of graphite is:

\%V_{gr} = \frac{1}{1+\left(\frac{2.3\,\frac{g}{cm^{3}} }{7.9\,\frac{g}{cm^{3}} } \right)\cdot \left(\frac{96.8\,g}{3.2\,g} \right)} \times 100\,\%

\%V_{gr} = 10.197\,\%V

The volume percentage of graphite is 10.197 per cent.

5 0
3 years ago
Question in image. Question from OSHA.
marin [14]

Answer:

2

Explanation:

my sister did this and its the answer

3 0
3 years ago
Read 2 more answers
Random question, does anyone here use Lego, do not answer unless that is a yes
Sophie [7]

Answer:

yes i have 2 huge bins of it

Explanation:

8 0
3 years ago
Read 2 more answers
In this assignment, you will write a user interface for your calculator using JavaFX. Your graphical user interface (GUI) should
Zolol [24]

Answer:

Kindly note that, you're to replace "at" with shift 2 as the brainly text editor can't take the symbol

Explanation:

import javafx.application.Application;

import javafx.stage.Stage;

import javafx.scene.Group;

import javafx.scene.Scene;

import javafx.scene.layout.VBox;

import javafx.scene.layout.HBox;

import javafx.scene.control.TextField;

import javafx.scene.control.Button;

public class Calculator extends Application {

public static void main(String[] args) {

// TODO Auto-generated method stub

launch(args);

}

"at"Override

public void start(Stage primaryStage) throws Exception {

// TODO Auto-generated method stub

Group root = new Group();

VBox mainBox = new VBox();

HBox inpBox = new HBox();

TextField txtInput = new TextField ();

txtInput.setEditable(false);

txtInput.setStyle("-fx-font: 20 mono-spaced;");

txtInput.setText("0.0");

txtInput.setMinHeight(20);

txtInput.setMinWidth(200);

inpBox.getChildren().add(txtInput);

Scene scene = new Scene(root, 200, 294);

mainBox.getChildren().add(inpBox);

HBox rowOne = new HBox();

Button btn7 = new Button("7");

btn7.setMinWidth(50);

btn7.setMinHeight(50);

Button btn8 = new Button("8");

btn8.setMinWidth(50);

btn8.setMinHeight(50);

Button btn9 = new Button("9");

btn9.setMinWidth(50);

btn9.setMinHeight(50);

Button btnDiv = new Button("/");

btnDiv.setMinWidth(50);

btnDiv.setMinHeight(50);

rowOne.getChildren().addAll(btn7,btn8,btn9,btnDiv);

mainBox.getChildren().add(rowOne);

HBox rowTwo = new HBox();

Button btn4 = new Button("4");

btn4.setMinWidth(50);

btn4.setMinHeight(50);

Button btn5 = new Button("5");

btn5.setMinWidth(50);

btn5.setMinHeight(50);

Button btn6 = new Button("6");

btn6.setMinWidth(50);

btn6.setMinHeight(50);

Button btnMul = new Button("*");

btnMul.setMinWidth(50);

btnMul.setMinHeight(50);

rowTwo.getChildren().addAll(btn4,btn5,btn6,btnMul);

mainBox.getChildren().add(rowTwo);

HBox rowThree = new HBox();

Button btn1 = new Button("1");

btn1.setMinWidth(50);

btn1.setMinHeight(50);

Button btn2 = new Button("2");

btn2.setMinWidth(50);

btn2.setMinHeight(50);

Button btn3 = new Button("3");

btn3.setMinWidth(50);

btn3.setMinHeight(50);

Button btnSub = new Button("-");

btnSub.setMinWidth(50);

btnSub.setMinHeight(50);

rowThree.getChildren().addAll(btn1,btn2,btn3,btnSub);

mainBox.getChildren().add(rowThree);

HBox rowFour = new HBox();

Button btnC = new Button("C");

btnC.setMinWidth(50);

btnC.setMinHeight(50);

Button btn0 = new Button("0");

btn0.setMinWidth(50);

btn0.setMinHeight(50);

Button btnDot = new Button(".");

btnDot.setMinWidth(50);

btnDot.setMinHeight(50);

Button btnAdd = new Button("+");

btnAdd.setMinWidth(50);

btnAdd.setMinHeight(50);

rowFour.getChildren().addAll(btnC,btn0,btnDot,btnAdd);

mainBox.getChildren().add(rowFour);

HBox rowFive = new HBox();

Button btnEq = new Button("=");

btnEq.setMinWidth(200);

btnEq.setMinHeight(50);

rowFive.getChildren().add(btnEq);

mainBox.getChildren().add(rowFive);

root.getChildren().add(mainBox);

primaryStage.setScene(scene);

primaryStage.setTitle("GUI Calculator");

primaryStage.show();

}

}

4 0
3 years ago
A square-thread power screw has a major diameter of 32 mm and a pitch of 4 mm with single threads, and it is used to raise a loa
Valentin [98]

Answer:

54mm.

Explanation:

So, we are given the following data or parameters or information that is going to assist in solving this type of question efficiently;

=> "A square-thread power screw has a major diameter of 32 mm"

=> "a pitch of 4 mm with single threads"

=> " and it is used to raise a load putting a force of 6.5 kN on the screw."

=> The coefficient of friction for both the collar and screw is .08."

=> "If the torque from the motored used to raise the load is limited to 26 N×M."

Step one: determine the lead angle. The lead angle can be calculated by using the formula below;

Lead angle = Tan^- (bg × T/ Jh × π ).

=> Jh = J - T/ 2. = 32 - 4/2. = 30mm.

Lead angle = Tan^- { 1 × 4/ π × 30} = 2.43°.

Step two: determine the Torque required to against thread friction.

Starting from; phi = tan^-1 ( 0.08) = 4.57°.

Torque required to against thread friction = W × Jh/2 × tan (lead angle + phi).

Torque required to against thread friction =( 6500 × 30/2) × tan ( 2.43° + 4.57°). = 11971.49Nmm.

Step three: determine the Torque required to against collar friction.

=> 2600 - 11971.49Nmm = 14028.51Nmm.

Step four = determine the mean collar friction.

Mean collar friction = 14028.51Nmm/0.08 × 6500 = 27mm

The mean collar diameter = 27 × 2 = 54mm.

5 0
3 years ago
Other questions:
  • Is it more difficult to pump oil from a well on dry land or a well under water?Why?
    11·1 answer
  • Supón que tienes que calcular el centro de gravedad de una pieza
    11·1 answer
  • The mechanical properties of a metal may be improved by incorporating fine particles of its oxide. Given that the moduli of elas
    5·1 answer
  • What are the four basic parts of process plan
    11·1 answer
  • Air is to be heated steadily by an 8-kW electric resistance heater as it flows through an insulated duct. If the air enters at 5
    10·1 answer
  • A can of engine oil with a length of 150 mm and a diameter of 100 mm is placed vertically in the trunk of a car. On a hot summer
    8·1 answer
  • Bob would like to run his house off the grid, therefore he needs to find out how many solar panels and batteries he needs to buy
    12·1 answer
  • 1. When and why should we use the Pattern option?
    12·1 answer
  • Task Three :Write a C++ program to read temperature
    15·1 answer
  • On what kind of sectional drawing would you find the maximum length of a building?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!