maze


Creating a maze using matrixes (JAVA)

有些话、适合烂在心里 提交于 2020-01-24 21:49:25
问题 So i'm trying to make a Single maze (No generators) In Java, and I've hit a roadblock. the current code i have will make a maze, and make a jframe, but it won't color it... is there a way to make the coloring work?? import java.awt.*; import javax.swing.*; import java.lang.*; public class ayy{ public static void main(String [] args){ JFrame frame = new JFrame("Maze"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setSize(1000,1000); frame.setVisible(true); int

List.append() changing all elements to the appended item [duplicate]

徘徊边缘 提交于 2020-01-19 12:43:50
问题 This question already has answers here : Why does foo.append(bar) affect all elements in a list of lists? [duplicate] (3 answers) Closed 2 years ago . I seem to have a problem with my maze generating program made in Python. I'm trying to randomly create a path that branches out at select points, with the points getting stored as it goes along. When the maze gets to a dead end, it will sort back through the visited points by testing the top value than popping that and going to the next one,

How to make a robot navigate a maze?

青春壹個敷衍的年華 提交于 2020-01-15 08:29:25
问题 I'm using the Myro library with the Python language. I've had some weird results. My idea was to call the getObstacle sensors. left = getObstacle(0) center = getObstacle(1) right = getObstacle(2) I want the robot to move forward as long as the center obstacle sensor is less than or equal to 4500. If the right obstacle sensor on the robot has a higher reading than the left obstacle sensor, I want it to turn left. Otherwise turn right. Here are my attempts on youtube Attempt 1 Attempt 2 I'm

JAVA text based maze game

妖精的绣舞 提交于 2020-01-05 08:27:55
问题 X signifies the starting point and E is the Exit. The problem is I cannot make my X move. Can someone help me with this. We are only allowed to used the main class and main method, no any other than that. Every time the user input, the maze map will display showing the current position of the player. When the user choose to face left or right, the current position should not change. import java.util.*; public class g7 { public static void main(String []args) throws Exception { String[][] M =

Simple Java 2d array maze sample

帅比萌擦擦* 提交于 2020-01-01 00:21:09
问题 I am working or understanding how to create a simple java 2d maze that should look like this: int [][] maze = { {1,1,1,1,1,1,1,1,1,1,1,1,1}, {1,0,1,0,1,0,1,0,0,0,0,0,1}, {1,0,1,0,0,0,1,0,1,1,1,0,1}, {1,0,0,0,1,1,1,0,0,0,0,0,1}, {1,0,1,0,0,0,0,0,1,1,1,0,1}, {1,0,1,0,1,1,1,0,1,0,0,0,1}, {1,0,1,0,1,0,0,0,1,1,1,0,1}, {1,0,1,0,1,1,1,0,1,0,1,0,1}, {1,0,0,0,0,0,0,0,0,0,1,0,1}, {1,1,1,1,1,1,1,1,1,1,1,1,1} }; Ones this has been created the idea is to set a starting point and goal point and by using

Implementing a randomly generated maze using Prim's Algorithm

时间秒杀一切 提交于 2019-12-31 22:39:12
问题 I am trying to implement a randomly generated maze using Prim's algorithm. I want my maze to look like this: however the mazes that I am generating from my program look like this: I'm currently stuck on correctly implementing the steps highlighted in bold: Start with a grid full of walls. Pick a cell, mark it as part of the maze. Add the walls of the cell to the wall list. While there are walls in the list: **1. Pick a random wall from the list. If the cell on the opposite side isn't in the

Algorithm to generate a segment maze

独自空忆成欢 提交于 2019-12-30 02:20:05
问题 I want to generate a maze that looks like this: That is, it consists of paths in one direction that are then connected. I have looked for an algorithm to generate mazes like this without success. Specifically, I don't want a maze like this: because it doesn't "run" in only one direction. Also, it would be nice if the solution of this maze required the player to "backtrack" -- i.e. not just move upwards all the time. 回答1: create a random path between point A and B randomly add walls as long as

Java: Trouble randomizing a DFS run to build a maze

こ雲淡風輕ζ 提交于 2019-12-25 01:36:40
问题 I'm having trouble randomizing the visit from a node to its neighbors, rarely is the whole graph (a MxN array, in this test 4x4) visited, I don't get what I'm doing wrong here. import java.util.ArrayList; class IJ { int i; int j; IJ (int i,int j){ i = this.i; j= this.j; } } class Graph { int M; int N; int adjacencyMatrix[][]; ArrayList <IJ> orderOfVisits; Graph(int M,int N){ this.M=M; this.N=N; adjacencyMatrix=new int[M][N]; for (int i=0; i<M; i++) for (int j=0;j<N;j++){ adjacencyMatrix[i][j]

Create an alternative form of questionnaire

本小妞迷上赌 提交于 2019-12-25 00:56:12
问题 I'm very new to programming in python so I'd appreciate any tips or hints as to where I can look: So what I basically planned on creating is a new form of questionnaire, where the respondent can express approval or disapproval to a question by dragging it from the center of the window into any part of a colored ring that surrounds the question, using the mouse. The ring is supposed to have two color gradients from green to red, and I want to be able to make my program (pygame?) track the

How to do collision detection with many walls (maze)?

ぃ、小莉子 提交于 2019-12-24 18:13:14
问题 In my game, the player navigates a maze. I can't figure out how to do proper collision detection with the walls. It is easy to do collision detection for staying in a certain area: if (x > rightWallX - playerWidth) x = rightWallX - playerWidth; if (x < leftWallX) x = leftWallX; //... But how would I do collision detection for many walls? I can do plain collision detection without correction (like if (intersecting) return true; ), but I can't correct this correctly. If I just store the old x

工具导航Map