SlideShare a Scribd company logo
need help with code I wrote. This code is a maze gui, and i need help with the method
shorterstpath(); here is my code:
******mazeApp*******
package mazepackage;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.TextInputDialog;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class MazeApp extends Application
{
// default canvas size is DEFAULT_SIZE-by-DEFAULT_SIZE
private static final int DEFAULT_SIZE = 768;
private int width = DEFAULT_SIZE;
private int height = DEFAULT_SIZE;
// The graphics context is needed to enable drawing on the canvas
private GraphicsContext gc;
// boundary of drawing canvas, 0% border
// private static final double BORDER = 0.05;
private static final double BORDER = 0.00;
private double xmin, ymin, xmax, ymax;
public static void main(String[] args)
{
launch(args);
}
@Override
public void start(Stage primaryStage)
{
Group root = new Group();
Canvas canvas = new Canvas(width, height);
gc = canvas.getGraphicsContext2D();
gc.setLineWidth(2);
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, width, height);
root.getChildren().add(canvas);
TextInputDialog tid = new TextInputDialog();
tid.setTitle("Maze Size");
tid.setHeaderText("Enter maze size between 10 and 50");
tid.showAndWait();
int size = Integer.parseInt(tid.getResult());
if (size > 50)
size = 50;
if (size < 10)
size = 10;
primaryStage.setTitle("Maze Application");
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
// Make sure that the application goes away when then window is closed
primaryStage.setOnCloseRequest(e -> System.exit(0));
primaryStage.show();
Maze maze = new Maze(this, size);
// Must solve the maze in a separate thread or else
// the GUI wont update until the end.....
Thread solver = new Thread(
new Runnable () {
public void run()
{
while(true)
{
maze.buildAndDrawMaze();
maze.findShortestPath();
try
{
Thread.sleep(5000);
}
catch(Exception e) { }
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, width, height);
}
}
});
solver.start();
}
/**
* Sets the pen color to the specified color.
*
* @param color the color to make the pen
*/
public void setPenColor(Color color) {
gc.setStroke(color);
}
/**
* Sets the pen color to the specified color.
*
* @param color the color to make the pen
*/
public void setFillColor(Color color) {
gc.setFill(color);
}
/**
* Sets the x-scale to the specified range.
*
* @param min the minimum value of the x-scale
* @param max the maximum value of the x-scale
* @throws IllegalArgumentException if {@code (max == min)}
*/
public void setXscale(double min, double max) {
double size = max - min;
if (size == 0.0) {
throw new IllegalArgumentException("the min and max are the same");
}
xmin = min - BORDER * size;
xmax = max + BORDER * size;
}
/**
* Sets the y-scale to the specified range.
*
* @param min the minimum value of the y-scale
* @param max the maximum value of the y-scale
* @throws IllegalArgumentException if {@code (max == min)}
*/
public void setYscale(double min, double max) {
double size = max - min;
if (size == 0.0) {
throw new IllegalArgumentException("the min and max are the same");
}
ymin = min - BORDER * size;
ymax = max + BORDER * size;
}
// helper functions that scale from user coordinates to screen coordinates and back
private double scaleX(double x) {
return width * (x - xmin) / (xmax - xmin);
}
private double scaleY(double y) {
return height * (ymax - y) / (ymax - ymin);
}
private double factorX(double w) {
return w * width / Math.abs(xmax - xmin);
}
private double factorY(double h) {
return h * height / Math.abs(ymax - ymin);
}
private double userX(double x) {
return xmin + x * (xmax - xmin) / width;
}
private double userY(double y) {
return ymax - y * (ymax - ymin) / height;
}
/**
* Draws a line segment between (x0,
* y0) and (x1,
* y1).
*
* @param x0 the x-coordinate of one endpoint
* @param y0 the y-coordinate of one endpoint
* @param x1 the x-coordinate of the other endpoint
* @param y1 the y-coordinate of the other endpoint
*/
public void line(double x0, double y0, double x1, double y1) {
gc.strokeLine(scaleX(x0), scaleY(y0), scaleX(x1), scaleY(y1));
}
/**
* Draws one pixel at (x, y). This method is private
* because pixels depend on the display. To achieve the same effect, set the
* pen radius to 0 and call {@code point()}.
*
* @param x the x-coordinate of the pixel
* @param y the y-coordinate of the pixel
*/
private void pixel(double x, double y) {
gc.fillRect((int) Math.round(scaleX(x)), (int) Math.round(scaleY(y)), 1, 1);
}
/**
* Draws a filled circle of the specified radius, centered at (x,
* y).
*
* @param x the x-coordinate of the center of the circle
* @param y the y-coordinate of the center of the circle
* @param radius the radius of the circle
* @throws IllegalArgumentException if {@code radius} is negative
*/
public void filledCircle(double x, double y, double radius) {
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2 * radius);
double hs = factorY(2 * radius);
if (ws <= 1 && hs <= 1) {
pixel(x, y);
} else {
gc.fillOval(xs - ws / 2, ys - hs / 2, ws, hs);
}
}
}
***********maze.java**************
package mazepackage;
import java.util.LinkedList;
import java.util.Random;
import javafx.scene.paint.Color;
public class Maze {
private int N; // dimension of maze
private MazeCell[][] maze;
private Random rand = new Random();
// Used to signal the maze has been solved
private boolean done;
// time in milliseconds (from currentTimeMillis()) when we can draw again
// used to control the frame rate
private long nextDraw = -1;
private MazeApp mf;
// Define constants for the circle size
private final double BIG = 0.375;
private final double SMALL = 0.25;
// Define constants for the delay times
private final int SHORT = 30;
private final int LONG = 500;
public Maze(MazeApp ma, int n) {
N = n;
mf = ma;
mf.setXscale(0, N + 2);
mf.setYscale(0, N + 2);
}
public void buildAndDrawMaze() {
createMaze();
buildMaze();
drawMaze();
}
// create the initial data structures that contain the maze data
private void createMaze() {
maze = new MazeCell[N + 2][N + 2];
for (int i = 0; i < N + 2; i++) {
for (int j = 0; j < N + 2; j++) {
maze[i][j] = new MazeCell(i, j);
}
}
// initialize border cells as already visited
for (int x = 0; x < N + 2; x++) {
maze[x][0].visited = true;
maze[x][N + 1].visited = true;
}
for (int y = 0; y < N + 2; y++) {
maze[0][y].visited = true;
maze[N + 1][y].visited = true;
}
}
// build the maze
private void buildMaze(int x, int y) {
maze[x][y].visited = true;
// while there is an unvisited neighbor
while (!maze[x][y + 1].visited || !maze[x + 1][y].visited
|| !maze[x][y - 1].visited || !maze[x - 1][y].visited) {
// pick random neighbor (could use Knuth's trick instead)
while (true) {
int r = rand.nextInt(4);
if (r == 0 && !maze[x][y + 1].visited) {
maze[x][y].nth = false;
maze[x][y + 1].sth = false;
buildMaze(x, y + 1);
break;
} else if (r == 1 && !maze[x + 1][y].visited) {
maze[x][y].est = false;
maze[x + 1][y].wst = false;
buildMaze(x + 1, y);
break;
} else if (r == 2 && !maze[x][y - 1].visited) {
maze[x][y].sth = false;
maze[x][y - 1].nth = false;
buildMaze(x, y - 1);
break;
} else if (r == 3 && !maze[x - 1][y].visited) {
maze[x][y].wst = false;
maze[x - 1][y].est = false;
buildMaze(x - 1, y);
break;
}
}
}
}
// build the maze starting from lower left
private void buildMaze() {
buildMaze(1, 1);
// Make sure visited is reset to false
for (int x = 1; x < N + 1; x++) {
for (int y = 1; y < N + 1; y++) {
maze[x][y].visited = false;
}
}
// delete some random walls
for (int i = 0; i < N; i++) {
int x = 1 + rand.nextInt(N - 1);
int y = 1 + rand.nextInt(N - 1);
maze[x][y].nth = maze[x][y + 1].sth = false;
}
}
// draw the initial maze
private void drawMaze() {
drawCircle(Color.RED, N / 2, N / 2, BIG);
drawCircle(Color.RED, 1, 1, BIG);
// Draw the walls in black
mf.setPenColor(Color.BLACK);
for (int x = 1; x <= N; x++) {
for (int y = 1; y <= N; y++) {
if (maze[x][y].sth) {
mf.line(x, y, x + 1, y);
}
if (maze[x][y].nth) {
mf.line(x, y + 1, x + 1, y + 1);
}
if (maze[x][y].wst) {
mf.line(x, y, x, y + 1);
}
if (maze[x][y].est) {
mf.line(x + 1, y, x + 1, y + 1);
}
}
}
delay(LONG);
}
private void delay(int t) {
// sleep until the next time we're allowed to draw
long millis = System.currentTimeMillis();
if (millis < nextDraw) {
try {
Thread.sleep(nextDraw - millis);
} catch (InterruptedException e) {
System.out.println("Error sleeping");
}
millis = nextDraw;
}
// when are we allowed to draw again
nextDraw = millis + t;
}
private void drawCircle(Color c, double x, double y, double size) {
mf.setFillColor(c);
mf.filledCircle(x + 0.5, y + 0.5, size);
}
public void findShortestPath() {
// Your code goes here!!!!!
}
}
class MazeCell {
// nth, sth, est, wst used to identify walls - true indicates wall present
boolean nth, sth, wst, est;
// used to indicate that a cell has already been processed
boolean visited;
// used to facilitate finding the neighbors of a cell
int row, col;
public MazeCell(int i, int j) {
row = i;
col = j;
// All walls are initially present for every cell
nth = sth = est = wst = true;
// Initially no cells have been visited
visited = false;
}
}
class MazeMap {
MazeCell nFromCenter = null;
MazeMap nMinus1FromCenter = null;
}
***end of code***
here is the stradgey that Im supposed to follow:
Strategy:
Implement the findShortestPath() method in the given code to find the shortest solution in the
maze.
Strategy will be using breadth first search starting from the end point of the maze looking for the
entrance.
Create two linked list of MazeMap objects
LinkedList
Create MazeMap for center and add to first list(Center MazeCell is maze[N/2][N/2], entrance is
maze[1][1])
Iterate through first list and add MazeMap distance n+1 to second list.
Set first list equal to second list, clear second list and repeat.
MazeCell:
In the GUI representation, rows of the maze are vertical, columns are horizontal. Cell 0,0 of the
maze in drawn in the lower left corner. The following summarizes what to do to move in a
specific direction from any cell in the maze. Remember, each cell contains its own row, col
position.
North neighbor is at row, col + 1
South neighbor is at row, col – 1
East neighbor is at row + 1, col
West neighbor is at row – 1, col
Solution
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.TextInputDialog;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class MazeApp extends Application
{
// default canvas size is DEFAULT_SIZE-by-DEFAULT_SIZE
private static final int DEFAULT_SIZE = 768;
private int width = DEFAULT_SIZE;
private int height = DEFAULT_SIZE;
// The graphics context is needed to enable drawing on the canvas
private GraphicsContext gc;
// boundary of drawing canvas, 0% border
// private static final double BORDER = 0.05;
private static final double BORDER = 0.00;
private double xmin, ymin, xmax, ymax;
public static void main(String[] args)
{
launch(args);
}
@Override
public void start(Stage primaryStage)
{
Group root = new Group();
Canvas canvas = new Canvas(width, height);
gc = canvas.getGraphicsContext2D();
gc.setLineWidth(2);
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, width, height);
root.getChildren().add(canvas);
TextInputDialog tid = new TextInputDialog();
tid.setTitle("Maze Size");
tid.setHeaderText("Enter maze size between 10 and 50");
tid.showAndWait();
int size = Integer.parseInt(tid.getResult());
if (size > 50)
size = 50;
if (size < 10)
size = 10;
primaryStage.setTitle("Maze Application");
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
// Make sure that the application goes away when then window is closed
primaryStage.setOnCloseRequest(e -> System.exit(0));
primaryStage.show();
Maze maze = new Maze(this, size);
// Must solve the maze in a separate thread or else
// the GUI wont update until the end.....
Thread solver = new Thread(
new Runnable () {
public void run()
{
while(true)
{
maze.buildAndDrawMaze();
maze.findShortestPath();
try
{
Thread.sleep(5000);
}
catch(Exception e) { }
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, width, height);
}
}
});
solver.start();
}
/**
* Sets the pen color to the specified color.
*
* @param color the color to make the pen
*/
public void setPenColor(Color color) {
gc.setStroke(color);
}
/**
* Sets the pen color to the specified color.
*
* @param color the color to make the pen
*/
public void setFillColor(Color color) {
gc.setFill(color);
}
/**
* Sets the x-scale to the specified range.
*
* @param min the minimum value of the x-scale
* @param max the maximum value of the x-scale
* @throws IllegalArgumentException if {@code (max == min)}
*/
public void setXscale(double min, double max) {
double size = max - min;
if (size == 0.0) {
throw new IllegalArgumentException("the min and max are the same");
}
xmin = min - BORDER * size;
xmax = max + BORDER * size;
}
/**
* Sets the y-scale to the specified range.
*
* @param min the minimum value of the y-scale
* @param max the maximum value of the y-scale
* @throws IllegalArgumentException if {@code (max == min)}
*/
public void setYscale(double min, double max) {
double size = max - min;
if (size == 0.0) {
throw new IllegalArgumentException("the min and max are the same");
}
ymin = min - BORDER * size;
ymax = max + BORDER * size;
}
// helper functions that scale from user coordinates to screen coordinates and back
private double scaleX(double x) {
return width * (x - xmin) / (xmax - xmin);
}
private double scaleY(double y) {
return height * (ymax - y) / (ymax - ymin);
}
private double factorX(double w) {
return w * width / Math.abs(xmax - xmin);
}
private double factorY(double h) {
return h * height / Math.abs(ymax - ymin);
}
private double userX(double x) {
return xmin + x * (xmax - xmin) / width;
}
private double userY(double y) {
return ymax - y * (ymax - ymin) / height;
}
/**
* Draws a line segment between (x0,
* y0) and (x1,
* y1).
*
* @param x0 the x-coordinate of one endpoint
* @param y0 the y-coordinate of one endpoint
* @param x1 the x-coordinate of the other endpoint
* @param y1 the y-coordinate of the other endpoint
*/
public void line(double x0, double y0, double x1, double y1) {
gc.strokeLine(scaleX(x0), scaleY(y0), scaleX(x1), scaleY(y1));
}
/**
* Draws one pixel at (x, y). This method is private
* because pixels depend on the display. To achieve the same effect, set the
* pen radius to 0 and call {@code point()}.
*
* @param x the x-coordinate of the pixel
* @param y the y-coordinate of the pixel
*/
private void pixel(double x, double y) {
gc.fillRect((int) Math.round(scaleX(x)), (int) Math.round(scaleY(y)), 1, 1);
}
/**
* Draws a filled circle of the specified radius, centered at (x,
* y).
*
* @param x the x-coordinate of the center of the circle
* @param y the y-coordinate of the center of the circle
* @param radius the radius of the circle
* @throws IllegalArgumentException if {@code radius} is negative
*/
public void filledCircle(double x, double y, double radius) {
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2 * radius);
double hs = factorY(2 * radius);
if (ws <= 1 && hs <= 1) {
pixel(x, y);
} else {
gc.fillOval(xs - ws / 2, ys - hs / 2, ws, hs);
}
}
}
***********maze.java**************
package mazepackage;
import java.util.LinkedList;
import java.util.Random;
import javafx.scene.paint.Color;
public class Maze {
private int N; // dimension of maze
private MazeCell[][] maze;
private Random rand = new Random();
// Used to signal the maze has been solved
private boolean done;
// time in milliseconds (from currentTimeMillis()) when we can draw again
// used to control the frame rate
private long nextDraw = -1;
private MazeApp mf;
// Define constants for the circle size
private final double BIG = 0.375;
private final double SMALL = 0.25;
// Define constants for the delay times
private final int SHORT = 30;
private final int LONG = 500;
public Maze(MazeApp ma, int n) {
N = n;
mf = ma;
mf.setXscale(0, N + 2);
mf.setYscale(0, N + 2);
}
public void buildAndDrawMaze() {
createMaze();
buildMaze();
drawMaze();
}
// create the initial data structures that contain the maze data
private void createMaze() {
maze = new MazeCell[N + 2][N + 2];
for (int i = 0; i < N + 2; i++) {
for (int j = 0; j < N + 2; j++) {
maze[i][j] = new MazeCell(i, j);
}
}
// initialize border cells as already visited
for (int x = 0; x < N + 2; x++) {
maze[x][0].visited = true;
maze[x][N + 1].visited = true;
}
for (int y = 0; y < N + 2; y++) {
maze[0][y].visited = true;
maze[N + 1][y].visited = true;
}
}
// build the maze
private void buildMaze(int x, int y) {
maze[x][y].visited = true;
// while there is an unvisited neighbor
while (!maze[x][y + 1].visited || !maze[x + 1][y].visited
|| !maze[x][y - 1].visited || !maze[x - 1][y].visited) {
// pick random neighbor (could use Knuth's trick instead)
while (true) {
int r = rand.nextInt(4);
if (r == 0 && !maze[x][y + 1].visited) {
maze[x][y].nth = false;
maze[x][y + 1].sth = false;
buildMaze(x, y + 1);
break;
} else if (r == 1 && !maze[x + 1][y].visited) {
maze[x][y].est = false;
maze[x + 1][y].wst = false;
buildMaze(x + 1, y);
break;
} else if (r == 2 && !maze[x][y - 1].visited) {
maze[x][y].sth = false;
maze[x][y - 1].nth = false;
buildMaze(x, y - 1);
break;
} else if (r == 3 && !maze[x - 1][y].visited) {
maze[x][y].wst = false;
maze[x - 1][y].est = false;
buildMaze(x - 1, y);
break;
}
}
}
}
// build the maze starting from lower left
private void buildMaze() {
buildMaze(1, 1);
// Make sure visited is reset to false
for (int x = 1; x < N + 1; x++) {
for (int y = 1; y < N + 1; y++) {
maze[x][y].visited = false;
}
}
// delete some random walls
for (int i = 0; i < N; i++) {
int x = 1 + rand.nextInt(N - 1);
int y = 1 + rand.nextInt(N - 1);
maze[x][y].nth = maze[x][y + 1].sth = false;
}
}
// draw the initial maze
private void drawMaze() {
drawCircle(Color.RED, N / 2, N / 2, BIG);
drawCircle(Color.RED, 1, 1, BIG);
// Draw the walls in black
mf.setPenColor(Color.BLACK);
for (int x = 1; x <= N; x++) {
for (int y = 1; y <= N; y++) {
if (maze[x][y].sth) {
mf.line(x, y, x + 1, y);
}
if (maze[x][y].nth) {
mf.line(x, y + 1, x + 1, y + 1);
}
if (maze[x][y].wst) {
mf.line(x, y, x, y + 1);
}
if (maze[x][y].est) {
mf.line(x + 1, y, x + 1, y + 1);
}
}
}
delay(LONG);
}
private void delay(int t) {
// sleep until the next time we're allowed to draw
long millis = System.currentTimeMillis();
if (millis < nextDraw) {
try {
Thread.sleep(nextDraw - millis);
} catch (InterruptedException e) {
System.out.println("Error sleeping");
}
millis = nextDraw;
}
// when are we allowed to draw again
nextDraw = millis + t;
}
private void drawCircle(Color c, double x, double y, double size) {
mf.setFillColor(c);
mf.filledCircle(x + 0.5, y + 0.5, size);
}
public void findShortestPath() {
// Your code goes here!!!!!
}
}
class MazeCell {
// nth, sth, est, wst used to identify walls - true indicates wall present
boolean nth, sth, wst, est;
// used to indicate that a cell has already been processed
boolean visited;
// used to facilitate finding the neighbors of a cell
int row, col;
public MazeCell(int i, int j) {
row = i;
col = j;
// All walls are initially present for every cell
nth = sth = est = wst = true;
// Initially no cells have been visited
visited = false;
}
}
class MazeMap {
MazeCell nFromCenter = null;
MazeMap nMinus1FromCenter = null;
}

