Search found 458 matches

by j_milton
Oct 13, 2010 3:25
Forum: General
Topic: Modifying a function's return value more than once
Replies: 16
Views: 1375

agamemnus wrote:Well, that doesn't mean that there shouldn't be a way to access that variable whenever I feel like it...

You'd probably enjoy programing in FORTH, and I'm not being sarcastic when I say that, it is kind of a cool language. Sadly it is going to be slow compared to Freebasic.
by j_milton
Oct 13, 2010 3:14
Forum: Projects
Topic: Clasp Scripting Language for AI Enthusiasts
Replies: 45
Views: 6633

Now to successfully program an AI which fetishized the intrinsic "bad" would take a god, Actually no, just a decent back propagation learning model: http://www.willamette.edu/~gorr/classes/cs449/Classification/delta-3.gif http://www.willamette.edu/~gorr/classes/cs449/Classification/delta-4.gif http...
by j_milton
Oct 12, 2010 14:49
Forum: General
Topic: Trouble with types (solved)
Replies: 8
Views: 1216

There is no way to read a string into a #define, is there? No, #defines are resolved at compile time, not at run time. I now understand what you are trying to do. There are numerious possible solutions, but all of them are fairly complex. I'll try to write up something for you but it may take a few...
by j_milton
Oct 12, 2010 14:14
Forum: Projects
Topic: Clasp Scripting Language for AI Enthusiasts
Replies: 45
Views: 6633

Thats kind of cool. I too have been thinking of a scripting language for the game project, but of a very different sort, so we may have the basis for the first 2 battle bots.

I'll be interested in seeing how your 6 minutes research into neural nets pans out!
by j_milton
Oct 12, 2010 12:32
Forum: General
Topic: Modifying a function's return value more than once
Replies: 16
Views: 1375

Noooooo... You are all creating another variable, and setting the return variable at the end! I want to modify (set and get) the return variable more than once! I understood that, which is why I said that I did not know of a well behaved way to do it in my first reply. By well behaved I meant a met...
by j_milton
Oct 12, 2010 5:56
Forum: General
Topic: Modifying a function's return value more than once
Replies: 16
Views: 1375

I don't know of a well behaved way to do it, but what is wrong with the obvious:

Code: Select all

function myfunction() as uinteger
  dim as uinteger returnValue = 5
  returnValue += 2
  function = returnValue
end function

print myfunction ' Returns 7.
by j_milton
Oct 11, 2010 19:22
Forum: General
Topic: Uninitialized var-len arrays and L/UBound
Replies: 8
Views: 1571

it is intentional dim as integer x() means dimension x as an array of 1 location who's index is 0 I don't think so. Dim as Integer x() creates an array with 0 locations. "Print x(0)", "Print x(LBound(x))" or "Print x(UBound(x))" will make the program crash. But your workaround is a good idea! Thanl...
by j_milton
Oct 11, 2010 16:10
Forum: General
Topic: Trouble with types (solved)
Replies: 8
Views: 1216

Re: SQL interpreter

Hi, I was fascinated by SQL when i was at school so i was thinking about making my own SQL interpreter. I thought i knew enough to do this, but when i started programming, i came across a big problem. The next code was a test to start programming this. Type TABLE COLUMN1 As String * 20 COLUMN2 As S...
by j_milton
Oct 11, 2010 0:40
Forum: General
Topic: Question on losing memory when using strings / zstrings
Replies: 6
Views: 743

Nope, it will likely compile, but it has issues. As far as I can see, and goodness knows I may be wrong... Inside function abc this assignment is o.k. pzstrA = pzstrArg since pzstrArg is passed in as a calling parameter but this construct: function abc ... dim strB as String ... pzstrA = StrPtr(strB...
by j_milton
Oct 10, 2010 13:13
Forum: General
Topic: Calculation of Pi
Replies: 27
Views: 2064

Re: Calculation of Pi

This was a fun project I did 40 years ago in high school (NCR computer with IBM punch cards. One run per day!). How many ways can you come up with to compute a numerical estimate of Pi? A variation on your original, no "sqr" but does use "rnd" Dim As Double x, y, t1, t2, pi Dim As Integer count Ran...
by j_milton
Oct 09, 2010 22:13
Forum: General
Topic: Calculation of Pi
Replies: 27
Views: 2064

The PiHex project calculated pi in binary form to a number with 1,000,000,000,000,000 bits. You will be happy to know that The Quadrillionth Bit of Pi is '0'! Source code can be found at the site's home page here http://oldweb.cecm.sfu.ca/projects/pihex/index.html This is "probably" enough for most ...
by j_milton
Oct 09, 2010 17:38
Forum: General
Topic: Verify and/or improvement
Replies: 8
Views: 1312

agamemnus wrote:Nice work... is *arg being 0 at the end just an incidental quirk or a documented feature? Is it just reaching the (initialized as 0) result value when it hits "0"?

Ren's method requires you to have the last argument you pass when you call the function be a "dummy" with a value of 0
by j_milton
Oct 08, 2010 23:50
Forum: General
Topic: Question on losing memory when using strings / zstrings
Replies: 6
Views: 743

@wallyg: I don't think dkl said anything which differs from what I tried to express with my 3 "rules", but there was a lot of what if's in your last post that were sort of vague, and clever as the compiler may be in trying to error on pointer stuff that's evil, it is "pointer stuff" and I never ceas...
by j_milton
Oct 08, 2010 21:09
Forum: General
Topic: Question on losing memory when using strings / zstrings
Replies: 6
Views: 743

as far as I know there are 3 which apply to all dynamic memory objects not just strings: 1) if you create it using allocate or callocate free it, only using deallocate 2) if you create it using new free it, only using delete 3) if rule 1 or 2 do not apply then the compiler will take care of it
by j_milton
Oct 08, 2010 20:35
Forum: Tips and Tricks
Topic: Simple lightning bolt algo
Replies: 18
Views: 2472

Yep , you can in fact do

select case <expression>

so that could be somthing like

select case sqr(x)

or

select case lcase(mid(somestring, 3,7))

if you wanted

Go to advanced search