Search found 1991 matches

by badidea
Jun 01, 2020 20:49
Forum: General
Topic: Start a program just one time
Replies: 54
Views: 929

Re: Start a program just one time

Using the disk is not a simple alternative I think it is simple, just not a very good alternative. What if the disc is read-only? Fortunately I am in a privileged position to post a 'bad idea' now and then. @badidea: using the disk is similar using atoms! If you forget to cleanup or at app crash yo...
by badidea
Jun 01, 2020 14:21
Forum: General
Topic: Start a program just one time
Replies: 54
Views: 929

Re: Start a program just one time

A simple alternative: #include "file.bi" dim as string lockFileName = "lockFile.dat" if fileexists(lockFileName) <> 0 then print "Sorry, can not run twice" print "Found lock file: " & lockFileName else if open(lockFileName, for binary, as #1) = 0 then prin...
by badidea
May 31, 2020 20:02
Forum: Linux
Topic: No such file or directory
Replies: 4
Views: 67

Re: No such file or directory

ELF 32-bit LSB executable

Try the 64-bit fbc, that requires less extra libraries.
by badidea
May 31, 2020 19:54
Forum: Linux
Topic: No such file or directory
Replies: 4
Views: 67

Re: No such file or directory

Here, on Ubuntu mate 18.04, installed at the default location: /usr/local/bin/ Which is in the 'path' so I only have to type 'fbc' How did you install it? Did you read the 'readme.txt' and ran "sudo ./install.sh -i" as mentioned? It could be missing libs as well. Did you install 32 or 64 b...
by badidea
May 31, 2020 13:00
Forum: Beginners
Topic: help needed in FB OOP
Replies: 11
Views: 229

Re: help needed in FB OOP

I would not put the subs 'sAppend' and 'nAppend' inside the class/type. They are such general things that I would put the 2 in a separate .bas/.bi file for later projects to be included in as well.
by badidea
May 31, 2020 10:21
Forum: Beginners
Topic: help needed in FB OOP
Replies: 11
Views: 229

Re: help needed in FB OOP

I don't want to discourage OOP (very suitable for this, I think), but there are other ways to prevent code duplication. If the behaviour of your chat-bots depends on the data-file only (I did not check), you can just add the 'bot-Id' as an argument to the GetReply () function. And your data arrays n...
by badidea
May 30, 2020 11:50
Forum: Beginners
Topic: how to print a whole text file as a movie ending titles (from bottom to top)
Replies: 10
Views: 158

Re: how to print a whole text file as a movie ending titles (from bottom to top)

dodicat wrote:You use screen 19, then draw string.

I would have expected a Star Wars style credits scrolling form you :-)
Never mind, that has been done before: Another star wars like intro
by badidea
May 30, 2020 10:43
Forum: Beginners
Topic: how to print a whole text file as a movie ending titles (from bottom to top)
Replies: 10
Views: 158

Re: how to print a whole text file as a movie ending titles (from bottom to top)

The easy way is to let the console do the scrolling up: 'append to the string array the string item sub sAppend (arr() as string, item as string) redim preserve arr(lbound(arr) to ubound(arr) + 1) arr(ubound(arr)) = item end sub sub readfile(f as string, lines() as string) dim fline as string open f...
by badidea
May 30, 2020 9:49
Forum: Beginners
Topic: how to print a whole text file as a movie ending titles (from bottom to top)
Replies: 10
Views: 158

Re: how to print a whole text file as a movie ending titles (from bottom to top)

Works fine: 'append to the string array the string item SUB sAppend (arr() AS STRING, item AS STRING) REDIM Preserve arr(LBOUND(arr) TO UBOUND(arr) + 1) AS STRING '<-- as string not needed arr(UBOUND(arr)) = item end sub redim lines() as string '<--- not lines(0) sAppend lines(), "aaaaaaaa"...
by badidea
May 29, 2020 20:51
Forum: Game Dev
Topic: Yet Another Connect Four
Replies: 9
Views: 354

Re: Yet Another Connect Four

Although I dislike the monopoly of google I must confess I use it all the time. So you don't use any search engine? Although I used to gain all my knowledge through books Amazon has destroyed the ability of physical outlets to stock the technical books I used to buy and limited Australians access t...
by badidea
May 29, 2020 14:43
Forum: Game Dev
Topic: Yet Another Connect Four
Replies: 9
Views: 354

Re: Yet Another Connect Four

I don't google. But anyway, the recursive minimax algorithm only requires an evaluation of the board status (which is relative simple for connect 4) and should find the best move of all possible moves for a given depth. No further knowledge like strategies needed. For a search depth of ~8 or more th...
by badidea
May 27, 2020 18:05
Forum: Community Discussion
Topic: 15 years of freeBASIC forum?
Replies: 7
Views: 249

15 years of freeBASIC forum?

It seems that today this forum exists 15 years. Based on the sysop account created on 27 May 2005, 01:11 (memberlist.php)
That was when most of us were running Windows XP on a Pentium-4 or an Athlon XP computer. Ubuntu existed for only 1 year and I had no grey hair yet.
by badidea
May 27, 2020 0:24
Forum: Game Dev
Topic: Yet Another Connect Four
Replies: 9
Views: 354

Re: Yet Another Connect Four

minimax algorithm working better now, but still not right. MAX_DEPTH must be even (2, 4, 6), but then still random acts of sagacity (<- WHAT IS going on? What is sagacity? I write stupidity_!). #include "simple_logger.bi" '-------------------------------------------------------------------...
by badidea
May 26, 2020 19:09
Forum: Beginners
Topic: smoking calculator
Replies: 6
Views: 223

Re: smoking calculator

It might be "common knowledge", but most smokers don't want to know these numbers and don't do the calculation. They are even more likely to light up another cigarette if they do because of the stressful thought.

Go to advanced search