More Related Content

Similar to need help with code I wrote. This code is a maze gui, and i need hel.pdf

Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for Speed
Yung-Yu Chen
 
Polygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdfPolygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdf
apnafreez
 
Polygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdfPolygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdf
apnafreez
 
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfModify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
arjuncorner565
 
Mobile Game and Application with J2ME - Collision Detection
Mobile Gameand Application withJ2ME  - Collision DetectionMobile Gameand Application withJ2ME  - Collision Detection
Mobile Game and Application with J2ME - Collision Detection
Jenchoke Tachagomain
 
Mobile Game and Application with J2ME
Mobile Gameand Application with J2MEMobile Gameand Application with J2ME
Mobile Game and Application with J2ME
Jenchoke Tachagomain
 
ES6(ES2015) is beautiful
ES6(ES2015) is beautifulES6(ES2015) is beautiful
ES6(ES2015) is beautiful
monikagupta18jan
 
Java Question help needed In the program Fill the Add statements.pdf
Java Question  help needed In the program Fill the Add statements.pdfJava Question  help needed In the program Fill the Add statements.pdf
Java Question help needed In the program Fill the Add statements.pdf
kamdinrossihoungma74
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
Dmitry Sheiko
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
kinan keshkeh
 
This is Function Class public abstract class Function {    .pdf
This is Function Class public abstract class Function {    .pdfThis is Function Class public abstract class Function {    .pdf
This is Function Class public abstract class Function {    .pdf
amitbagga0808
 
Pointer Events in Canvas
Pointer Events in CanvasPointer Events in Canvas
Pointer Events in Canvasdeanhudson
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring CanvasKevin Hoyt
 
Cppt 101102014428-phpapp01
Cppt 101102014428-phpapp01Cppt 101102014428-phpapp01
Cppt 101102014428-phpapp01Getachew Ganfur
 
Advance features of C++
Advance features of C++Advance features of C++
Advance features of C++vidyamittal
 
ES6 is Nigh
ES6 is NighES6 is Nigh
ES6 is Nigh
Domenic Denicola
 
662305 10
662305 10662305 10
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
Uma mohan
 
Internal workshop es6_2015
Internal workshop es6_2015Internal workshop es6_2015
Internal workshop es6_2015
Miguel Ruiz Rodriguez
 

Similar to need help with code I wrote. This code is a maze gui, and i need hel.pdf (20)

Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for Speed
 
program logbook 2
program logbook 2program logbook 2
program logbook 2
 
Polygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdfPolygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdf
 
Polygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdfPolygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdf
 
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfModify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
 
Mobile Game and Application with J2ME - Collision Detection
Mobile Gameand Application withJ2ME  - Collision DetectionMobile Gameand Application withJ2ME  - Collision Detection
Mobile Game and Application with J2ME - Collision Detection
 
Mobile Game and Application with J2ME
Mobile Gameand Application with J2MEMobile Gameand Application with J2ME
Mobile Game and Application with J2ME
 
ES6(ES2015) is beautiful
ES6(ES2015) is beautifulES6(ES2015) is beautiful
ES6(ES2015) is beautiful
 
Java Question help needed In the program Fill the Add statements.pdf
Java Question  help needed In the program Fill the Add statements.pdfJava Question  help needed In the program Fill the Add statements.pdf
Java Question help needed In the program Fill the Add statements.pdf
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
 
This is Function Class public abstract class Function {    .pdf
This is Function Class public abstract class Function {    .pdfThis is Function Class public abstract class Function {    .pdf
This is Function Class public abstract class Function {    .pdf
 
Pointer Events in Canvas
Pointer Events in CanvasPointer Events in Canvas
Pointer Events in Canvas
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
 
Cppt 101102014428-phpapp01
Cppt 101102014428-phpapp01Cppt 101102014428-phpapp01
Cppt 101102014428-phpapp01
 
Advance features of C++
Advance features of C++Advance features of C++
Advance features of C++
 
ES6 is Nigh
ES6 is NighES6 is Nigh
ES6 is Nigh
 
662305 10
662305 10662305 10
662305 10
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Internal workshop es6_2015
Internal workshop es6_2015Internal workshop es6_2015
Internal workshop es6_2015
 

More from arcotstarsports

You are presented with a patient, named Gerry, who has Down syndrome .pdf
You are presented with a patient, named Gerry, who has Down syndrome .pdfYou are presented with a patient, named Gerry, who has Down syndrome .pdf
You are presented with a patient, named Gerry, who has Down syndrome .pdf
arcotstarsports
 
Write a template function to fill in a STL list with a given array..pdf
Write a template function to fill in a STL list with a given array..pdfWrite a template function to fill in a STL list with a given array..pdf
Write a template function to fill in a STL list with a given array..pdf
arcotstarsports
 
write a method to generate AVL tree of height h wth fewest nodes and.pdf
write a method to generate AVL tree of height h wth fewest nodes and.pdfwrite a method to generate AVL tree of height h wth fewest nodes and.pdf
write a method to generate AVL tree of height h wth fewest nodes and.pdf
arcotstarsports
 
Which of the following is NOT correctWhich of the following is NO.pdf
Which of the following is NOT correctWhich of the following is NO.pdfWhich of the following is NOT correctWhich of the following is NO.pdf
Which of the following is NOT correctWhich of the following is NO.pdf
arcotstarsports
 
What is Mills response to the problem posed by some peoples desi.pdf
What is Mills response to the problem posed by some peoples desi.pdfWhat is Mills response to the problem posed by some peoples desi.pdf
What is Mills response to the problem posed by some peoples desi.pdf
arcotstarsports
 
What is a bivariate distributionSolutionBivariate distributio.pdf
What is a bivariate distributionSolutionBivariate distributio.pdfWhat is a bivariate distributionSolutionBivariate distributio.pdf
What is a bivariate distributionSolutionBivariate distributio.pdf
arcotstarsports
 
What are some of the tools you can use to tune or correct a Linux fi.pdf
What are some of the tools you can use to tune or correct a Linux fi.pdfWhat are some of the tools you can use to tune or correct a Linux fi.pdf
What are some of the tools you can use to tune or correct a Linux fi.pdf
arcotstarsports
 
TrueFalse Insulin spikes in the postabsorptive state.Solution.pdf
TrueFalse Insulin spikes in the postabsorptive state.Solution.pdfTrueFalse Insulin spikes in the postabsorptive state.Solution.pdf
TrueFalse Insulin spikes in the postabsorptive state.Solution.pdf
arcotstarsports
 
The principal role of ATP In the cell is A) serving as structural s.pdf
The principal role of ATP In the cell is  A) serving as structural s.pdfThe principal role of ATP In the cell is  A) serving as structural s.pdf
The principal role of ATP In the cell is A) serving as structural s.pdf
arcotstarsports
 
The neutral theory of evolution proposed that most genetic mutations .pdf
The neutral theory of evolution proposed that most genetic mutations .pdfThe neutral theory of evolution proposed that most genetic mutations .pdf
The neutral theory of evolution proposed that most genetic mutations .pdf
arcotstarsports
 
The oldest living organisms on Earth are plants. Some bristlecone pi.pdf
The oldest living organisms on Earth are plants. Some bristlecone pi.pdfThe oldest living organisms on Earth are plants. Some bristlecone pi.pdf
The oldest living organisms on Earth are plants. Some bristlecone pi.pdf
arcotstarsports
 
Suppose there is a person whose total lung capacity (TLC) is 4.90 L, .pdf
Suppose there is a person whose total lung capacity (TLC) is 4.90 L, .pdfSuppose there is a person whose total lung capacity (TLC) is 4.90 L, .pdf
Suppose there is a person whose total lung capacity (TLC) is 4.90 L, .pdf
arcotstarsports
 
Research the IPv4 ns the IPv6 protocols, then prepare a report that .pdf
Research the IPv4 ns the IPv6 protocols, then prepare a report that .pdfResearch the IPv4 ns the IPv6 protocols, then prepare a report that .pdf
Research the IPv4 ns the IPv6 protocols, then prepare a report that .pdf
arcotstarsports
 
Species I Species II Species III Species IV Ancestral sequence IV Sit.pdf
Species I Species II Species III Species IV Ancestral sequence IV Sit.pdfSpecies I Species II Species III Species IV Ancestral sequence IV Sit.pdf
Species I Species II Species III Species IV Ancestral sequence IV Sit.pdf
arcotstarsports
 
Solve the differential equation y+y=sin(x). Im thinking I ne.pdf
Solve the differential equation y+y=sin(x). Im thinking I ne.pdfSolve the differential equation y+y=sin(x). Im thinking I ne.pdf
Solve the differential equation y+y=sin(x). Im thinking I ne.pdf
arcotstarsports
 
Please write a non-recursive procedure to print all nodes for a bina.pdf
Please write a non-recursive procedure to print all nodes for a bina.pdfPlease write a non-recursive procedure to print all nodes for a bina.pdf
Please write a non-recursive procedure to print all nodes for a bina.pdf
arcotstarsports
 
Please do C, D, and E For the given f Z right arrow Z, decide wheth.pdf
Please do C, D, and E For the given f Z right arrow Z, decide wheth.pdfPlease do C, D, and E For the given f Z right arrow Z, decide wheth.pdf
Please do C, D, and E For the given f Z right arrow Z, decide wheth.pdf
arcotstarsports
 
Microbiology question Which of the following is the most unique a.pdf
Microbiology question Which of the following is the most unique a.pdfMicrobiology question Which of the following is the most unique a.pdf
Microbiology question Which of the following is the most unique a.pdf
arcotstarsports
 
Is Event B dependent or independent of Event A A green ball is draw.pdf
Is Event B dependent or independent of Event A A green ball is draw.pdfIs Event B dependent or independent of Event A A green ball is draw.pdf
Is Event B dependent or independent of Event A A green ball is draw.pdf
arcotstarsports
 
In this view, the front of the heart has been reflected upwards. Ide.pdf
In this view, the front of the heart has been reflected upwards. Ide.pdfIn this view, the front of the heart has been reflected upwards. Ide.pdf
In this view, the front of the heart has been reflected upwards. Ide.pdf
arcotstarsports
 

More from arcotstarsports (20)

You are presented with a patient, named Gerry, who has Down syndrome .pdf
You are presented with a patient, named Gerry, who has Down syndrome .pdfYou are presented with a patient, named Gerry, who has Down syndrome .pdf
You are presented with a patient, named Gerry, who has Down syndrome .pdf
 
Write a template function to fill in a STL list with a given array..pdf
Write a template function to fill in a STL list with a given array..pdfWrite a template function to fill in a STL list with a given array..pdf
Write a template function to fill in a STL list with a given array..pdf
 
write a method to generate AVL tree of height h wth fewest nodes and.pdf
write a method to generate AVL tree of height h wth fewest nodes and.pdfwrite a method to generate AVL tree of height h wth fewest nodes and.pdf
write a method to generate AVL tree of height h wth fewest nodes and.pdf
 
Which of the following is NOT correctWhich of the following is NO.pdf
Which of the following is NOT correctWhich of the following is NO.pdfWhich of the following is NOT correctWhich of the following is NO.pdf
Which of the following is NOT correctWhich of the following is NO.pdf
 
What is Mills response to the problem posed by some peoples desi.pdf
What is Mills response to the problem posed by some peoples desi.pdfWhat is Mills response to the problem posed by some peoples desi.pdf
What is Mills response to the problem posed by some peoples desi.pdf
 
What is a bivariate distributionSolutionBivariate distributio.pdf
What is a bivariate distributionSolutionBivariate distributio.pdfWhat is a bivariate distributionSolutionBivariate distributio.pdf
What is a bivariate distributionSolutionBivariate distributio.pdf
 
What are some of the tools you can use to tune or correct a Linux fi.pdf
What are some of the tools you can use to tune or correct a Linux fi.pdfWhat are some of the tools you can use to tune or correct a Linux fi.pdf
What are some of the tools you can use to tune or correct a Linux fi.pdf
 
TrueFalse Insulin spikes in the postabsorptive state.Solution.pdf
TrueFalse Insulin spikes in the postabsorptive state.Solution.pdfTrueFalse Insulin spikes in the postabsorptive state.Solution.pdf
TrueFalse Insulin spikes in the postabsorptive state.Solution.pdf
 
The principal role of ATP In the cell is A) serving as structural s.pdf
The principal role of ATP In the cell is  A) serving as structural s.pdfThe principal role of ATP In the cell is  A) serving as structural s.pdf
The principal role of ATP In the cell is A) serving as structural s.pdf
 
