runfaster's Profile User Rating: -----

Reputation: 14 Tradesman
Active Members
Active Posts:
135 (0.06 per day)
23-January 09
Profile Views:
Last Active:
User is offline Mar 24 2013 02:01 PM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Your Car:
Who Cares
Dream Kudos:

Latest Visitors

Icon   runfaster has not set their status

Posts I've Made

  1. In Topic: Battleship program

    Posted 19 Feb 2013

    I'd say you're getting the NullPointer because you haven't initialized the SingleSpace objects in your Grid. You need to initialize them before trying to operate on them, otherwise you're trying to perform the operation on a null object, and thus throwing the exception.

    So, a fix for that might look something like this:

    public Grid(int rows, int cols){
    for(int i = 0; i < 10; i++){
            for(int j = 0; j < 10; j++){
                   playerBoard[i][j] = new SingleSpace();

    You also have other issues with how big you want your constructor to make the Grid. You currently have 3 options in your code: the two constants ROW and COLS, hard coded values in the for loops, and passed parameters. It's best to decide on this now, so as to avoid confusion later.

    EDIT: The reason it worked when using int is that int has a default value of zero, as discussed here. Objects have a default value of null.
  2. In Topic: Tossing a coin

    Posted 14 Feb 2013

    Here's a relevant link to a description of the method: W3 School Page

    I would look at that, and look at your if statement in flip(). Your comparison is your problem.

    Pay special attention to the range of the random method and the fact that you want a given result half of the time.

    That's all I've got for you at a glance. For displaying results, however, someone else will have to help you. Unfortunately, I'm not that familiar with javascript.
  3. In Topic: Test Driven Development, do you use it?

    Posted 12 Feb 2013

    The job I just started really promotes this style of coding, but didn't use it at all in college. Thus, I put "No, (some other reason).

    It's quite a struggle to try and flip your mindset to test-driven when you're not used to it, but I can certainly see the benefits. Knowing what you have to satisfy, test-wise, is definitely a good way to approach a development problem. I'm definitely going to try and use it going forward.

My Information

Member Title:
D.I.C Head
Age Unknown
Birthday Unknown
Marching Band, Programming, Gaming, Reading, D&D, and German Language
Full Name:
Charlie Allen
Years Programming:
Programming Languages:
C, C++, C#, Java, some Python, SML, and Prolog

Contact Information

Website URL:
Website URL  http://



runfaster has no profile comments yet. Why not say hello?