Recursive Division Random Maze Generation [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm currently doing a project where I want to randomly generate mazes for a game. After studying performance levels etc for maze generation I've decided to use the Recursive Division method. Whilst the explanation of the algorithm is somewhat understandable I'm struggling to formulate the algorithm in a pseudo format so that I can understand it fully and begin coding it. Can someone help me with a detailed explanation of the process or some pseudo-code? All help is greatly appreciated.
EDIT: From what I understand I will need to decide whether to divide horizontally or vertically. How is this decision made and what is the process of this division with regards to starting point and finishing point?

Begin with an empty field.
Bisect the field with a wall, either horizontally or vertically. Add a single passage through the wall.
Repeat step #2 with the areas on either side of the wall.
Continue, recursively, until the maze reaches the desired resolution.
Jamis Buck on Maze Generation: Recursive Backtracking

Related

Is it better to reuse the same instance of awt.Graphics than to create copies with Graphics.create()? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I got involved with some folks making a new 2D game engine in Java, and I got curious when I learned they avoided using any variation of Graphics.create in their engine's code.
When asked, they said they feared making copies of Graphics for every graphical component seemed like "(...)quite some amount of overhead."
But they could not provide any proof of the claim. Instead of making use of the clipRect and translation properties of Graphics, they instead provide their own support API for drawing in the right place.
I'm not a part of their team, but I do use their unfinished engine in my own project, so I want to find out.
Looking for an answer myself resulted only in a brick wall. The Graphics class is abstract, and I have so far not found any implementation code. So I can't find the answer.
And so I end up asking here.
What performance/memory cost if any, is there for using the Graphics.create() function?

Detect whether there is a way out of a 3D room [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm developing this for Bukkit, but I am open to porting a java-only solution.
Now, I have a character in a room with an opening exposed to the outside for radiation to seep in like this:
(sorry for terrible paint skills) In this picture the algorithm should return false, however if that white bit was covered, it would return true.
I need a way of detecting whether the character is inside a room or not. Please remember that a room can be any size, and does not have to be a cuboid.
The way I'd like it to work is that I'd have an arbitrary position above the roof, and if this maze algorithm would be able to reach this position, I'd know that the character is not completely covered.
EDIT: Actually if the exit was 20+ units away, I wouldn't mind the algorithm timing out.
This is not an answer per se, but it may be a good point to move on from.
The definition for room:
a part or division of a building enclosed by walls, floor, and
ceiling.
The definition for building:
a structure with a roof and walls
The definition of a structure:
a building or other object constructed from several parts
Can you see how poorly defined these are? (The definitions for building and structure are recursive!) Until you can come up with a clear cut, black and white definition for what you consider to be a room, you (and us) have very little hope of coming up with a good solution.

How to approach probability type of programming challenge? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
You're dealt 17 cards from a 52-card deck. On average, what is the longest straight flush you will have in your hand?
A straight flush is a set of cards that are consecutive, and also of the same suit. 2 is low, Ace is high, and you cannot wrap around. Do not solve this mathematically — create a program that approximates this.
I'm not able to think about the correct approach for this type of question. Is there any type of algorithm I have to apply?
This is an example of what's called a "Monte Carlo" program, after the casino resort. The idea is to just try a random process a whole bunch of times and look at the statistics.
Basically, you should write a program that deals 17 cards from the deck and counts the longest straight flush. Then you call that a lot of times (maybe 10,000 or 100,000) and take the average.

Creating Bewjeled with Java, how to check for appropriate moves from user? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
We have to make a simplified version of bejeweled as a project for Java. The user enters their proposed move, and if the symbols in an array are not a set of 3, the move cannot happen. How should I go about testing for this?
Any help is much appreciated!
Simple way:
You can store the game board as a 2 dimensional array and when the user swaps two nodes, update the game board, then if there are 3 next to each other: kill those 3 and let the ones above fall (keep this game board), if there aren't 3 next to each other: revert to the old game board.
There are more complex ways to do it obviously, but that should get you started.
How about an infinite loop that runs in a thread as long as the game is being played that iterates through the array and checks for matches?

Algorithm for finding trends in data? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm looking for an algorithm that is able to find trends in large amounts of data. For instance, if one is given time t and a variable x, (t,x), and given input such as {(1,1), (2,4), (3,9), (4,16)}, it should be able to figure out that the value of x for t=5 is 25. How is this normally implemented? Do most algorithms compute lines of best fit that are linear, quadratic, exponential, etc. and then chooses the line of best fit with the lowest standard deviation? Are there other techniques for finding trends in data? Also, what happens when you increase the number of variables to analyze large vectors?
This is a really complex question, try to start from: http://en.wikipedia.org/wiki/Interpolation
There is no simple answer for a complex problem: http://en.wikipedia.org/wiki/Regression_analysis
A Neural network might be a good candidate. Especially if you want to learn it something nonlinear.

Categories