The neutral theory of evolution proposed that most genetic mutations .pdf
The neutral theory of evolution proposed that most genetic mutations .pdfThe neutral theory of evolution proposed that most genetic mutations .pdf
The neutral theory of evolution proposed that most genetic mutations .pdf
 
The oldest living organisms on Earth are plants. Some bristlecone pi.pdf
The oldest living organisms on Earth are plants. Some bristlecone pi.pdfThe oldest living organisms on Earth are plants. Some bristlecone pi.pdf
The oldest living organisms on Earth are plants. Some bristlecone pi.pdf
 
Suppose there is a person whose total lung capacity (TLC) is 4.90 L, .pdf
Suppose there is a person whose total lung capacity (TLC) is 4.90 L, .pdfSuppose there is a person whose total lung capacity (TLC) is 4.90 L, .pdf
Suppose there is a person whose total lung capacity (TLC) is 4.90 L, .pdf
 
Research the IPv4 ns the IPv6 protocols, then prepare a report that .pdf
Research the IPv4 ns the IPv6 protocols, then prepare a report that .pdfResearch the IPv4 ns the IPv6 protocols, then prepare a report that .pdf
Research the IPv4 ns the IPv6 protocols, then prepare a report that .pdf
 
Species I Species II Species III Species IV Ancestral sequence IV Sit.pdf
Species I Species II Species III Species IV Ancestral sequence IV Sit.pdfSpecies I Species II Species III Species IV Ancestral sequence IV Sit.pdf
Species I Species II Species III Species IV Ancestral sequence IV Sit.pdf
 
