Loading maps for a 2d game ERROR

Hi i'm trying to just get a basic map working but i keep getting and error and i'm not sure what is causing it.
Here is the code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
class MapExample extends JFrame {
ArrayList <String> lines = new ArrayList <String> ();
int lgth;
int bdth;
String userResponse;
int level;
char[][] myMap;
public MapExample() {
readMap();
     parseMap();
     public static void main(String args[]) {
     System.out.println("Starting MapExample...");
     MapExample mainFrame = new MapExample();
     mainFrame.setSize(400, 400);
     mainFrame.setTitle("MapExample");
     mainFrame.setVisible(true);
     public void readMap () {
     FileReader readBase;
     BufferedReader in;
     String temp;
     temp = "";
     try {
     readBase = new FileReader ("level1.map");
     in = new BufferedReader (readBase);
     temp = in.readLine();
     while (temp != null) {
     lines.add(temp);
     temp = in.readLine();
catch (IOException except) {
JOptionPane.showMessageDialog (null, "A Horrible Error!");
public void parseMap () {
String aLine;
aLine = "";
char tmp;
tmp = 'a';
lgth = lines.size();
bdth = lines.get(0).length();
myMap = new char[lgth][bdth];
     for (int i = 0; i < lines.size(); i++) {
     aLine = lines.get(i);
     for (int j = 0; j < aLine.length(); j++) {
     tmp = aLine.charAt(j);
     myMap [j] = tmp;     
     for (int i = 0; i < lgth; i++) {
     for (int j = 0; j < bdth; j++) {
     System.out.print (myMap[i][j]);
     System.out.println();
public void paint(Graphics g) {
     int gx, gy = 40;
     for (int i = 0; i < lgth; i++) {
     gx = 20;
     for (int j = 0; j < bdth; j++) {
     g.fillRect (gx, gy, lgth, bdth);
     switch (myMap[i][j]) {
     case '#' : g.setColor (Color.RED); break;
     case '@' : g.setColor (Color.GREEN); break;
     case '$' : g.setColor (Color.BLUE); break;
     case '.' : g.setColor (Color.BLUE); break;
     default : g.setColor (Color.BLACK); break;
     g.fillRect (gx, gy, 20, 20);
     gx += 20;
     gy += 20;                    
Sorry about the layout of the code only way i could fit it in.
The error i keep getting is:
Starting MapExample...
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 14
at MapExample.parseMap(MapExample.java:99)
at MapExample.<init>(MapExample.java:33)
at MapExample.main(MapExample.java:38)
Process completed.
I'm not sure why it does this?
Also here is level1.map file:
"M^^^^#####" +
"M^^^^# #" +
"M^^^^#$ #" +
"M^^### $##" +
"M^^# $ $ #" +
"M### # ## #^^^######" +
"M# # ## ##### ..#" +
"M# $ $ ..#" +
"M##### ### #@## ..#" +
"M^^^^# #########" +
"M^^^^#######"
Any help would be greatful!
Cheers Paul

I second the recommendation of putting your code within code tags.
See which is easier to read, this code without tags:
import java.util.ArrayList;
import java.util.Random;
class RandomLetters
private int size = 0;
private char startingChar = 'A';
private ArrayList<String> letterList;
private Random rand;
public RandomLetters(int size) throws Exception
this.size = size;
rand = new Random();
if (size % 2 != 0)
throw new Exception(
"RandomLetters requires an an even number int parameter");
resetList();
public RandomLetters(int size, char startingChar) throws Exception
this.size = size;
this.startingChar = startingChar;
rand = new Random();
if (size % 2 != 0)
throw new Exception(
"RandomLetters requires an an even number int parameter");
resetList();
public void setStartingChar(char startingChar)
this.startingChar = startingChar;
* refills the list w/ random characters.
public void resetList()
letterList = new ArrayList<String>();
for (char myChar = startingChar; myChar < startingChar + (size / 2); myChar++)
letterList.add(String.valueOf(myChar));
letterList.add(String.valueOf(myChar));
* gets a random letter from letterList then removes that
* item from the list.
* @return
public String getRandomLetter()
int randomInt = rand.nextInt(letterList.size());
String temp = letterList.get(randomInt);
letterList.remove(randomInt);
return temp;
and the same code with tags:
import java.util.ArrayList;
import java.util.Random;
class RandomLetters
    private int size = 0;
    private char startingChar = 'A';
    private ArrayList<String> letterList;
    private Random rand;
    public RandomLetters(int size) throws Exception
        this.size = size;
        rand = new Random();
        if (size % 2 != 0)
            throw new Exception(
                "RandomLetters requires an an even number int parameter");
        resetList();
    public RandomLetters(int size, char startingChar) throws Exception
        this.size = size;
        this.startingChar = startingChar;
        rand = new Random();
        if (size % 2 != 0)
            throw new Exception(
                "RandomLetters requires an an even number int parameter");
        resetList();
    public void setStartingChar(char startingChar)
        this.startingChar = startingChar;
     * refills the list w/ random characters.
    public void resetList()
        letterList = new ArrayList<String>();
        for (char myChar = startingChar; myChar < startingChar + (size / 2); myChar++)
            letterList.add(String.valueOf(myChar));
            letterList.add(String.valueOf(myChar));
     * gets a random letter from letterList then removes that
     * item from the list.
     * @return
    public String getRandomLetter()
        int randomInt = rand.nextInt(letterList.size());
        String temp = letterList.get(randomInt);
        letterList.remove(randomInt);
        return temp;
}Also, post the total error message, not just that errors occur.
good luck!
/pete

Similar Messages

  • Error when crawling "Unable to load stemmer for locale 1033. Error code 80040111."

    In the Sharepoint Search Service I get tose error "MAPI: Logon failed. " in the log and "Unable to load stemmer for locale 1033. Error code 80040111." in ULS.
    The error code 80040111 is well a relation with Mapi but what about stemmer???

    Hi,
    For your issue, check your current language settings and ensure that search supports the current language.
    On the SharePoint Server open Registry Editor (Start -> type “Regedit” and hit enter). 
    Point to : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OfficeServer\14.0\Search\Setup\ContentIndexCommon\LanguageResources\Default\English
    Under the registry key for each of the languages there is a value called StemmerDLLPath and WBDLLPathOverride
    Updated the registry entry with NATURA~1.dll to NATURA~2.dll
    Point to Start -> Administrative Tools -> Services, right click on SharePoint Server Search 14 and click on Restart.
    Performed a Full Crawl and wait for the Full Crawl to complete and try searching again.
    For more detailed information, refer to the following blogs:
    http://blog.ithinksharepoint.com/2008/04/20/a-word-breaker-was-not-found-for-the-given-language-error-when-crawling-content/
    http://www.sharepoint2013.me/Blog/Post/175/Word-breakers-in-SharePoint-2013
    Best Regards,
    Lisa Chen
    Lisa Chen
    TechNet Community Support

  • Error in codepage mapping for source system. Error

    Hi BW Experts,
    I am facing following error:
    Error message: Error in codepage mapping for source system. Error text:
    Details: Inbound Processing ( 1000  Records ) : Errors occurred
                Error in codepage mapping for source system. Error text:
                Update PSA ( 0 Records posted ) : Missing messages
    I repeated the delta working and everything fine.
    Does anybody know why this error occurs?

    Run rsa13 (for bi 7.0) find your source system which one you are using for data transfer and double  click on it and find special options there select  the optioned i mentioned already.
    Please search SDN you can fin threads related to this thread
    if not let me know.
    Regards.

  • Error in codepage mapping for source system. Error text:

    guyz,
    im facing the below issue in prod.
    Error in codepage mapping for source system. Error text:
    Message no. RSDS_ACCESS013
    Collection in source system ended
    Error message during processing in BI
    Diagnosis
    An error occurred in BI while processing the data. The error is documented in an error message.
    System Response
    A caller 01, 02 or equal to or greater than 20 contains an error meesage.
    Further analysis:
    The error message(s) was (were) sent by:
    Inbound Processing
    Procedure
    Check the error message (pushbutton below the text).
    Select the message in the message dialog box, and look at the long text for further information.
    Follow the instructions in the message.
    need your guidance,
    cheerz,
    raps.
    Edited by: raps on Mar 1, 2012 9:39 AM

    Hi ,
    Kindly go throught the following threads for your issue resolution::
    Error in code page mapping for Source System
    Erroe in source system
    Regards,
    Arpit

  • Mapping for component Not Found Error ?

    Hi does anyone know how this error can be fixed I am trying to refer to a compnent called task and it
    is saying I have not mapped it yet it has been mapped inside my coldbox framework ?
    The error I get is:
    Coldfusion.orm.EntityMappingNotFoundException: mapping for component task not found
    Any help would greatly be appreciated on this.
    Thanks

    When using ORM generator to generate cfcs make sure that Application.cfc has unique app names in order to solve the problem above.

  • Cannot load map for Japan into Lumia 800

    Hi,
    I am shortly travelling to Japan I wanted to pre-load Japan map into my Lumia 800. However, it seems that it is impossible. When trying to load Japa map via Nokia navigation there is no Japan under Asia. There is China and many other Asian country, but Japan is missing ...
    Is this known feature or what ???

    To date Nokia has avoided getting involved in providing mapping for Japan as the Japanese banchi address system is not based on the street number system like the US or Europe.
    Users of Nokia Symbian devices had to utilise Garmin Mobile Xt for navigation in Japan.
    Happy to have helped forum in a small way with a Support Ratio = 37.0

  • Error in codepage mapping for source system

    Hi Experts,
    I am getting the following error while loading data from ECC only for Account COPA datasource.
    Error in codepage mapping for source system. Error text:
    Message no. RSDS_ACCESS013
    Regards,
    Sandeep Sharma

    Hi Sandeep,
    This is a issue related to idocsRFC connections from teh sourcesystem....
    U can contact ur BASIS team to solve this...
    From their end they have to chk the unprocessed/errored idocs in BD87...
    They have to run a report:RBDAGAIN to process the errored idoc's in the source which are in STATUS:'02'.
    This is a solution for temporarilrly basis...
    If this occurs regularly they have to change the settings in SM59 which is so important...
    Refer exact note for this: 784381
    The SAP note 613389 may also be relevant for the error message "Could not find code page for receiving system", please check the information given in the note and see if you can use it to resolve the problem.
    Regards,
    Marasa.

  • Error in code page mapping for Source system whil loading the data from ECC

    HI Gurus,
    I am working in a implementation project, Recently our BI sand box is up, when i am doing my load from 0comp_code_attr it is throwing an error "Error in code page mapping for source system"(This is my first load from ECC).
    In details tab it is showing as the data is sent from the source system but the data is not reaching to the PSA.
    Please let me know if there are any settings needs to be made.
    Many thanks in Advance
    Jagadeesh

    HI V,
    Thanks for your quick response. I did it but it didn't resolve the issue. since the system id which i am having is 3 digits(LEC) but there it is taking only 2 digits, so i clicked on the button called Propose system ids, it has praposed LE, but the issue is stil there.
    Do we need to do any settings in LBWE??
    Thanks and Regards
    Jagadeesh

  • Facebook games not loading, Error message was SSL peer rejected a handshake message for unacceptable content. (Error code: ssl_error_illegal_parameter_alert).

    The facebook game not loading properly, it getting struck, when i refresh the page Error message was showing. The error message was
    "Secure Connection Failed
    An error occurred during a connection to imabigfanof.criminalcasegame.com. SSL peer rejected a handshake message for unacceptable content. (Error code: ssl_error_illegal_parameter_alert)
    The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
    Please contact the website owners to inform them of this problem. Alternatively, use the command found in the help menu to report this broken site. "
    I had reset the firefox, but it doesn't fix my problem. I had checked same page in other browsers, like Google Chrome & Internet Explorer. I didnot get problem in that browser, The problem coming in firefox browser only.
    Firefox is my best web browser, Please help me to fix this problem.
    Waiting for ur kind reply...

    Thank you for the advice, I do run Kaspersky and will disable it to see if this will work and report back so that if there is others that are experiencing the same problem can also bennefit from this advice

  • Purchased MLB via 1 of my 3 appletv's. My oldest 2nd gen 720P shows "error loading content" for all games. What's up?  Also I can't get MLB to work on my iPad2, iPhone 4S or iPod 5th gen. Arrhhgg

    Purchased MLB via iTunes on 1 of my 3 appletv's. My oldest 2nd gen 720p shows "unable to load content" for all games , but my other 2 appletv's work fine, restarted problem appletv to no luck.  Also can't watch games on my ipad2 "unable to restore from iTunes" , iPhone 4s " unable to connect to MLB.com" or iPod 5th gen.

    Purchased MLB via iTunes on 1 of my 3 appletv's. My oldest 2nd gen 720p shows "unable to load content" for all games , but my other 2 appletv's work fine, restarted problem appletv to no luck.  Also can't watch games on my ipad2 "unable to restore from iTunes" , iPhone 4s " unable to connect to MLB.com" or iPod 5th gen.

  • Error in code page mapping for Source System

    Hi All,
    We are Loading data into BI system from MDM System.
    It was loading fine but Yesterday we got an error " Error in code page mapping for Source System"
    Message Class: RSDS_ACCESS 13.
    We alreday tried to Search any IDOCs with error/unprocessed , but there isn't any.
    Any pointers for this error will be Helpful.
    Regards,
    Mayank

    Our SP currently SAPKW70019 , the SAP note mentioned above required to apply SP for 13, which we already beyond that...unfortunately we still face the same problem .. almost every day ..
    any advice.. ?
    Edited by: Edi Erwan  Abu Talib on Jun 22, 2009 8:22 AM

  • Error while loading catalogue for n78

    Hey I'm from Lebanon and I have nokia n78 with maps 3.0 , I try to download maps via nokia map loader but I keep getting a message : error while loading catalogue for n78 .
     but when I roll back to maps 2.0 it works fine... Please I want help on this because I want to use maps 3.0 not 2.0. But I can't
    N.B: I tried everything  ( deleting cities and qf folders ...)

    mr_abong wrote:
     I cannot download map using Map loader 3.0
    it say "Error while loading catalogue for n78"
    what should i do?
    anyone have download link for map package?
    If you upgrade from maps 2.0 to 3.0, delete the file named "qf" and a folder "cities" from your memory card, open map 3.0 once and close it before you start the map loader.
    Message Edited by goofyskyhero on 30-Jul-2009 03:21 PM

  • Error loading Map Tile Layer when restart

    Hi all,
    I'm a newbie to Mapviewer. I'm having some problem after i restart the oc4j. Originally, when i insert the image into georaster and some other steps, then i did a xml_request for the map tile. It could load the map originally. When i restart the oc4j, it gives me the following error
    2008-03-11 17:55:28.046 WARNING Cannot list base maps.
    2008-03-11 17:55:28.203 ERROR Error in loading map tile layer config from databa
    se!(TEST,ML1)
    2008-03-11 17:55:28.203 ERROR Base map does not exist. Cannot create internal ma
    p source.(TEST,ML1)
    The mapviewer and app server is on the same domain but the database in on a different domain. When i tried to shift mapviewer to the same domain as the database, it won't cause this problem.
    Could anyone suggest me any solution?
    Message was edited by:
    nvr4getu

    Hi,
    It's pointing to the correct data sources. I've even tried to remove all the map tile and data, then upload again from my test application, it can render the map. However, when i restart the oc4j, the error occur again. Is this a bug of mapviewer that mapviewer must be deploy on the same machine with database?
    Cheng

  • Error While Saving Mapping For A Dimension

    I am getting The Error While Saving The mapping For a Dimension
    Any Clue?
    An error occurred creating DimensionMapGroup BROKERS.MAPGROUP1.DIMENSIONMAPGROUP : ***Error Occured in
    DELETE_MAPPING_GROUP: Analytic workspace object __XML_STARTUP_CALCMMBRS does
    not exist.
    Thanks
    Raghu

    Check the OSS note 550760 regarding the issue.

  • I want to writte C# code for 503 Service Unavailable error to web application page immediate close connection any page loaded

    Here is a ticket regarding our current client web application (  Image data add, edit , delete in folder with form data in MSSQL Database) that using code c#, web form, ajax, VS2008, MSSQL Server2008 , it appears that there is an error where the HTTP
    503 error occurs. 
    . Below is a conversation with Host Server support assistant.Can you take a look at it? 
    Ben (support) - Hi 
    Customer - We're having an issue with our windows host 
    Ben (support) - What's the issue? 
    Customer - 503 errors 
    Ben (support) - I am not getting any 503 errors on your site, is there a specific url to duplicate the error? 
    Customer - no, it comes and goes without any change Customer - could you have access to any logs ? 
    Ben (support) - Error logs are only available on Linux shared hosting, however with this error it may be related to you reaching your concurrent connections 
    Ben (support) - You can review more about this at the link \ 
    Customer - probably yes - how can we troubleshoot ? 
    Ben (support) - http://support.godaddy.com/help/article/3206/how-many-visitors-can-view-my-site-at-once 
    Ben (support) - This is something you need to review your code and databases to make sure they are closing the connections in a timely manner 
    Customer - we're low traffic, this is an image DB to show our product details to our customers 
    Customer - ahhhh, so we could have straying sessions ? 
    Ben (support) - Correct Customer - any way you could check if it's the case ? 
    Customer - because it was working previously 
    Ben (support) - We already know that's the case as you stated the 503 errors don't happen all the time if it were issue on the server the the 503 would stay. 
    Customer - so our 2/3 max concurrent users can max out the 200 sessions 
    Customer - correct ? 
    Customer - is there a timeout ? 
    Ben (support) - no that's not a time out concurrent connections are a little different then sessions and or connections. Lets say for an example you have 5 images on your site and 5 7 users come to your site this is not 7 concurrent connections but 35. They
    do close after awhile hence why the 503 error comes and goes. You can have these connections close sooner using code but this is something you have to research using your favorite search engine 
    Customer - thank you so much 
    Customer - I'm surprised that this just started a few weeks ago when we haven't changed anything for months 
    Customer - any changes from your side ? lowering of the value maybe ? 
    Customer - I'm trying to understand what I can report as a significant change 
    Ben (support) - We haven't touched that limit in years 
    Ben (support) - This could just be more users to your site than normal or even more images 
    Customer - I was thinking that could be it indeed 
    Customer - so I need to research how to quickly close connections when not needed 
    Ben (support) - Correctly 
    Ben (support) - correct 
    Customer - thanks !! 
    Ben (support) - Your welcome 
     Analysis : 
     The link provided tells us : All Plesk accounts are limited to 200 simultaneous visitors. 
     From what Ben (support) says and a little extra research, if those aren't visitors but connections then it's quite easy to max out, especially if the connections aren't closed when finished using. I'd suggest forwarding this to Kasem to see what he thinks. 
    Cheers, 
    Customer

    Hi Md,
    Thank you for posting in the MSDN forum.
    >>
    I want to writte C# code for 503 Service Unavailable error to web application page immediate close connection any page loaded.
    Since
    Visual Studio General Forum which discuss VS IDE issue, I am afraid that you post the issue in an incorrect forum.
    To help you find the correct forum, would you mind letting us know more information about this issue? Which kind of web app you develop using C# language? Is it an ASP.NET Web Application?
    If yes, I suggest you could post the issue directly on
    ASP.NET forum, it would better support your issue.
    Thanks for your understanding.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

Maybe you are looking for

  • PODCAST HELP NEEDED!

    is there anyway that i can save a podcast so that it can be saved as an mp4?

  • Multiple emails in outlook 2010 with pdf attachments will not print

    Here is our issue 1. Select multiple emails in outlook 2010 with pdf attachments (versie 10.0.1) 2. Go to file -> Print 3. Select Print Options.  Check the box for Print Attached Files 4. click Print The emails will print but only the first attachmen

  • How to disable some zooming tools in a chart?

    Hi, I am using a chart in LV6.1 and the user of VI, must not be able to change the Yscale limits, neither by editing scales nor by zooming tools. I used a property node and made the Yscale not editable. but How can I disable some of zooming tools suc

  • Shipment cost in customer billing doc

    Hi all I want to include shipment cost in billing document I want to know the detail process. After rising shipment cost doc vi01 this will get reflected in Shipment doc vt01n I need to charge the cost to customer .i want to include cost in customer

  • Has anyone found a soloution to the update problem(update ipod to v1.2)

    It seems alot of people are having this problem, the ipod wound update to v1.2 and an error message keeps coming up saying error code 1417 or something like that