Search:

Type: Posts; User: JaAnTr

Page 1 of 2 1 2

Search: Search took 0.24 seconds.

  1. Help with a few short Java exam questions.

    http://i.imgur.com/qAKrNaN.png
    http://i.imgur.com/I6BPjDZ.png
    http://i.imgur.com/EJZr0ov.png
    This question has confused me because "Errors" are capitalised and I'm not sure what they mean....
  2. Replies
    3
    Views
    86

    Re: Ignore certain characters in a string.

    I'm not sure how I would go about doing that as the string I'm using doesn't always begin with LOOKREPLY and always is followed by around 25 other characters.
  3. Replies
    3
    Views
    86

    Ignore certain characters in a string.

    Hi, I'm trying to loop through a string and depending on the character, add a JLabel to a game. The problem is the character 'L' represents a lantern but is also used in the reply the game gives...
  4. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    EDIT: DON'T WORRY, I'VE FIXED THE PROBLEM!


    Hi I've figured that out thanks! But now I'm having trouble printing a string in a grid. I've managed to create a string of the surrounding area and am...
  5. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    Sorry, I don't understand why I can't use Map.matrix[playerX+i][playerY+j]. I thought I would need to use the player's X and Y coordinates to print the 5x5 of what is around the player. I'll show you...
  6. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    There isn't a runtime error as I can't run it. But it wants me to change - char theLookMatrix[][] to just char theLookMatrix. If I do this then there are still more errors.
  7. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    Hi, following on from my last question kind of, I'm trying to use a for loop to print out the 2d array that is around it. I'm trying to do this my creating a new 2d array of these coordinates but I'm...
  8. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    Hi, I've nearly finished everything now, and it wouldn't have been possible without your advice, so thanks!

    One last question. I have to make it so entering "LOOK" will reply with a 5x5 grid of...
  9. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    Thanks I've got it working!

    One more question. I've got the grid printing like:


    # # # # # # # # # # # # # # # # # # #
    # . . . . . . . . . . . . . . . . . #
    # . . . . . . G . . . . . . . ....
  10. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    I'm confused about the use of the String[] array. It seems like an overly complex way to do it. There's very few possible commands and they are:


    HELLO
    MOVE N
    MOVE S
    MOVE E
    MOVE W
    PICKUP...
  11. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    Here's the code:


    import java.io.IOException;
    import java.util.Arrays;
    import java.util.Random;
    import java.util.Scanner;
    import java.util.Scanner;
  12. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    Hi, I was wondering if you could help me with something else. I've done loads more since the last question and I've got a problem taking user input. I've got quite a few methods such as move, which...
  13. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    I've managed to create an instance of the Map class in the GameLogic class and was just wondering if you could offer me some advice on implementing the player in the game. I'm not sure if the player...
  14. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    I took your advice and removed the COLUMNS bit as it was causing me a few issues and your way of doing it was much better!

    I was wondering if you could help me out with a few things. I've moved on...
  15. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    I have just realised that I had overlooked something.

    I need to be able to use any map that is written in the same form as the one I posted, so whilst that one was 9 rows by 19 columns they won't...
  16. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    Right, I think I've got it working!

    If you don't mind, could you just have one last look to check I've satisfied the requirements:


    ///Create a class Map that:
    ///Reads one of the sample...
  17. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    Hi, I'm struggling a bit with this. I've tried what you said, but I keep getting errors. Here's the code I've got:



    import java.io.BufferedReader;
    import java.io.FileReader;
    import...
  18. Re: Read ASCII art map and store the information in 2D array (int[][] or char[][])

    I've renamed the variables M and N to columns and rows respectively. I think that's what they should be as you can see from the ASCII map there are 19 columns and 9 rows.

    I've also tried printing...
  19. Read ASCII art map and store the information in 2D array (int[][] or char[][])

    Hi, I've written some code to do this, but it's not working as I expect and am at a loss on how to fix it.

    This is what the ASCII map looks like:


    ###################
    #.................#...
  20. Replies
    12
    Views
    263

    Re: Adding operands and operators to Arrays.

    I think I've finally figured it out, but I'm not completely sure. I think I've got both the operands and operators in arrays, but as I've used different ways to get them in to the arrays I'm not sure...
  21. Replies
    12
    Views
    263

    Re: Adding operands and operators to Arrays.

    Ok, i've read what you said and realised that you can't print an ArrayList like that. I've also read about printing an arrayList using a for loop and I've tried that but it's still printing...
  22. Replies
    12
    Views
    263

    Re: Adding operands and operators to Arrays.

    Sorry I'm not sure I understand you when you say it needs to be an array not an arrayList? Surely it's better to use an ArrayList as I don't have to define how big it is?

    Here is my code incase...
  23. Replies
    12
    Views
    263

    Re: Adding operands and operators to Arrays.

    When I'm trying to print using that I'm getting the error "The method toString(long[]) in the type Arrays is not applicable for the arguments (ArrayList<String[]>)"

    Eclipse is suggesting I change...
  24. Replies
    12
    Views
    263

    Re: Adding operands and operators to Arrays.

    I've spent some time researching how to do it and I've come up with something but I've got a few issues. Here's the code:




    public static Object[] parseInput(String stringCalculator)
    {...
  25. Replies
    12
    Views
    263

    Re: Adding operands and operators to Arrays.

    Sorry, I'm not sure exactly what you mean. I've already got the input split in to an array so what I really want to do is take all the characters that are +-/* from the array and put them in the...
Results 1 to 25 of 31
Page 1 of 2 1 2