Search found 3826 matches

by BasicCoder2
Jan 22, 2024 0:15
Forum: Sources, Examples, Tips and Tricks
Topic: Fish aquarium
Replies: 18
Views: 1252

Re: Fish aquarium

Sprites do have an advantage in that they look nice, animation is simpler and overlap is easier to implement. Here is my take on using the graphic commands to draw the fish. I have drawn the collision rectangle around each fish however this can be commented out. 'some useful defines Const Pi = 4 * A...
by BasicCoder2
Jan 21, 2024 9:53
Forum: Sources, Examples, Tips and Tricks
Topic: Fish aquarium
Replies: 18
Views: 1252

Re: Fish aquarium

neil wrote: How could the code be changed so the fish can't swim backwards? You need two drawings, one for a fish moving left and one for a fish moving right. FreeBasic allows you to make use of bitmaps so you could use images. Here is a program that creates two images, one with a fish looking right...
by BasicCoder2
Jan 21, 2024 0:36
Forum: Sources, Examples, Tips and Tricks
Topic: Langton's ant
Replies: 27
Views: 1813

Re: Langton's ant

badidea, Your ants finding food reminded me of the agent based programs I played with some years ago now. In this example the agents find mushrooms and return them to their home. They "wander" about until they find a mushroom and then use astar16 routine to find their home. This also inclu...
by BasicCoder2
Nov 14, 2023 16:04
Forum: General
Topic: slow to execute after compiling source code
Replies: 11
Views: 1182

Re: slow to execute after compiling source code

Turning off real time protection fixed the issue!!
However that apparently means leaving it vulnerable to malware.
Also it says after a short time it will turn it back on automatically.
by BasicCoder2
Nov 14, 2023 15:52
Forum: General
Topic: slow to execute after compiling source code
Replies: 11
Views: 1182

Re: slow to execute after compiling source code

shadow008 It doesn't make any difference. If the lines with getImage or saveImage are commented out it compiles and runs immediately otherwise it compiles and there is a 4 to 5 second delay before it runs. The bload and bsave doesn't delay the running of the program. Most strange... screenres 860,48...
by BasicCoder2
Nov 13, 2023 15:51
Forum: General
Topic: slow to execute after compiling source code
Replies: 11
Views: 1182

slow to execute after compiling source code

When I Compile/Run the source code below it compiles quickly but takes some time before it starts to execute the code? I am using the FBIDE. I tracked it down to two lines. One which calls a routine to load a bitmap and convert it into a ulong array and another line that calls a routine to convert a...
by BasicCoder2
Oct 15, 2023 3:56
Forum: General
Topic: double trouble
Replies: 42
Views: 4957

Re: double trouble

srvaldez Floating points numbers gives you a wide range of numbers but I am working with a small range of numbers so probably I could just use integers. It was just that the neural net examples used floating points but when I printed them out I was suprised how some of the numbers came out. I am run...
by BasicCoder2
Oct 15, 2023 2:04
Forum: General
Topic: double trouble
Replies: 42
Views: 4957

Re: double trouble -resolved?

srvaldez wrote: "I don't get why you don't understand that this is a limitation of binary floating point, you can't expect binary FP to behave as if it were decimal FP" Probably because I am a self taught hobby programmer with limited math skills? I do remember going through an explanation...
by BasicCoder2
Oct 15, 2023 0:59
Forum: General
Topic: double trouble
Replies: 42
Views: 4957

Re: double trouble - continue

Now what !! I am using single values.

Code: Select all

for w as single = 0.0 to 1.0 step 0.1
    print w
next w
sleep
output:

0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8000001
0.9000001
by BasicCoder2
Oct 15, 2023 0:40
Forum: General
Topic: double trouble
Replies: 42
Views: 4957

double troubles

deltarho[1859] I changed the subject title to better reflect the issue. At least now I am aware of the issue (bug?). Yes I guess I could just use single variables. I thought single still used the same number of bytes as double in a 64 bit processor? I think the TIMER value has to be stored as a doub...
by BasicCoder2
Oct 13, 2023 17:59
Forum: General
Topic: double trouble
Replies: 42
Views: 4957

Re: round to two digits?

Thank you for everyone giving suggestions. I had been using print using but still wanted to know what was going on. They are weight values in a neural network. deltarho[1859] That also works for printing the result but doesn't explain why it has to add that extra stuff when I convert back to a doubl...
by BasicCoder2
Oct 09, 2023 1:46
Forum: General
Topic: double trouble
Replies: 42
Views: 4957

double trouble

I have a list of variables. dim shared as double w1(0 to 7) I assign a value like this, w1(i) = int(rnd(1)*200)-100 if w1(i)<>0 then w1(i)=int(w1(i))/100 end if And often get more than two digits after the floating point. -0.9300000000000001 How do I make sure I only get two digits after the floatin...
by BasicCoder2
Aug 01, 2023 4:25
Forum: Community Discussion
Topic: ChatGPT
Replies: 23
Views: 4361

Re: ChatGPT

Dr_D What was the actual wording of the text question (request?) you gave to chatGPT for it to generate the code? I modified this section to make it clear what the code was doing. ' ... line temp1,(280,180)-(380,340),rgb(255,255,0),bf 'draw a rectangle dim as double ang do ang+=.1 Rotozoom( temp1, t...
by BasicCoder2
Jul 24, 2023 15:37
Forum: Sources, Examples, Tips and Tricks
Topic: staged fireworks (July 24 u2)
Replies: 22
Views: 3145

Re: staged fireworks (July 24)

@dafhi wrote: "be sure to try out the quality / stereo settings near the top" I had to move away from the screen to do the cross eyed technique. Usually I look beyond the screen. Have you used those auto stereograms? https://www.vision-and-eye-health.com/autostereograms.html The cross eyed...
by BasicCoder2
Jul 24, 2023 8:26
Forum: Sources, Examples, Tips and Tricks
Topic: staged fireworks (July 24 u2)
Replies: 22
Views: 3145

Re: staged fireworks (July 23)

Looks good. All it needs now is sound and smell of smoke :)
https://youtu.be/XHi7UpUctWA