Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - psygate

Pages: [1] 2 3 4
1
I'd say, you need two points of the rectangle, make a line-equation between them and check whether the ballradius hits or not... I'll try to code that, don't expect too much by now. :inspired:

2
ok, you need some variables:

ay, the acceleration in direction to the ground (alway positive)
ax, the acceleration with which the ball's moving in x direction (neg. or positive)
vy, the velocity in y direction
vx, the velocitiy in x direction

now that you have your varialbes, just use them!

vx+=ax
vy+=ay

And if the ball hits the ground, just mulitply vy with -1 so (if vx=ground then vx*=-1)

excuse my shitty text, but I just had an migraine attack and haven't recovered yet...

If you have any more questions, just post.

3
Ok, I found a little but grave glitch in the system. If the decimals after the point are with leading zero(s), it won't output them. I'll repost the code now with that bug fixed, anyone interested in the mathematical theory behind it?  :D

Code: [Select]
cconv(q as double,s as uinteger) 'q = Number you'd like to convert
           's = System to which you'd like to convert
           
dim as integer d,c
dim as double q
dim as string o,u,r(36),lz
declare function modulo(byval x as double,byval y as double) as double

for c=0 to 9
    r(c)=str(c)
next
for c=asc("a") to asc("z")
    r(c-asc("a")+10)=chr(c)
next

d=int(q)
q-=d

while modulo(q,1)<>0
    q*=s
    lz+="0"
wend

while q<>0 or d<>0
    if q<>0 then
        p=modulo(q,s)
        o=r(p)+o
        q=int(q/s)
    elseif d<>0 then
        q=modulo(d,s)
        u=r(p)+u
        d=int(d/s)
    end if
wend

print u+"."+lz+o

function modulo(byval x as double,byval y as double) as double
 return x-y*int(x/y)   
end function

sleep

4
According to my program pi in hexadecimal is:
3.243f6a8885a6

according to a homepage about bourwine pouffle algorithm:

hexadezimal (16er-System):
pi = 3,243F6A8885A308D313198A2E03707344A4093822299F31D00...

must be working  :D ;D

5
Now, I found a way, I think it's pretty simple, but I'd like to share my incredibly deep insights into maths with you.

Excuse the shitty code, but it's late.

(in FreeBasic written)

Code: [Select]
cconv(q as double,s as uinteger) 'q = Number you'd like to convert
           's = System to which you'd like to convert
           
dim as integer d,c
dim as double q
dim as string o,u,r(36)
declare function modulo(byval x as double,byval y as double) as double

for c=0 to 9
    r(c)=str(c)
next
for c=asc("a") to asc("z")
    r(c-asc("a")+10)=chr(c)
next

d=int(q)
q-=d

while modulo(q,1)<>0
    q*=s
wend

while q<>0 or d<>0
    if q<>0 then
        p=modulo(q,s)
        o=r(p)+o
        q=int(q/s)
    elseif d<>0 then
        q=modulo(d,s)
        u=r(p)+u
        d=int(d/s)
    end if
wend

print u+"."+o

function modulo(byval x as double,byval y as double) as double
 return x-y*int(x/y)   
end function

sleep

the code needs improvement, so if you find time, please have a look at it and improve it, I don't know how, but it could be that it makes mistakes at some points, I'll have a look at it as soon as I find time too do so.

6
Well, the Memory shouldn#t be the problem  :D I could store it as a string, or as a long integer base and a integer exponent, so, if I got that right, the simple formula is:

Code: [Select]

a=number to convert
b=basesystem
c=0 'exponent
output=returnstring
while a<>0
 digit=a*base^c mod basesystem
 c+=1
 output=output+string(digit)
wend

7
I have a really stupid question. I'd like to convert numbers from the decimal system to others (like hexadecimal, binary usw.) but I encountert a problem and I couldn't fix it.

If I take a whole number the case is clear to me, I can put every whole number like 1,2,3,4.... into another system BUT, and that's what bothers me, I can't "translate" numbers which are not whole, f.e.: 3,1415 or 0,12723. Who can I translate these positions after the decimal point?

8
Did I get that right, that you'd like to do something like the Caesar-Chiffre??

9
Freebasic / Re: Neural Networks
« on: April 28, 2007 »
I managed to program a network which actually does what I want, but it doesn't learn. My XOR-Network just... tries every possbile configuration of weights and then pics the right one, actually, it's not more intelligent than a fucking normal program. :'( :-\

