Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Texas UIL Problem: 2007

1. ## Texas UIL Problem: 2007

So, in order to practice for future Competitions... I've printed out a few old UIL packets to go through. I noticed a few re-occurring problems that are somewhat difficult, but manageable. I find myself allotting too much time on these couple of problems instead of working on others...

There's quite a bit, so I understand if you're not willing to read through it all.. Any advice is greatly appreciated though!

To get to the point, here's what I'd like some advice on:
- Translating an Array
~ For Example, simulate a tetris game through a matrix of characters.. If the bottom row is filled, return a new array that has deleted the bottom row and set the remaining characters on the bottom row.

My Code:

```public static char[][] removeBottom(char[][] matrix){
char[][] newArray = new char[matrix.length][matrix.length];
for(int row = 0; row < matrix.length; row++)
for(int col = 0; col < matrix.length; col++)
newArray[row][col] = '.';

for(int row = 1; row < matrix.length; row++)
for(int col = 0; col < matrix.length; col++)
newArray[row][col] = matrix[i-1][j];

return newArray;
}```

- Secondly, I come across Mazes
~ Here are some questions I come across.. Solve for the shortest path, only path, shortest path length.

My Code:

```/*
The following method only removes Dead Ends.
Only can return shortest path when there is EXACTLY one path

I will only show one method, but if this method returns true.. Another will fill in the Dead End.
*/
for(int row = 0; row < maze.length; row++){
for(int col = 0; col < maze[row].length; col++){
if(maze[i][j] == '.'){
if(maze[i-1][j] == '#')
if(maze[i+1][j] == '#')
if(maze[i][j-1] == '#')