Search found 622 matches

by Stonemonkey
Sep 10, 2020 21:50
Forum: General
Topic: INSTR()
Replies: 7
Views: 175

Re: INSTR()

Dunno if it's any use but you could get rid of leading 0's from a string of numbers with

new_string=str(val(old_string))
by Stonemonkey
Sep 10, 2020 8:01
Forum: General
Topic: Star Wars "Light Saber"
Replies: 15
Views: 380

Re: Star Wars "Light Saber"

I wonder what happens when you shine two lasers together , at a point away??.. Lasers can be focused to a point enough to cause the air to emit light at the point of focus, there are some videos on YouTube of some sort of projector doing this to create 3d images floating in the air made up of point...
by Stonemonkey
Sep 09, 2020 22:09
Forum: General
Topic: Star Wars "Light Saber"
Replies: 15
Views: 380

Re: Star Wars "Light Saber"

Not a lightsaber but you might find this of interest. No idea if it was a scam or if got anywhere.

https://youtu.be/zVn3q0mkijw
by Stonemonkey
Sep 08, 2020 5:29
Forum: General
Topic: Number Trick
Replies: 126
Views: 3985

Re: Number Trick

@Albert

for divide by 2 you shift right by 1, bit 0 of the high byte gets shifted into bit 7 of the low byte.
by Stonemonkey
Sep 07, 2020 20:09
Forum: Tips and Tricks
Topic: Triangle filler
Replies: 4
Views: 227

Re: Triangle filler

Interesting idea D.J.Peters, I'm wondering if there's anything that could be done with the scanline buffer, like dithering or shading.
by Stonemonkey
Sep 06, 2020 15:15
Forum: General
Topic: Number Trick
Replies: 126
Views: 3985

Re: Number Trick

@albert, I like that, it's pretty good.
by Stonemonkey
Sep 05, 2020 18:59
Forum: Tips and Tricks
Topic: Triangle filler
Replies: 4
Views: 227

Re: Triangle filler

Can't compare at the moment so no idea how it'll compare, I have found though that float->int casts seem a bit slow with things I'm doing so I might take some of D.J.Peters advice and look into fixed point.
by Stonemonkey
Sep 05, 2020 15:19
Forum: Tips and Tricks
Topic: Triangle filler
Replies: 4
Views: 227

Triangle filler

The latest incarnation of my triangle filler modified from my own stuff for dealing with graphics buffers to be standalone, solid filled triangles, only for 32 bit graphics modes. sub fill_triangle(byval x0 as single,byval y0 as single,byval x1 as single,byval y1 as single,byval x2 as single,byval y...
by Stonemonkey
Sep 05, 2020 1:05
Forum: General
Topic: Number Trick
Replies: 126
Views: 3985

Re: Number Trick

@albert
Any chance you could make a game of some sort in freebasic?
by Stonemonkey
Sep 04, 2020 21:41
Forum: General
Topic: Number Trick
Replies: 126
Views: 3985

Re: Number Trick

Does that work for other numbers?
by Stonemonkey
Sep 03, 2020 21:49
Forum: General
Topic: Number Trick
Replies: 126
Views: 3985

Re: Number Trick

@albert If you want abc² and you want to deal with a,b,c as the individual digits then it's a²b²c² + (a*b)*2000 + (a*c)*200 + (b*c)*20 So 123² is 010409 + (1*2)*2000 -> 4000 + (1*3)*200 -> 600 + (2*3)*20 -> 120 =10409+4720=15129 Which is almost what you're last post was, but it comes from what I pos...
by Stonemonkey
Sep 03, 2020 1:04
Forum: General
Topic: Number Trick
Replies: 126
Views: 3985

Re: Number Trick

@albert Why not try making it a rule not to celebrate until you've tested further, see if you can break what you're doing using other values, write a program to test your functions and get it to loop through every possible combination to test your function and count how many times it passes/fails. I...
by Stonemonkey
Sep 02, 2020 17:53
Forum: General
Topic: Number Trick
Replies: 126
Views: 3985

Re: Number Trick

@albert

Here's one I use on the 6502 since it doesn't have any multiply instruction, it uses pre calculated tables of squares so is quick to lookup with just some addition and subtraction

a*b=((a+b)²-(a-b)²)/4
by Stonemonkey
Sep 01, 2020 6:16
Forum: General
Topic: Number Trick
Replies: 126
Views: 3985

Re: Number Trick

You're also having to square each digit. With 3 digits it can be done with just 123*123 1*12300+ 2*1230+ 3*123 =15129 But in that you have 1*12300=(1*1*10000+1*2*1000+1*3*100) 2*1230=(2*1*1000+2*2*100+2*3*10) 3*123=(3*1*100+3*2*10+3*3) Where for part of that you have each digit squared and shifted, ...
by Stonemonkey
Aug 31, 2020 22:52
Forum: General
Topic: Number Trick
Replies: 126
Views: 3985

Re: Number Trick

@Albert, 16 bit squares, there'll be other ways too. dim as ulong v=12345 print v*v dim as ulong t=v,square while v>0 square+=t and - (v and 1) v shr=1 t shl=1 wend print square sleep end or dim as ulong square,v=12345 print v*v for i as long=0 to 15 square+=(v shl i) and - ((v shr i) and 1) next pr...

Go to advanced search