SwiftStriker00's Profile User Rating: *****

Reputation: 438 Architect
Group:
Expert w/DIC++
Active Posts:
1,612 (0.66 per day)
Joined:
25-December 08
Profile Views:
32,096
Last Active:
User is offline Jul 14 2015 10:39 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Jeep
Dream Kudos:
275

Latest Visitors

Icon   SwiftStriker00 has set their status

Posts I've Made

  1. In Topic: 8 Queens board

    Posted 14 Jul 2015

    Glad we can help. I was trying to get you to add the queen through each iteration of the columns loop, but doing it in another loop is just fine. example of what I was thinking:

    Random rnd = new Random();
    for( int col = 0; col < CHESS_BOARD; col++ )
    {
    	for( int row = 0; row < CHESS_BOARD; row++ )
    	{
    		board[row][col] = 0;
    	}
    	int randRow = rand.nextInt( CHESS_BOARD );
    	board[ randRow ][ col ] = 1;
    }
    
    
  2. In Topic: 3D boxes Overlapping.

    Posted 10 Jul 2015

    Just take your normal AABB algorithm and add an edge case to it. (pun intended). Some options of implementing are using <= instead of < when checking coordinate points. if Ax == Bx and Ay == By. We know that that line/edge are shared. You can also add compareTo method to your edges so if the box is colliding you can do a compare to see if the edge is sharing.

    I'd say get AABB working first and then worry about things like: box are identical in space, one edge is lined up, 2 edge lined up, one point is lined up, etc... Once you write the basic algorithm, it should be too hard to see where you need to modify to get those edge cases in.
  3. In Topic: 8 Queens board

    Posted 10 Jul 2015

    View Postcode__newb, on 10 July 2015 - 10:37 AM, said:

    wouldnt it be more like:
    	public static void main(String[] args) {
    		// create an 8x8 array for the chess board
    					final int CHESS_BOARD = 8;
    					int[][] board = new int[CHESS_BOARD][CHESS_BOARD];
    					Random rand = new Random();
    					
    				
    					//create board
    					for(int j = 0; j < CHESS_BOARD; j++){	//iterate through column
    						for(int i = 0; i < CHESS_BOARD; i++){ //then each row	
                                                      //pick random row
    
                                                       
                                                      if(){						
    							board[i][j] = 1;  //place queen		
    							}else{
                                                             board[i][j] = 0;
    						}
    			
    					}
    	}
    }
    
    


    The thing I was trying to show you was the fact that you don't have to write all of your code inside both of the nested loops. If you are iterating each cell on the board, then yes you want to be in both so you have a row and a column.

    But what if you only had this code:
    for(int j = 0; j < CHESS_BOARD; j++){
        System.out.println(  board[0][j]  );
    }
    
    

    The only way you could move would be across the board visiting the first row in each column. What would you do if I asked you to visit a random row in each column. What would you change in that loop above?

    Once you've thought about that go back to your nested loop and see how you can pick a random row after you've defaulted them and set that row to 1.

    Also note that macosxnerd101 and I are offering you to do two different approaches, in case we are confusing you, pick one
  4. In Topic: Create click event at runtime

    Posted 8 Jul 2015

    View Postrespect7, on 08 July 2015 - 02:16 PM, said:

    Also SwiftStriker00, at Line 01 of your code you do "var imgFromStream = null;" and that ist not possible because var is implicity type and can't be null, so had to do it like so:

    Image y = null;
    var imagetest = y;
    


    Good catch, notepad code is hard ;-)
  5. In Topic: 3D boxes Overlapping.

    Posted 8 Jul 2015

    If you are doing collision detection you could use AABB to make an efficient guess. If you need something more accurate it will take more math. I suggest you take your box and and find the Surface normal (N1-6) of the 6 sides. then you have to compare it with a point P that you think may be inside. Take the dot product of the the Nx and ( P - P0 ) where P0 is a point on the plane usually the midpoint, you should get a result that is -, 0, or +. If N1-6 are all pointing outward, then a - result would mean the point is inside the box, 0 would be aligned, and + would be outside.

    I would take a small subset of points to do that math with. I'm assuming your boxes can be rotated on any axis, if they were aligned Axis Aligned Bounding Box would be far more effiectient as I previously stated.

My Information

Member Title:
No idea why my code works
Age:
27 years old
Birthday:
May 7, 1988
Gender:
Location:
Rochester, NY
Interests:
Programming, Snowboarding, Videogames, Football, Camping, Watching movies
Full Name:
Ryan Bucinell
Years Programming:
6
Programming Languages:
C#, Java, C++, Actionscript 3.0, Scheme, Perl, Batch, Powershell, Javascript

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://cs.rit.edu/~rmb1201/
Skype:
Skype  SwiftStriker00
LinkedIn:
http://www.linkedin.com/in/ryanbucinell
Facebook:
http://www.facebook.com/ryanbucinell
Twitter:
https://twitter.com/SwiftStriker00

Comments

Page 1 of 1
  1. Photo

    SwiftStriker00 Icon

    07 Sep 2013 - 09:27
    Monu, welcome to d.I.c, if you need help please post your problem in the Java forum along with the code you have already written. We can help you there
  2. Photo

    monu63 Icon

    07 Sep 2013 - 06:50
    hi sir i am a begineer in java.while doing my Thread problem i geting and error of illegal staticdeclaration error. i need know when it usally occur..
  3. Photo

    SwiftStriker00 Icon

    03 Nov 2012 - 12:08
    hi pagelarry, welcome to </d.i.c>
  4. Photo

    pagelarry Icon

    03 Nov 2012 - 06:38
    Hi SwiftStriker..
Page 1 of 1