Solve the differential equation y+y=sin(x). Im thinking I ne.pdf
Solve the differential equation y+y=sin(x). Im thinking I ne.pdfSolve the differential equation y+y=sin(x). Im thinking I ne.pdf
Solve the differential equation y+y=sin(x). Im thinking I ne.pdf
 
Please write a non-recursive procedure to print all nodes for a bina.pdf
Please write a non-recursive procedure to print all nodes for a bina.pdfPlease write a non-recursive procedure to print all nodes for a bina.pdf
Please write a non-recursive procedure to print all nodes for a bina.pdf
 
Please do C, D, and E For the given f Z right arrow Z, decide wheth.pdf
Please do C, D, and E For the given f Z right arrow Z, decide wheth.pdfPlease do C, D, and E For the given f Z right arrow Z, decide wheth.pdf
Please do C, D, and E For the given f Z right arrow Z, decide wheth.pdf
 
Microbiology question Which of the following is the most unique a.pdf
Microbiology question Which of the following is the most unique a.pdfMicrobiology question Which of the following is the most unique a.pdf
Microbiology question Which of the following is the most unique a.pdf
 
Is Event B dependent or independent of Event A A green ball is draw.pdf
Is Event B dependent or independent of Event A A green ball is draw.pdfIs Event B dependent or independent of Event A A green ball is draw.pdf
Is Event B dependent or independent of Event A A green ball is draw.pdf
 
