Search found 5589 matches

by counting_pine
May 04, 2021 14:00
Forum: Sources, Examples, Tips and Tricks
Topic: remove duplicates intries in an array
Replies: 25
Views: 4557

Re: remove duplicates intries in an array

Sorry, I phrased my suggestion badly, and made it sound like I meant the opposite of what I intended.
I agree, the length check is a great time saver. I also suggest that its cost is negligible enough that it’s not worth duplicating most of the code just for the purpose of skipping it.
by counting_pine
May 04, 2021 12:46
Forum: Sources, Examples, Tips and Tricks
Topic: remove duplicates intries in an array
Replies: 25
Views: 4557

Re: remove duplicates intries in an array

I wonder if skipping the length check will save enough time - compared to the lower case conversions and comparison - to be worth having an optimised routine for. I think a better optimisation would be to use a case-insensitive comparison routine, even if you have to implement it yourself. This save...
by counting_pine
May 03, 2021 9:58
Forum: Community Discussion
Topic: There is no reason anyone would want a computer in their home.
Replies: 11
Views: 1654

Re: There is no reason anyone would want a computer in their home.

“If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens ?” I like this one. It makes you think, because there are some cases where 1024 chickens would be preferable. If you have a large yard covered with chicken feed that you needed to clean up, would you rather us...
by counting_pine
Apr 29, 2021 13:27
Forum: Documentation
Topic: KeyPgString
Replies: 8
Views: 2260

Re: KeyPgString

I wonder if the info about allocate/new/delete etc. could go in its own section somehow. Most people reading the article won't be interested in how to store string descriptors in allocated memory, but nor do we want to remove that information. I can't remember off the top of my head, does the wiki s...
by counting_pine
Apr 28, 2021 13:38
Forum: Beginners
Topic: Text search of User Manual or Programmer's Guide
Replies: 20
Views: 2946

Re: Text search of User Manual or Programmer's Guide

You might find the forum thread at https://freebasic.net/forum/viewtopic.php?f=9&t=25527 useful. I tried to compile a list of every symbol use I could think of. I didn't provide doc links, but it at least gives you a clue of what to look for.
by counting_pine
Apr 26, 2021 13:20
Forum: General
Topic: Thanks GCC for warning
Replies: 10
Views: 959

Re: Thanks GCC for warning

FB shouldn't allow z to be used in an expression until after the Dim has finished initialising it. The problem is that the 'z' variable is visible to the compiler as soon as it is parsed, but isn't in a valid state until it's initialised. I remember trying to look into this a while back, but I could...
by counting_pine
Apr 25, 2021 13:59
Forum: General
Topic: Anyone able to use this with FreeBASIC?
Replies: 16
Views: 2065

Re: Anyone able to use this with FreeBASIC?

To be honest I didn't do this because I'm sure it's better if you reproduce the problems with the steps I have taken. Cutting and paste the issues serve nothing. There are a few advantages in posting the error messages: - for those who don’t take the time to replicate your steps, the error message ...
by counting_pine
Apr 24, 2021 13:29
Forum: General
Topic: Anyone able to use this with FreeBASIC?
Replies: 16
Views: 2065

Re: Anyone able to use this with FreeBASIC?

Looking at the example in the readme, it doesn't look to me like there's anything there that won't translate to FB.. /* init gui state */ struct nk_context ctx; nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font); enum {EASY, HARD}; static int op = EASY; static float value = 0.6f; ...
by counting_pine
Mar 20, 2021 15:07
Forum: Beginners
Topic: Comment after line continuation
Replies: 4
Views: 946

Re: Comment after line continuation

It may be worth just saying, a line with just a comment (or an entirely blank line) appearing after a continued line, is processed the same way as actual code would be: it's as if the preceding underscore (and anything on the line after it) is stripped away and the contents of the following line is ...
by counting_pine
Mar 03, 2021 12:53
Forum: Documentation
Topic: String index doc
Replies: 45
Views: 6992

Re: String index doc

A reference is basically anything with an address attached to it, such that it can (in theory) be assigned a value. This might be - for example - a variable, array index, or dereferenced pointer. To acknowledge the distinction from an expression without an address (e.g. '2+1'), you might call it an ...
by counting_pine
Mar 02, 2021 11:01
Forum: Documentation
Topic: String index doc
Replies: 45
Views: 6992

Re: String index doc

I think putting the words "numeric" and "reference" together can be confusing. The word "numeric" is presumably there to indicate that the value of a character is a number (rather than, say, a 1-character string). But this is unclear because it's in a different part of ...
by counting_pine
Feb 09, 2021 21:13
Forum: Game Dev
Topic: Conway's game of life
Replies: 14
Views: 3579

Re: Conway's game of life

I think that you will need to keep the state of arr(,) unmodified until you’ve finished checking for neighbours.
This probably means maintaining a separate copy of the array, or at least the last couple of columns of it (seeing that you are sweeping the array from the left to right).
by counting_pine
Feb 09, 2021 11:08
Forum: Community Discussion
Topic: make bootstrap fails on Debian 10 x86_64
Replies: 2
Views: 787

Re: make bootstrap fails on Debian 10 x86_64

Looks like you searched for the wrong header...
Try installing libgpm-dev.
There's a list of dependencies for Debian at DevBuildLinux. If you install all those, that should take care of any missing headers.
by counting_pine
Feb 05, 2021 11:37
Forum: Beginners
Topic: 8-bits per pixel greyscale palette
Replies: 9
Views: 1200

Re: 8-bits per pixel greyscale palette

It's fairly easy to set up a grayscale palette in 8-bit mode, using the Palette i, r, g, b syntax.

Code: Select all

ScreenRes(1280, 960, 8)

for i as integer = 0 to 255
  palette i, i,i,i
next i

for x as integer = 0 to 1279
  line (x, 0)-(x,959), x\5
next x

sleep
by counting_pine
Jan 28, 2021 15:37
Forum: Community Discussion
Topic: My_basic interpreter
Replies: 25
Views: 5302

Re: My_basic interpreter

Here's a rough translate of interp() to FB: function interp(sf as FILE ptr, script as ubyte ptr) as integer while true dim as integer code = setjmp(trap) select case code case 1 '' file syntax error if sf <> stdin then return 1 case 2 '' fault opc = pc case 3 '' "BREAK" if opc then pc = op...