Search found 458 matches

by j_milton
Nov 07, 2010 17:40
Forum: General
Topic: Questions About Running Total
Replies: 16
Views: 1321

Re: Thanks!

Ok, that's great! Thank you very much both j_milton and badidea ! I think I have enough to get this project done now. And j_milton thank you for writing all of that code, I really appreciate it. I will rewrite it to avoid copying what you wrote. It's nice to know that there are knowledgeable people...
by j_milton
Nov 07, 2010 17:19
Forum: General
Topic: Questions About Running Total
Replies: 16
Views: 1321

+= is in the wiki here:
http://www.freebasic.net/wiki/wikka.php ... tPgOpIndex

you will see that there are others like -= , *= , &= , etc

a += 1

is the same as writing

a = a+1

it just saves a bit of typing, nice if you are using long variable names
by j_milton
Nov 07, 2010 2:51
Forum: General
Topic: Questions About Running Total
Replies: 16
Views: 1321

There are always various ways to solve a problem, here is an approach. It runs, but I have only written the human part of the game turn, not the computer part. See if it makes sense, ask if questions: 'game totals c is computer h is human: Dim As Integer gtotalc, gtotalh gtotalc = 0: gtotalh = 0 'As...
by j_milton
Nov 06, 2010 17:45
Forum: General
Topic: Questions About Running Total
Replies: 16
Views: 1321

this little bit of code may remove some confusion...

Code: Select all

Dim As Integer roll, total, count
Randomize, 3
total = 0
count = 0
Do While total <= 100
   roll = (Rnd * 5) + 1
   total += roll
   count += 1
   Print count, roll, total
Loop
sleep
by j_milton
Nov 06, 2010 2:30
Forum: Hardware Interfaces / Communication
Topic: Disco leds.
Replies: 2
Views: 2388

Re: Disco leds.

Yo! I'm using a universial laptop charger at 15volts. So i'm overloading the led strip by 3Volts since it's made for 12Volts but it's the only way to get enuff miliamps to power the 1meter led strip i'm using. The forward voltage drop across a silicon diode is 0.7 volts, so if you hook 4 in series ...
by j_milton
Nov 03, 2010 18:41
Forum: Beginners
Topic: How to do linked lists?
Replies: 15
Views: 1251

@bulrush: Here is a code fragment for single linked lists which I think covers all your points, if anything not clear please say Type node alive As Integer to_next As node Pointer Declare Sub something() 'not defined in this example End Type Type list head As node Pointer Declare Sub add_nod...
by j_milton
Nov 03, 2010 15:13
Forum: Beginners
Topic: How to do linked lists?
Replies: 15
Views: 1251

There are 2 flavors of simple linked list, single and double linked. In a single linked list each node has 1 pointer to the next node, in a double linked list each node has a pointer to the next node and a pointer to the prior node. Is this a concept you have used before? If so which sort of list do...
by j_milton
Nov 01, 2010 19:23
Forum: General
Topic: trouble with wstring ?
Replies: 2
Views: 396

According to the docs http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgConst in the case of the first three lines constant data can only be of type integer or floating-point or "normal" strings, but not, it seems, wstrings or wstring pointers. You can make the last one work like this Static shared...
by j_milton
Oct 30, 2010 22:20
Forum: Community Discussion
Topic: Is freebasic for the elite?
Replies: 39
Views: 4524

rolliebollocks wrote:@Rens

You should not trifle with me, I can use my godlike powers to cause your sperms to dry and with on the vine.
Image
by j_milton
Oct 30, 2010 21:51
Forum: Community Discussion
Topic: Is freebasic for the elite?
Replies: 39
Views: 4524

Re: Is freebasic for the elite?

Freebasic is open source but some of the members are not open minded. It looks like they know it all. If new ones or even older members post something then they are sometimes completely ignored or even humiliated. Maybe you have seen that there are members that are roaming the topics to showoff the...
by j_milton
Oct 27, 2010 22:20
Forum: Beginners
Topic: Question >>> Use of "Locate" in FB
Replies: 3
Views: 483

you have a few problems in your example. First: arrays by default as you have written in your example are 0 based i.e. the first location in each dimension is 0 not 1, so you are going out of range. Second: the print statement as you have written it will print some leading white space which will ove...
by j_milton
Oct 27, 2010 17:57
Forum: Tips and Tricks
Topic: Hash table generator
Replies: 13
Views: 2768

Your welcome

Cheers

John
by j_milton
Oct 27, 2010 17:37
Forum: Tips and Tricks
Topic: Hash table generator
Replies: 13
Views: 2768

@tjf: If you are going to use this in production code you may prefer this version, I've put error trapping in get_key and get_code as well, only slows the benchmark by about 1.25% Type key_table content As String Declare Function add_key(key As String, code As Integer) As Integer Declare Fun...
by j_milton
Oct 27, 2010 17:10
Forum: Tips and Tricks
Topic: Hash table generator
Replies: 13
Views: 2768

@ j_milton : Thanks for your interrest in the banchmarks. And thanks for your code. I like it, it's well structured. I had to add a line DIM AS STRING key = LCASE(T) to the key_table.get_code(T) function, to get comparable results for the banchmark. Fortunately, I didn't change the source of h_2_bi...
by j_milton
Oct 27, 2010 16:58
Forum: Tips and Tricks
Topic: Hash table generator
Replies: 13
Views: 2768

It's actually faster than I thought it would be. On my P4 machine it codes 1 million words randomly chosen from a list of 500 in 8.2 seconds. Benchmark: Type key_table content As String Declare Function add_key(key As String, code As Integer) As Integer Declare Function get_code(key As S...

Go to advanced search