In this view, the front of the heart has been reflected upwards. Ide.pdf
In this view, the front of the heart has been reflected upwards. Ide.pdfIn this view, the front of the heart has been reflected upwards. Ide.pdf
In this view, the front of the heart has been reflected upwards. Ide.pdf
 

Recently uploaded

"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 

Recently uploaded (20)

"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 

need help with code I wrote. This code is a maze gui, and i need hel.pdf

  • 1. need help with code I wrote. This code is a maze gui, and i need help with the method shorterstpath(); here is my code: ******mazeApp******* package mazepackage; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.control.TextInputDialog; import javafx.scene.paint.Color; import javafx.stage.Stage; public class MazeApp extends Application { // default canvas size is DEFAULT_SIZE-by-DEFAULT_SIZE private static final int DEFAULT_SIZE = 768; private int width = DEFAULT_SIZE; private int height = DEFAULT_SIZE; // The graphics context is needed to enable drawing on the canvas private GraphicsContext gc; // boundary of drawing canvas, 0% border // private static final double BORDER = 0.05; private static final double BORDER = 0.00; private double xmin, ymin, xmax, ymax; public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { Group root = new Group(); Canvas canvas = new Canvas(width, height); gc = canvas.getGraphicsContext2D();
  • 2. gc.setLineWidth(2); gc.setFill(Color.WHITE); gc.fillRect(0, 0, width, height); root.getChildren().add(canvas); TextInputDialog tid = new TextInputDialog(); tid.setTitle("Maze Size"); tid.setHeaderText("Enter maze size between 10 and 50"); tid.showAndWait(); int size = Integer.parseInt(tid.getResult()); if (size > 50) size = 50; if (size < 10) size = 10; primaryStage.setTitle("Maze Application"); primaryStage.setScene(new Scene(root)); primaryStage.setResizable(false); // Make sure that the application goes away when then window is closed primaryStage.setOnCloseRequest(e -> System.exit(0)); primaryStage.show(); Maze maze = new Maze(this, size); // Must solve the maze in a separate thread or else // the GUI wont update until the end..... Thread solver = new Thread( new Runnable () { public void run() { while(true) { maze.buildAndDrawMaze(); maze.findShortestPath(); try { Thread.sleep(5000);
  • 3. } catch(Exception e) { } gc.setFill(Color.WHITE); gc.fillRect(0, 0, width, height); } } }); solver.start(); } /** * Sets the pen color to the specified color. * * @param color the color to make the pen */ public void setPenColor(Color color) { gc.setStroke(color); } /** * Sets the pen color to the specified color. * * @param color the color to make the pen */ public void setFillColor(Color color) { gc.setFill(color); } /** * Sets the x-scale to the specified range. * * @param min the minimum value of the x-scale * @param max the maximum value of the x-scale * @throws IllegalArgumentException if {@code (max == min)} */ public void setXscale(double min, double max) { double size = max - min; if (size == 0.0) {
  • 4. throw new IllegalArgumentException("the min and max are the same"); } xmin = min - BORDER * size; xmax = max + BORDER * size; } /** * Sets the y-scale to the specified range. * * @param min the minimum value of the y-scale * @param max the maximum value of the y-scale * @throws IllegalArgumentException if {@code (max == min)} */ public void setYscale(double min, double max) { double size = max - min; if (size == 0.0) { throw new IllegalArgumentException("the min and max are the same"); } ymin = min - BORDER * size; ymax = max + BORDER * size; } // helper functions that scale from user coordinates to screen coordinates and back private double scaleX(double x) { return width * (x - xmin) / (xmax - xmin); } private double scaleY(double y) { return height * (ymax - y) / (ymax - ymin); } private double factorX(double w) { return w * width / Math.abs(xmax - xmin); } private double factorY(double h) { return h * height / Math.abs(ymax - ymin); } private double userX(double x) { return xmin + x * (xmax - xmin) / width; }
  • 5. private double userY(double y) { return ymax - y * (ymax - ymin) / height; } /** * Draws a line segment between (x0, * y0) and (x1, * y1). * * @param x0 the x-coordinate of one endpoint * @param y0 the y-coordinate of one endpoint * @param x1 the x-coordinate of the other endpoint * @param y1 the y-coordinate of the other endpoint */ public void line(double x0, double y0, double x1, double y1) { gc.strokeLine(scaleX(x0), scaleY(y0), scaleX(x1), scaleY(y1)); } /** * Draws one pixel at (x, y). This method is private * because pixels depend on the display. To achieve the same effect, set the * pen radius to 0 and call {@code point()}. * * @param x the x-coordinate of the pixel * @param y the y-coordinate of the pixel */ private void pixel(double x, double y) { gc.fillRect((int) Math.round(scaleX(x)), (int) Math.round(scaleY(y)), 1, 1); } /** * Draws a filled circle of the specified radius, centered at (x, * y). * * @param x the x-coordinate of the center of the circle * @param y the y-coordinate of the center of the circle * @param radius the radius of the circle * @throws IllegalArgumentException if {@code radius} is negative */
  • 6. public void filledCircle(double x, double y, double radius) { double xs = scaleX(x); double ys = scaleY(y); double ws = factorX(2 * radius); double hs = factorY(2 * radius); if (ws <= 1 && hs <= 1) { pixel(x, y); } else { gc.fillOval(xs - ws / 2, ys - hs / 2, ws, hs); } } } ***********maze.java************** package mazepackage; import java.util.LinkedList; import java.util.Random; import javafx.scene.paint.Color; public class Maze { private int N; // dimension of maze private MazeCell[][] maze; private Random rand = new Random(); // Used to signal the maze has been solved private boolean done; // time in milliseconds (from currentTimeMillis()) when we can draw again // used to control the frame rate private long nextDraw = -1; private MazeApp mf; // Define constants for the circle size private final double BIG = 0.375; private final double SMALL = 0.25; // Define constants for the delay times private final int SHORT = 30; private final int LONG = 500; public Maze(MazeApp ma, int n) { N = n; mf = ma;
  • 7. mf.setXscale(0, N + 2); mf.setYscale(0, N + 2); } public void buildAndDrawMaze() { createMaze(); buildMaze(); drawMaze(); } // create the initial data structures that contain the maze data private void createMaze() { maze = new MazeCell[N + 2][N + 2]; for (int i = 0; i < N + 2; i++) { for (int j = 0; j < N + 2; j++) { maze[i][j] = new MazeCell(i, j); } } // initialize border cells as already visited for (int x = 0; x < N + 2; x++) { maze[x][0].visited = true; maze[x][N + 1].visited = true; } for (int y = 0; y < N + 2; y++) { maze[0][y].visited = true; maze[N + 1][y].visited = true; } } // build the maze private void buildMaze(int x, int y) { maze[x][y].visited = true; // while there is an unvisited neighbor while (!maze[x][y + 1].visited || !maze[x + 1][y].visited || !maze[x][y - 1].visited || !maze[x - 1][y].visited) { // pick random neighbor (could use Knuth's trick instead) while (true) { int r = rand.nextInt(4); if (r == 0 && !maze[x][y + 1].visited) {
  • 8. maze[x][y].nth = false; maze[x][y + 1].sth = false; buildMaze(x, y + 1); break; } else if (r == 1 && !maze[x + 1][y].visited) { maze[x][y].est = false; maze[x + 1][y].wst = false; buildMaze(x + 1, y); break; } else if (r == 2 && !maze[x][y - 1].visited) { maze[x][y].sth = false; maze[x][y - 1].nth = false; buildMaze(x, y - 1); break; } else if (r == 3 && !maze[x - 1][y].visited) { maze[x][y].wst = false; maze[x - 1][y].est = false; buildMaze(x - 1, y); break; } } } } // build the maze starting from lower left private void buildMaze() { buildMaze(1, 1); // Make sure visited is reset to false for (int x = 1; x < N + 1; x++) { for (int y = 1; y < N + 1; y++) { maze[x][y].visited = false; } } // delete some random walls for (int i = 0; i < N; i++) { int x = 1 + rand.nextInt(N - 1); int y = 1 + rand.nextInt(N - 1);
  • 9. maze[x][y].nth = maze[x][y + 1].sth = false; } } // draw the initial maze private void drawMaze() { drawCircle(Color.RED, N / 2, N / 2, BIG); drawCircle(Color.RED, 1, 1, BIG); // Draw the walls in black mf.setPenColor(Color.BLACK); for (int x = 1; x <= N; x++) { for (int y = 1; y <= N; y++) { if (maze[x][y].sth) { mf.line(x, y, x + 1, y); } if (maze[x][y].nth) { mf.line(x, y + 1, x + 1, y + 1); } if (maze[x][y].wst) { mf.line(x, y, x, y + 1); } if (maze[x][y].est) { mf.line(x + 1, y, x + 1, y + 1); } } } delay(LONG); } private void delay(int t) { // sleep until the next time we're allowed to draw long millis = System.currentTimeMillis(); if (millis < nextDraw) { try { Thread.sleep(nextDraw - millis); } catch (InterruptedException e) { System.out.println("Error sleeping"); }
  • 10. millis = nextDraw; } // when are we allowed to draw again nextDraw = millis + t; } private void drawCircle(Color c, double x, double y, double size) { mf.setFillColor(c); mf.filledCircle(x + 0.5, y + 0.5, size); } public void findShortestPath() { // Your code goes here!!!!! } } class MazeCell { // nth, sth, est, wst used to identify walls - true indicates wall present boolean nth, sth, wst, est; // used to indicate that a cell has already been processed boolean visited; // used to facilitate finding the neighbors of a cell int row, col; public MazeCell(int i, int j) { row = i; col = j; // All walls are initially present for every cell nth = sth = est = wst = true; // Initially no cells have been visited visited = false; } } class MazeMap { MazeCell nFromCenter = null; MazeMap nMinus1FromCenter = null; } ***end of code*** here is the stradgey that Im supposed to follow:
  • 11. Strategy: Implement the findShortestPath() method in the given code to find the shortest solution in the maze. Strategy will be using breadth first search starting from the end point of the maze looking for the entrance. Create two linked list of MazeMap objects LinkedList Create MazeMap for center and add to first list(Center MazeCell is maze[N/2][N/2], entrance is maze[1][1]) Iterate through first list and add MazeMap distance n+1 to second list. Set first list equal to second list, clear second list and repeat. MazeCell: In the GUI representation, rows of the maze are vertical, columns are horizontal. Cell 0,0 of the maze in drawn in the lower left corner. The following summarizes what to do to move in a specific direction from any cell in the maze. Remember, each cell contains its own row, col position. North neighbor is at row, col + 1 South neighbor is at row, col – 1 East neighbor is at row + 1, col West neighbor is at row – 1, col Solution import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.control.TextInputDialog; import javafx.scene.paint.Color; import javafx.stage.Stage; public class MazeApp extends Application { // default canvas size is DEFAULT_SIZE-by-DEFAULT_SIZE private static final int DEFAULT_SIZE = 768;
  • 12. private int width = DEFAULT_SIZE; private int height = DEFAULT_SIZE; // The graphics context is needed to enable drawing on the canvas private GraphicsContext gc; // boundary of drawing canvas, 0% border // private static final double BORDER = 0.05; private static final double BORDER = 0.00; private double xmin, ymin, xmax, ymax; public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { Group root = new Group(); Canvas canvas = new Canvas(width, height); gc = canvas.getGraphicsContext2D(); gc.setLineWidth(2); gc.setFill(Color.WHITE); gc.fillRect(0, 0, width, height); root.getChildren().add(canvas); TextInputDialog tid = new TextInputDialog(); tid.setTitle("Maze Size"); tid.setHeaderText("Enter maze size between 10 and 50"); tid.showAndWait(); int size = Integer.parseInt(tid.getResult()); if (size > 50) size = 50; if (size < 10) size = 10; primaryStage.setTitle("Maze Application"); primaryStage.setScene(new Scene(root)); primaryStage.setResizable(false);
  • 13. // Make sure that the application goes away when then window is closed primaryStage.setOnCloseRequest(e -> System.exit(0)); primaryStage.show(); Maze maze = new Maze(this, size); // Must solve the maze in a separate thread or else // the GUI wont update until the end..... Thread solver = new Thread( new Runnable () { public void run() { while(true) { maze.buildAndDrawMaze(); maze.findShortestPath(); try { Thread.sleep(5000); } catch(Exception e) { } gc.setFill(Color.WHITE); gc.fillRect(0, 0, width, height); } } }); solver.start(); } /** * Sets the pen color to the specified color. * * @param color the color to make the pen */ public void setPenColor(Color color) { gc.setStroke(color); }
  • 14. /** * Sets the pen color to the specified color. * * @param color the color to make the pen */ public void setFillColor(Color color) { gc.setFill(color); } /** * Sets the x-scale to the specified range. * * @param min the minimum value of the x-scale * @param max the maximum value of the x-scale * @throws IllegalArgumentException if {@code (max == min)} */ public void setXscale(double min, double max) { double size = max - min; if (size == 0.0) { throw new IllegalArgumentException("the min and max are the same"); } xmin = min - BORDER * size; xmax = max + BORDER * size; } /** * Sets the y-scale to the specified range. * * @param min the minimum value of the y-scale * @param max the maximum value of the y-scale * @throws IllegalArgumentException if {@code (max == min)} */ public void setYscale(double min, double max) { double size = max - min; if (size == 0.0) { throw new IllegalArgumentException("the min and max are the same"); } ymin = min - BORDER * size;
  • 15. ymax = max + BORDER * size; } // helper functions that scale from user coordinates to screen coordinates and back private double scaleX(double x) { return width * (x - xmin) / (xmax - xmin); } private double scaleY(double y) { return height * (ymax - y) / (ymax - ymin); } private double factorX(double w) { return w * width / Math.abs(xmax - xmin); } private double factorY(double h) { return h * height / Math.abs(ymax - ymin); } private double userX(double x) { return xmin + x * (xmax - xmin) / width; } private double userY(double y) { return ymax - y * (ymax - ymin) / height; } /** * Draws a line segment between (x0, * y0) and (x1, * y1). * * @param x0 the x-coordinate of one endpoint * @param y0 the y-coordinate of one endpoint * @param x1 the x-coordinate of the other endpoint * @param y1 the y-coordinate of the other endpoint */ public void line(double x0, double y0, double x1, double y1) { gc.strokeLine(scaleX(x0), scaleY(y0), scaleX(x1), scaleY(y1)); } /** * Draws one pixel at (x, y). This method is private
  • 16. * because pixels depend on the display. To achieve the same effect, set the * pen radius to 0 and call {@code point()}. * * @param x the x-coordinate of the pixel * @param y the y-coordinate of the pixel */ private void pixel(double x, double y) { gc.fillRect((int) Math.round(scaleX(x)), (int) Math.round(scaleY(y)), 1, 1); } /** * Draws a filled circle of the specified radius, centered at (x, * y). * * @param x the x-coordinate of the center of the circle * @param y the y-coordinate of the center of the circle * @param radius the radius of the circle * @throws IllegalArgumentException if {@code radius} is negative */ public void filledCircle(double x, double y, double radius) { double xs = scaleX(x); double ys = scaleY(y); double ws = factorX(2 * radius); double hs = factorY(2 * radius); if (ws <= 1 && hs <= 1) { pixel(x, y); } else { gc.fillOval(xs - ws / 2, ys - hs / 2, ws, hs); } } } ***********maze.java************** package mazepackage; import java.util.LinkedList; import java.util.Random; import javafx.scene.paint.Color; public class Maze {
  • 17. private int N; // dimension of maze private MazeCell[][] maze; private Random rand = new Random(); // Used to signal the maze has been solved private boolean done; // time in milliseconds (from currentTimeMillis()) when we can draw again // used to control the frame rate private long nextDraw = -1; private MazeApp mf; // Define constants for the circle size private final double BIG = 0.375; private final double SMALL = 0.25; // Define constants for the delay times private final int SHORT = 30; private final int LONG = 500; public Maze(MazeApp ma, int n) { N = n; mf = ma; mf.setXscale(0, N + 2); mf.setYscale(0, N + 2); } public void buildAndDrawMaze() { createMaze(); buildMaze(); drawMaze(); } // create the initial data structures that contain the maze data private void createMaze() { maze = new MazeCell[N + 2][N + 2]; for (int i = 0; i < N + 2; i++) { for (int j = 0; j < N + 2; j++) { maze[i][j] = new MazeCell(i, j); } } // initialize border cells as already visited for (int x = 0; x < N + 2; x++) {
  • 18. maze[x][0].visited = true; maze[x][N + 1].visited = true; } for (int y = 0; y < N + 2; y++) { maze[0][y].visited = true; maze[N + 1][y].visited = true; } } // build the maze private void buildMaze(int x, int y) { maze[x][y].visited = true; // while there is an unvisited neighbor while (!maze[x][y + 1].visited || !maze[x + 1][y].visited || !maze[x][y - 1].visited || !maze[x - 1][y].visited) { // pick random neighbor (could use Knuth's trick instead) while (true) { int r = rand.nextInt(4); if (r == 0 && !maze[x][y + 1].visited) { maze[x][y].nth = false; maze[x][y + 1].sth = false; buildMaze(x, y + 1); break; } else if (r == 1 && !maze[x + 1][y].visited) { maze[x][y].est = false; maze[x + 1][y].wst = false; buildMaze(x + 1, y); break; } else if (r == 2 && !maze[x][y - 1].visited) { maze[x][y].sth = false; maze[x][y - 1].nth = false; buildMaze(x, y - 1); break; } else if (r == 3 && !maze[x - 1][y].visited) { maze[x][y].wst = false; maze[x - 1][y].est = false; buildMaze(x - 1, y);
  • 19. break; } } } } // build the maze starting from lower left private void buildMaze() { buildMaze(1, 1); // Make sure visited is reset to false for (int x = 1; x < N + 1; x++) { for (int y = 1; y < N + 1; y++) { maze[x][y].visited = false; } } // delete some random walls for (int i = 0; i < N; i++) { int x = 1 + rand.nextInt(N - 1); int y = 1 + rand.nextInt(N - 1); maze[x][y].nth = maze[x][y + 1].sth = false; } } // draw the initial maze private void drawMaze() { drawCircle(Color.RED, N / 2, N / 2, BIG); drawCircle(Color.RED, 1, 1, BIG); // Draw the walls in black mf.setPenColor(Color.BLACK); for (int x = 1; x <= N; x++) { for (int y = 1; y <= N; y++) { if (maze[x][y].sth) { mf.line(x, y, x + 1, y); } if (maze[x][y].nth) { mf.line(x, y + 1, x + 1, y + 1); } if (maze[x][y].wst) {
  • 20. mf.line(x, y, x, y + 1); } if (maze[x][y].est) { mf.line(x + 1, y, x + 1, y + 1); } } } delay(LONG); } private void delay(int t) { // sleep until the next time we're allowed to draw long millis = System.currentTimeMillis(); if (millis < nextDraw) { try { Thread.sleep(nextDraw - millis); } catch (InterruptedException e) { System.out.println("Error sleeping"); } millis = nextDraw; } // when are we allowed to draw again nextDraw = millis + t; } private void drawCircle(Color c, double x, double y, double size) { mf.setFillColor(c); mf.filledCircle(x + 0.5, y + 0.5, size); } public void findShortestPath() { // Your code goes here!!!!! } } class MazeCell { // nth, sth, est, wst used to identify walls - true indicates wall present boolean nth, sth, wst, est; // used to indicate that a cell has already been processed
  • 21. boolean visited; // used to facilitate finding the neighbors of a cell int row, col; public MazeCell(int i, int j) { row = i; col = j; // All walls are initially present for every cell nth = sth = est = wst = true; // Initially no cells have been visited visited = false; } } class MazeMap { MazeCell nFromCenter = null; MazeMap nMinus1FromCenter = null; }