I'll jsut post it for fun,

Code: [Select]
'Simple "Neural Network" by psygate
'Solving the XOR-Problem, which can't be solved by a perceptron.
'At the moment... It's a very very stupid network and doesn't learn anything.
'
'Activation function is just a binary one. 0 or 1.
'Weights are chosen by random.
'2 input and 1 output neuron.

'Sorry for the shitty code!

randomize timer
option explicit

dim as integer a,b,c,d,t
const numofneuro=5

type neuron
    pot as double                                               'Activation potencial
    weight(numofneuro) as double                                'Weight of Synapses to other neurons
    threshold as integer                                        'Activation Threshold
end type

declare function process(a as ubyte,b as ubyte) as ubyte
dim shared as neuron n(numofneuro)

while t<>1
    for a=1 to numofneuro                                       'Initialize every neuron
        with n(a)
            .pot=0                                              'Set potencial to 0
            .threshold=.5                                       'Set an appropriate threshold
        end with
        for b=1 to numofneuro
                if b<>a then
                    n(a).weight(b)=(-1)^int(rnd*2)*int(rnd*3)   'Initialize synapses weight.
                else
                    n(a).weight(b)=0                            'Prohibits loops from neuron1 to neuron1
                end if
        next b
    next a
    if process(0,0)=0 and process(1,0)=1 and process(0,1)=1 and process(1,1)=0 _
    then t=1
wend

for a=1 to numofneuro
    for b=1 to numofneuro-1
        if b<>a then print n(a).weight(b)
    next
next
sleep

function process(a as ubyte,b as ubyte) as ubyte
    dim as integer l,m
    n(1).pot=a
    n(2).pot=b
    for l=1 to  numofneuro
        for m=1 to numofneuro
            n(m).pot+=n(l).weight(m)*n(l).pot
        next
    next
    return n(numofneuro).pot
end function


10
Freebasic / Neural Networks
« on: April 27, 2007 »
I need really help. As I know, you're very experienced programmers and I'm, I'm just not. ;)

Could someone help me and give me the source of a neural network solving the XOR Problem? (post if you need further information!)

THX

11
Freebasic / Re: Beginer to Freebasic need help.
« on: March 20, 2007 »
You'd like to start with Freebasic? Great :D

I could help you, since I'm a beginner too, if you have any questions I'd be happy to help you!

Bdw, if you need some tutorials on the basic language, you can also use the qbasic tuts, since freebasic is in most of its functions compatible to qbasic!

12
Freebasic / Re: Really cute typer.
« on: March 17, 2007 »
Very nice effect! I love it, though some letters are hard to read. :2funny:

13
General coding questions / Re: real big numbers
« on: March 15, 2007 »
No  :D I'd like to learn thew maths behind the magic of working with real big numbers, but the purebasic bigintlibreary could help me understanding that thing!

Thx

PS: Don't stop postin  ;D

14
General coding questions / real big numbers
« on: March 14, 2007 »
Hi again. I faced a real problem. I wanted to calculate a prime with about 300 digits, or in bits, 2048. But it's not possible with the normal compuiter arithmetics so could anyone refer me to a library (freebasic compatible) and give me a site where I can see how this thing with real big numbers works?

THX, Psy

15
Freebasic / Re: Cirlces Saver
« on: March 13, 2007 »
I'm Working on an effect like that where the circles changes into a square and so on, took my quite a while to fig out how to do that  ;D

16
Freebasic / Cirlces Saver
« on: March 11, 2007 »
So, after a god damn headcrash of my harddrive I'm finally back.

I wrote a little program to get bgack into programming, so have a look and please... I'd really appreciate if you could ignore that it's nothing special!  ;)

psy

17
Freebasic / Re: Really big numbers and RSA
« on: February 22, 2007 »
ok, but i need potention, roots, modulo, subtraktion, division... :-\

18
Freebasic / Really big numbers and RSA
« on: February 22, 2007 »
Hi!

I need some help...

I'd like to work with numbers with about 500 digits to program the RSA Cryption System. Could someone help me finding a library for such big numbers or ell me where I can find maths to work with them?

THX

19
GFX & sound / Re: Enjoy electonic music?
« on: January 12, 2007 »
I also know something like that. Just visit www.paniq.de

20
Freebasic / Re: speech in freebasic
« on: January 09, 2007 »
Good Work! I will use that voice from now on a bit  ;D

Pages: [1] 2 3 4