Mark Quin

Greenhorn
+ Follow
since Oct 21, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mark Quin

OK I am trying to take the last part of the string. But, I am not quite sure how I can make it work right.

My test values were:
Sent [a,b,c,d,e,f] for Mystring and [1,2,3] for the suffix.
subthelengths = 2 = 6-4

I got back:
i=c
i=d

But, what I want to get back is d,e,f.


Specifically this line I think is where the error lies:
Code:






Code:
16 years ago
In class we are doing unit testing. Except I am having a lot of trouble trying to get anything to work.

For example we would get something like:
MyString.java:


Then we are suppose to test for errors and try and break it. By, making an input then checking to see what value is returned to see if there is an error.

Are there any good tutorials to follow on how to do unit testing because I am very lost? Especially simple ones that I can follow along and understand.
[ January 24, 2008: Message edited by: Mark Quin ]
16 years ago

What are ttl, ctl and tcl and so on ?


ctl= Cube and then the abbreviation for the area "top left"
ttl= Space Taken and abbreviation for the area "top left"

System.out.println()

I am using eclipse so it works because I have the console open.

Is this homework ? We don't do homework.


I reused some of my old java projects.

private static final long serialVersionUID = 1L;


At the time I put that in a long time ago I needed it.

arrays


Ya, I know about arrays. I was just trying to get something simple to work before I tried getting all of the squares to work.

Anyways, thank you for you help.

Also, I got the thing to work now:

if (event.getY() <= 100){
if (tTL == false){ //Check if square is taken
if (player == 1){ //Check if player 1
cTL = true;//X takes the square
repaint();
tTL=true;//space taken

}
else {
cTL = false;//O takes the square
repaint();
tTL=true;//space taken
}
tTL=true;//space taken
System.out.println("Top Left");
}


[ November 14, 2007: Message edited by: Mark Quin ]
16 years ago
Anyone, know anything about what is going wrong with my code?
16 years ago
I am trying to make Tic-Tac-Toe except when I try to have more then one square something goes broke. Right now I am trying to get just the Top Left and center left square to work. But when I click it part works once but then it seems to just lock up and no longer lets me make another move.

Any ideas on how I can fix it?

By I think the bug is in this part of my code:

[ November 14, 2007: Message edited by: Mark Quin ]
16 years ago
Someone else I had talked to said it had something to do with the way I was setting things up. I did not quite understand what he was trying to tell me. It had something to do with adding this:

s1= new snake (p)
s2= new snake (p)
s3= new snake (p)
and so on... untill:
s8= new snake (p)
s9= new snake (p)
s10= new snake (p)

privateSnakehead;
public void setup
(Snake head, Snake next,true for head,true for taill)

s1.setup(s1,s2,true,false)
s2.setup(s1,s3,false,false)
and so on... untill:
s10.setup(s1,null,false,true)

if(leader)this
prop()
else
head.prop()

prop()
if(tail){
next.prop()
next.setxy(x,y)}

--------------------------------------
I would have asked him more but he had to leave. Anyone understand what he was trying to tell me. I understand part of it. Like how it checks for head or tail and how the head sends the value to all of the other parts of the snake. But, I still don't fully understand how to implement this.

Anyone understand what to do? I really want to understand how this would work.
16 years ago
Here is the snake class. I commented the line that I am working on with a line of # signs:
16 years ago
When I tried that the old one was the same as the new value. It did not save the value. It just made another variable with the same value. So, when the new value change the old valued changed to the same exact thing.
[ October 26, 2007: Message edited by: Mark Quin ]
16 years ago
I am trying to make a snake animation with 10 circles. Each time the head of the snake moves in some direction, it will make the circle behind it move to where the head was previously. Likewise each circle moves to where the circle in front of it was previously.

Right now my snake is just a head:

How can I save a variable value, so I can move the other parts of the snake up? For instance taking the x,y and then setting the old x,y to the other circle behind it when ever it moves.

Also, any tips or examples on how I can get this to work in general would be of great help.
16 years ago
So, a^2+b^2=c^2 some how can make fluid movement? Unlike of the current 45 deg angles that the ball loves to move in. Interesting, I wonder if I can find anything about how to implement it.

Are there any simple examples or links to them?

[ October 25, 2007: Message edited by: Mark Quin ]

solved, Just had to change some thing and make them doubles. =)
[ October 25, 2007: Message edited by: Mark Quin ]
16 years ago
I have a circle that follows another circle controlled by the user. But, the following circle works but can only move in angles. Is there any examples out there or some tips you can give me to have circles move fluidly.

x,y is the user controlled circle.
xpos,ypos is the following circle.


Here is my class:


[ October 25, 2007: Message edited by: Mark Quin ]
[ October 25, 2007: Message edited by: Mark Quin ]
16 years ago
How exactly can I compensate for Java drawing it from the top left corner? I am new to using Java.

The code for the black ball is quite small.


[ October 22, 2007: Message edited by: Mark Quin ]
[ October 22, 2007: Message edited by: Mark Quin ]
16 years ago

Well, that sounds kind of vague.

It was a bit vague, I just took the distance where it appeared to be just touching the edge of the other circle.

It sounds like you're now changing things randomly to see what happens


I was not just changing things randomly:

Rob Prime: your first piece of code should work if you change the < symbol to >



Where did the 35 come from?


That was the radii1=15 and radii2=10 15+10=35. I typed it in only because I though there could have been a code artifact.

So, now I have re-worked everything but the bug is still there:


Top Left:

Bottom Left:

Top Right:

Bottom Right:

[ October 22, 2007: Message edited by: Mark Quin ]
16 years ago
"In your last formula, where does the number 26 come from?"
I checked what was one of the closest numbers to the edge of the circle.


Ha ha, that was probably because I have been trying all kinds of combinations.

Anyways, I just tried this again. I had tried this before:
r1=30/2
r2=20/2


It does not seem to work right. It says there is a Collision Detected everywhere except within close proximity to the other circle. Also, it still does not have to touch the other circle at all to trigger a change.
With a change in signs:

It simply is saying there is a collision when it is in the general area of the circle.

I notice that it is not centered right. Look how it detects it farther away on the left side then the right for some reason:
Left:

Right:



Here is my class sorry about the mess, I have been trying so many things:


[ October 22, 2007: Message edited by: Mark Quin ]
[ October 22, 2007: Message edited by: Mark Quin ]
16 years ago
I have 2 moving circles and I am trying to detect if they hit each other. I want to use some type of simple collision detection to find when they touch.

So far I have:
Circle 1 size = (20,20)
Circle 2 size = (30,30)
ax,ay = the x,y position of circle 1
bx,by = the x,y position of circle 2
dx=(ax-bx)^2
dy=(ay-by)^2

This one did not seem to work right at all.


This works some what, but not for all sides of the circle. Some spots the circles were not touching but it said that were.

How can I get it to check to see if the circles hit?
Also, if you know of any examples that work I would like to look at them. I have been trying all kinds of things. I have been trying for hours to get this to work right.

[ October 21, 2007: Message edited by: Mark Quin ]

[ October 22, 2007: Message edited by: Mark Quin ]
[ October 23, 2007: Message edited by: Mark Quin ]
16 years ago