Search:

Type: Posts; User: dabdi

Page 1 of 3 1 2 3

Search: Search took 0.07 seconds.

  1. Replies
    2
    Views
    7,642

    Re: Converting Java Code to work with Android

    Well if you don't mix gui stuff with non-gui stuff, then you will have to change only a small part of your application.
    Java applications use Swing and Android has its own components that do similar...
  2. Thread: binary heap

    by dabdi
    Replies
    0
    Views
    1,529

    binary heap

    Solved. Please delete post.
  3. Replies
    1
    Views
    1,665

    Re: Functions, real numbers and for loops

    Learn how to use loops.
    Also note that
    1 + 1/2 + 1/3 + 1/4 + .... = 1/1 + 1/2 + 1/3 + ... = sum(1/i, for i = 1 to n)
    Your mission is to write the last expression in for loops which should be...
  4. Thread: random problem

    by dabdi
    Replies
    2
    Views
    1,036

    Re: random problem

    Problem with casting.

    (int) Math.random() * 6
    should be
    (int) (Math.random() * 6)

    Similar correction for the other one.
    What happened in your case was that random() which is between 0.0 and...
  5. Replies
    3
    Views
    4,330

    Re: Simply don't understand minimax...

    First of all you should not create new board every time you make a move. That is a total waste of space and time.
    Instead have methods to make and unmake a move. Also you need an evaluation...
  6. Re: Conditions and 'might not have been initialized' error.

    Right. I still miss that const and final are not really the same thing.


    Initialization do not have to be expensive. Initialization of local objects to null is a good solution.
    A similar...
  7. Re: Conditions and 'might not have been initialized' error.

    Actully it is better to initialize every time. The java compiler is weak in detecting all paths unless you make it so obvious

    public class Test {
    public static final int get() {
    return 0;
    }...
  8. Re: Conditions and 'might not have been initialized' error.

    Local variables should always be initialized.


    double af = 0.
  9. Re: Depth-Limited Search using Recursive Backtracking...please help!

    As sean4u pointed out hashmap uses hash tables i.e (key,value) pair, so it is not sorted in any way. Interestingly it seems it is non-deterministic as well (you get different sequence every time you...
  10. Re: Depth-Limited Search using Recursive Backtracking...please help!

    Yes proper back propagation is required for more complex goals. The OP's problem is very simple as to not require advanced solutions. He can even use a longjump once he encounters a goal at a leaf...
  11. Replies
    6
    Views
    2,832

    Re: Event Handling - Best Practice?

    You are right. Oracle just points out use of inner classes is inefficient but is a good OO design. But does not recommend
    any of the methods

    General Information about Writing Event Listeners (The...
  12. Re: Depth-Limited Search using Recursive Backtracking...please help!

    You have isGoalState inside the for loop as well so make the same change.


    // recursively expands search space
    output = recursiveExpandNode( current );
    if( problem.isGoalState(...
  13. Replies
    6
    Views
    2,832

    Re: Event Handling - Best Practice?

    Oracle suggests use of inner classes for listeners. Switch statements are not good OOP design .
    On the downside, you will start having tons of .class files for each event handler. That could ,for...
  14. Re: Depth-Limited Search using Recursive Backtracking...please help!

    Did you try my suggestion ? It is pretty straight forward and I can not see why it will not work.
    Declare a member variable goalFound.

    Boolean goalFound;

    Set it to false initially (in...
  15. Replies
    3
    Views
    2,149

    Re: Manually recoloring buffered images

    I had similar problem that I solved using filters. LookupOp (Java 2 Platform SE v1.4.2)
    This is much faster than the pixel by pixel method you are using. I have a white image with transperent...
  16. Re: Concurrency Programming GURUS: Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    To get results quickly,each animal's time series can be processed separately because the magical strength of
    animals is independent of one other. This parallelization is limited by the number of...
  17. Re: Depth-Limited Search using Recursive Backtracking...please help!

    I think your termination criteria is wrong. You should unwind the recursion when a goal is found anywhere in the tree (not just when the current node is a goal). A simple solution is to have a...
  18. Replies
    4
    Views
    1,203

    Re: Logic issue(I believe) stumped

    No the values of the variables should all be zero. You are directly printing out what is returned from the functions
    without assigning it to your variables. So what you probably saw is those...
  19. [SOLVED] Re: Instance data member vs Local variables (primitive/object reference)

    Here is an explanation for both of your questions: oop - Uninitialized variables and members in Java - Stack Overflow
    The compiler forces you to initialize local variables partly because it can not...
  20. Replies
    4
    Views
    1,203

    Re: Logic issue(I believe) stumped

    Your problem is you do not assign the values returned from the function into the variables you declared.
    Java passes primitives such as integers by value so you should not expect...
  21. Replies
    4
    Views
    2,121

    Re: Need help with an Octal Numbers program

    You did everything right except you forgot to return when the user enters a negative number.
    You can handle exceptional cases by throwing an exception. But for your simple example, you can just ...
  22. Replies
    9
    Views
    2,734

    Re: Help on some work i got ! Reversi game

    Sent you a PM.
  23. Replies
    4
    Views
    1,684

    Re: Syntax for 3D array enhanced

    I mean something like


    for(int i = 0;i < 2;i++)
    for(int j = 0;j < 3;j++)
    for(int k = 0;k < 4;k++)
    System.out.println(x[i][j][k])

    Personally I find this simpler than the...
  24. Replies
    9
    Views
    2,734

    Re: Help on some work i got ! Reversi game

    No thank you. Again what exactly did you find wrong with my _other_ posts ??

    Then let it go. Hint I have reversi programs that 99% humans could not beat.

    Unbelievable how I spend my time is...
  25. Replies
    9
    Views
    2,734

    Re: Help on some work i got ! Reversi game

    Kevinworkman, lighten up really! What exactly did you find spoon feeding here ? (a) OP did a lot of work by himself b) I gave him a pseudo code that would definitely _not_ work. Just demonstrates...
Results 1 to 25 of 56
Page 1 of 3 1 2 3