skaoth's Profile User Rating: -----

Reputation: 90 Whiz
Group:
Contributors
Active Posts:
601 (0.29 per day)
Joined:
07-November 07
Profile Views:
8,413
Last Active:
User is offline Mar 28 2012 09:05 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Honda
Dream Kudos:
100

Latest Visitors

Icon   skaoth has not set their status

Posts I've Made

  1. In Topic: BackTracking in a maze

    Posted 12 Feb 2012

    Disclaimer: I didn't read through all your code cuz I've been drinking too much.

    Just looking at the amount of code you wrote for getMove and mazeSolution smelled kind of funny
    The concept is pretty straight forward

    With your assumtions
    X - SOLID WALL (no passage allowed)

    O - PATH (passage allowed)

    . - TRAVELED (path traveled to find the exit)

    and F for exit

    pseudo code
    
    boolean solveMaze(int x, int y) {
      if(maze[x][y] == 'F' {
        return true;
      } else if (maze[x][y] == '.' || maze[x][y] == 'X') {
        return false
      } else {
      // otherwise try each of the 4 possible steps
        maze[x][y] = '.'
        if(solveMaze(x + 1, y)) return true;
        if(solveMaze(x, y + 1)) return true;
        if(solveMaze(x, y - 1)) return true;
        if(solveMaze(x - 1, y)) return true;
    
        // couldn't find a from this position
        maze[x][y] = 'O';
        return false;
    
      }  
    
    }
    
    


    hopefully this clears somethings up
  2. In Topic: Unable to load JComboBox using output of file read method

    Posted 5 Feb 2012

    There looks to be several problems here.
    1) At line 40 you try to add an action listener to an object that hasn't yet been initialized
    2) At line 63 you try and initialize the JComboBox with a primitive array. However no such constructor exists for JComboBox. JComboBox(Object[] items) is what you want

    You can fix this by declaring stringChoice to be Integer[] stringChoice. Though you may want this String[] stringChoice

    To simplify thing remove all that code of trying to read from a file because it doesn't look like you need it.

    lines 40 to 56 can be replace with
    stringChoice =  new Integer[] {1, 2, 3};
    
    


    This should load the comboBox with 3 numbers.
    You can then replace that with something like this

    stringChoice = getChoices();
    
    

    Where getChoices() reads from the file the data that you need populated
  3. In Topic: Problem is with my recursive pseudo code

    Posted 5 Feb 2012

    Something is wrong with your pseudo code.
    I'm now sure what tail() returns but something doesn't feel right with
    samelist(tail(L1), tail(L2))

    The way I look at this problem is that we just simply want to check if each element in
    the list is the same.

    Pseudo code:
    L1 = {1, 2, 3, 4}
    L2 = {1, 2, 3, 4}

    sameList(L1, L2, 0)

    boolean sameList(L1, L2, index) {
    // note NOT check for indexing exceptions
    return (L1[index] == L2[index] && sameList(L1, L2, index + 1)
    }

    }
  4. In Topic: What is indirect assocations (Ex. MVC-Model)?

    Posted 5 Feb 2012

    The whole point of MVC is separation of concerns. What is meant by this, is that the different components of your application should know as little as possible about the other components to that you don't have a highly coupled system.

    With MVC, The controller generally knows about both the view and model.
    When implementing the controller you will usually do something like this

    public class MyController {
        MyView view;
        Model model;
        
        public MyController(MyView view, Model model) {
            view.addCoolEventListener(new ActionListener() { ... })
        }
    ...
    }
    
    


    The controller above has a "direct" association with both the Model and View because it has to know about them.

    The "indirect" association is generally done using the observer pattern.
    The example is the View in MVC
    public class MyView {
    
      public void addCoolEventListener(ActionListener event) {...}
    }
    
    


    Here the view allows other objects to know that the view did something.
    In our case the controller created an "indirect" relationship by registering for the "CoolEvent" event.
  5. In Topic: Game - Swing Not Thread Safe Issue

    Posted 5 Feb 2012

    Looking at the java.util.concurrent package and documentation is a good place to start.

    http://docs.oracle.c...ency/pools.html

My Information

Member Title:
D.I.C Addict
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
USA, WA
Interests:
OOP, Kernel development
Years Programming:
5
Programming Languages:
C++, C#, Java, Perl

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Friends

Comments

Page 1 of 1
  1. Photo

    christo@henq.co.za Icon

    05 Jan 2012 - 06:13
    Hi "Skaoth"
    I took some time to register on this site just to say thanks for that tutorial you posted on "Creating activex objects with c#". It is a great contribution.
    Thanks
Page 1 of 1