Search found 625 matches

by Stonemonkey
Nov 16, 2020 20:27
Forum: Tips and Tricks
Topic: The missing DEC(uinteger, digits) function.
Replies: 4
Views: 555

Re: The missing DEC(uinteger, digits) function.

probably completely useless but convert to any base up to 16 (or higher by extending characters in var c) function convert_to_base(byval number as ulongint,byval _base as long, byval nDigits as uinteger=0)as string var c="0123456789ABCDEF" var ret="" while number>0 ret=mid(c,(num...
by Stonemonkey
Nov 16, 2020 19:40
Forum: General
Topic: Simple Text Compression
Replies: 2
Views: 225

Re: Simple Text Compression

And, say you have 4 character sets, then each switch would require 7 bits so 'Hallo World' would require 11*5+4*7=83 bits as opposed to the 88 bits that are required for 8 bit characters. Edit: sorry, I was getting a little mixed up with how it switched between the sets, the switch is 5 bits and the...
by Stonemonkey
Nov 16, 2020 19:18
Forum: General
Topic: Simple Text Compression
Replies: 2
Views: 225

Re: Simple Text Compression

'Hallo World' has upper and lower case which would require switching between the character sets so requires a few extra bits in the string, how many extra bits depends on how many sets you have, also, reducing each character size from 8 to 5 bits won't reduce 11 bytes to 5, it'll be just under 7 byt...
by Stonemonkey
Sep 10, 2020 21:50
Forum: General
Topic: INSTR()
Replies: 7
Views: 296

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: 582

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: 582

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: 5458

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: 338

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: 5458

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: 338

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: 338

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: 5458

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: 5458

Re: Number Trick

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

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: 5458

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...

Go to advanced search