|
Maybe so on this site... have you recently checked Rent A Coder? I see a lot of US students posting homework questions there...
|
|
|
|
|
ChandraRam wrote: I see a lot of US students posting homework questions there...
Are you sure they really are in the US? Could be somewheres else in the world and making it look like they are in the US...
|
|
|
|
|
Have you actually looked for yourself?
|
|
|
|
|
Tim Craig wrote: third world countries where the powers that be want to ship US jobs
They can go ahead and do so. Any company that feeds these people will be in for a rude awakening when they find out their IT staff is so incompetent they leech off of people like us.
|
|
|
|
|
It is sad to read this kind of statements here. Helping each other is the main purpose of these forums. Not comparing IT staffs
|
|
|
|
|
|
well, looks like no one here will help with the homework...
try this
private sub Commad1_click()
dim i as integer
for i=2 to 10 'why 2 cos 1 is not prime number
if i mod 2 =0 then debug.print i
next i
end sub
selamat berjuang....
|
|
|
|
|
AgusBudianto wrote: well, looks like no one here will help with the homework...
Because most of us here don't do people's homework for them. Your code does not work 100%.
|
|
|
|
|
ups my mistake, the code suppose to be something like this, sorry.. sorry..
for i=2 to 10
if i mod 2<>0 then debug.print i
next i
"if we dont want to help people, then don't at least don't say something rude to them" --how sad..
-- modified at 3:36 Sunday 3rd December, 2006
|
|
|
|
|
Hi I have spent the day looking at implementing RSA on the client side with javascript and on the server side with C#.NET.
I think I am overlooking something very simple and this is my problem. To make a key of 1024 bits requires a datatype to store it in. What datatype should i use, i considered byte[] but surely byte[]*byte[] is undefined (to create the key).
Any help will be greatly appreciated
Thanks
Dan
|
|
|
|
|
You need to find a library for integers of arbitrary length or write one yourself.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Write or find the class that will handel the 1024(or biger) bit long number.
if write see some algoritms like:
1) Baret reduction
2) Montgomeri multiplay
. . . .
you will ned them in class.
[ It will better if you write class]
|
|
|
|
|
My new project, I'm working on some path-finding algorithms for little AI
people. I have a grid of terrain heights and I have a pathing algorithm. The
trouble I'm having is how to weight the movement cost from one square to the
next. If moving across level terrain from one square to another is 1, how do
I cost uphill and downhill travel? I'm kinda stumped.
Also, moving diagonally is technically 1.41 in distance, should I cost it as such or just leave it as one for simplicity's sake? What are the pros and cons?
Any thoughts?
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
I think you should leave it as 1.41, otherwise you'll have funny results
Regarding height, maybe a cost formula like sqrt(deltaX^2 + deltaY^2 + (k*deltaZ)^2) might do
You could change the k coeff if climbing is more or less expensive than moving horizontally.
|
|
|
|
|
Wow. It never occured to me that the Pythagoreum thing worked in three dimensions. Thanks. That helps a lot.
My question is though, what to change the value of k to? If the target square is n higher or n lower, how do you cost it for the expense of climbing uphill, or downhill as compared to walking over level ground? I thought about giving it an arbitrary value based on the difference in terrain heights, but that seemed kinda clunky to me.
What I should do I suppose is find a chart on the internet of the amount of calories burned in walking as opposed to stair-climbing and wall-climbing. That might help.
Thanks again.
----------------------
...ten minutes later
Okay, I looked up the calorie charts and it turns out that stair-climbing is approximately double straight walking, and wall-climbing is approximate triple straight walking. So if I convert that to angles:
0 = 1
45 = 2
90 = 3
Now how do I convert that into a formula so that values in between return their appropriate costs?
I'll assume the values are the same for going down in terrain as well, though they might be slightly cheaper.
-- modified at 9:13 Thursday 9th November, 2006
cost = 1 + (angle / 45)
d'uh. I better get some coffee. Thanks all.
-- modified at 9:27 Thursday 9th November, 2006
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
I felt curious about the calories issue, i think it is a good idea of giving values to k I've found this link:
http://www.calorie-count.com/calories/activities/17.html
Regards
|
|
|
|
|
I figured it out. Thanks, kind sir.
k = 1 + (angle / 45)
Now to figure out how to calculate the angles...
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
Just remember your trig functions:
/|
h / |
/ | o
/ |
/ θ |
------
a I remember them with the mnemonic SOHCAHTOA:
SOH -> sin(θ ) = opposite / hypotenuse
CAH -> cos(θ ) = adjacent / hypotenuse
TOA -> tan(θ ) = opposite / adjacent
Then, to find the angle, you can use the inverse trig functions:
θ = asin(opposite / hypotenuse) = acos(adjacent / hypotenuse) = atan(opposite / adjacent)
In standard Cartesian coordinates, if the triangle is oriented as above with the origin located where θ is, then the adjacent side (a) is x, and the opposite side (o) is y. So, since you usually know x and y, there is no need to calculate the hypotenuse to find the angle, since you can then do θ = atan(y/x).
Be aware that the above identities are true only for radian angles. If you need degrees, then you must convert at the end using the identity 180 degrees = π (should be a pi, but it looks funny in my font) radians.
--
Marcus Kwok
|
|
|
|
|
I kinda wish I took Trig. I suck.
Thanks anyway.
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
Maybe the first part of this might help:
Trigonometry[^] at MathWorld.
Some of the stuff towards the bottom gets into some advanced stuff, but at the bottom of the page there are a bunch of links that you could follow that might help too.
--
Marcus Kwok
|
|
|
|
|
Okay. I think I got this...
So in this case, x would always be 1 (or 1.41 if it's diagonal), and y would be the difference of the current terrain height and the target terrain height?
No wait. That's not right. I'll have to figure out the ratio of x (being 1) to y (being anywhere from 0 to 255).
It sucks being almost a nerd, but not quite.
-----------------------------------------------
K... I went with an arbitrary ratio of 25:1. So if the difference is 255, that'll count as 10x (approximately). Hopefully that works.
Thanks all.
-- modified at 11:45 Thursday 9th November, 2006
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
I'm not quite sure what you mean... From your other post, I think the way you have your terrain is basically a matrix of heights (just random numbers I picked):
+---+---+---+---+
| 3 | 2 | 2 | 1 |
+---+---+---+---+
| 5 | 6 | 7 | 8 |
+---+---+---+---+
| 6 | 9 | 9 | 7 |
+---+---+---+---+
| 4 | 6 | 5 | 4 |
+---+---+---+---+ Say, you wanted to find the angle between the '6' cell and the '7' cell in the middle of the matrix. If you think about like you're looking at the matrix from the side (as if you were actually looking at the terrain, but more like a cross-section), then the second row would look like:
---
---/ 8
---/ 7
---/ 6
5 Assuming that the distance between cells (not counting diagonally) is 1 (as you said, for diagonally it should be sqrt(2)=1.414). So, if we just look at the 6 and 7 levels ("zoomed in"):
-----
/ 7
/
-----/
6 we can make the triangle:
-----
/| 7
/ |
-----/--+
6 So, I think you do want the difference in the terrain heights as your y.
--
Marcus Kwok
|
|
|
|
|
Yup. That's what I figured as well.
The question was, if the distance between 6 to 7 is 1, and the difference in heights is anywhere from 0 to 255, what ratio do I use to scale down 0 to 255 to corespond with the distance of 1 grid square. I went with 25:1 (arbitrarily).
Thanks for your help.
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
Well, I don't think you need to scale the y values to calculate θ...
Examples:
x=1, y=1:
θ = atan(1/1) = atan(1) = π / 4 = 45 degrees
x=1, y=255 (a very tall slope):
&theta: = atan(255/1) = atan(255) = 1.566 = 89.775 degrees (almost a vertical wall, which makes sense if you are going from a square at height 0 to a square at height 255.
--
Marcus Kwok
|
|
|
|
|
But what if it's 1.41, as is the case when going uphill diagonally? Does it still work?
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|