A new section for FreeBasic on The Joyful Programmers forum
-
- Posts: 1
- Joined: May 09, 2017 18:12
A new section for FreeBasic on The Joyful Programmers forum
Hello, FreeBasic Community!
I just signed up today to this community so I could reach out to all of you to let you know I have recently added a category on my programming forum just for FreeBasic. While there aren't any FreeBasic samples in that category at the time of this writing, I would like to invite everyone over to "check us out".
My programming forum, called (at this time), "The QB64 Edition" started out as a forum just for the QB64 programming language. Over the last year or so, it has been suggested to me by many of my members that I should branch out and add more categories for other programming languages to the site, since we all talk about many of them. I recently had a member who posted a FreeBasic demo on the forum and I was inspired to add the FreeBasic category. This same member asked if someone would let this community know about the new category, so I decided to go ahead and do that myself.
You can find my forum, "The QB64 Edition" at: http://www.TheJoyfulProgrammer.com/qb64/forum/
The funny thing is, I have downloaded FreeBasic so many times over the years, and I never seem to get around to using due to one project or another. Maybe this will put the fire up under me to start using it, in case any of my members need help.
Walter Whitman
The Joyful Programmer
http://www.TheJoyfulProgrammer.com
I just signed up today to this community so I could reach out to all of you to let you know I have recently added a category on my programming forum just for FreeBasic. While there aren't any FreeBasic samples in that category at the time of this writing, I would like to invite everyone over to "check us out".
My programming forum, called (at this time), "The QB64 Edition" started out as a forum just for the QB64 programming language. Over the last year or so, it has been suggested to me by many of my members that I should branch out and add more categories for other programming languages to the site, since we all talk about many of them. I recently had a member who posted a FreeBasic demo on the forum and I was inspired to add the FreeBasic category. This same member asked if someone would let this community know about the new category, so I decided to go ahead and do that myself.
You can find my forum, "The QB64 Edition" at: http://www.TheJoyfulProgrammer.com/qb64/forum/
The funny thing is, I have downloaded FreeBasic so many times over the years, and I never seem to get around to using due to one project or another. Maybe this will put the fire up under me to start using it, in case any of my members need help.
Walter Whitman
The Joyful Programmer
http://www.TheJoyfulProgrammer.com
-
- Posts: 2958
- Joined: Jun 02, 2015 16:24
Re: A new section for FreeBasic on The Joyful Programmers forum
The look of your forum is very pretty. Maybe you can signal it also to the german forum that gather a lot of good fb ressources and people:Waltersmind wrote: You can find my forum, "The QB64 Edition" at: http://www.TheJoyfulProgrammer.com/qb64/forum/
FreeBasic.de
Re: A new section for FreeBasic on The Joyful Programmers forum
hello Waltersmind
I joined your forum and posted my jump a peg game
very cool forum
ps when i try to update my profile i get an error
Please correct the following errors before continuing:
Please choose a valid birthday privacy option.
i was not able to figure out where or how to enter my birthday
I joined your forum and posted my jump a peg game
very cool forum
ps when i try to update my profile i get an error
Please correct the following errors before continuing:
Please choose a valid birthday privacy option.
i was not able to figure out where or how to enter my birthday
Re: A new section for FreeBasic on The Joyful Programmers forum
Ah finally!
I was looking forward to this post for weeks!
What was hold up? my first post only took 2 days to clear.
Tourist Trap had reply the 13th? how did I miss that?
Maybe I was thinking it would be an Announcement.
Maybe I am old. dang!
Well at least I spotted Owen.
We found out there might be a problem copying a snippet from forum and pasting into (I am using) FbEdit 1068.
A number of ? are getting inserted. I don't know if it is a forum issue or editor issue but the was no problem copy/pasting from another link with the same source.
So if someone is posting code at The Joyful programmers forum, they might want to attach a copy of their source along with all the other files they like.
I was looking forward to this post for weeks!
What was hold up? my first post only took 2 days to clear.
Tourist Trap had reply the 13th? how did I miss that?
Maybe I was thinking it would be an Announcement.
Maybe I am old. dang!
Well at least I spotted Owen.
We found out there might be a problem copying a snippet from forum and pasting into (I am using) FbEdit 1068.
A number of ? are getting inserted. I don't know if it is a forum issue or editor issue but the was no problem copy/pasting from another link with the same source.
So if someone is posting code at The Joyful programmers forum, they might want to attach a copy of their source along with all the other files they like.
Re: A new section for FreeBasic on The Joyful Programmers forum
The QB64 Edition / 1st Annual 100 Line-of-Code Programming Language Competition
http://www.thejoyfulprogrammer.com/qb64 ... 1701461945
I'm going write something in Freebasic. Something other then my fbcadcam-macro.
Hope to see you there.
Have fun, that's what it's all about.
http://www.thejoyfulprogrammer.com/qb64 ... 1701461945
I'm going write something in Freebasic. Something other then my fbcadcam-macro.
Hope to see you there.
Have fun, that's what it's all about.
Re: A new section for FreeBasic on The Joyful Programmers forum
Now here's the plan see...
We need to move on (in a forward direction)
Get back on track as a community, see...
But let's not forget about our past...
Episode 6: Computer Languages
Bits and Bytes TVO
https://www.youtube.com/watch?v=0Ttw9ks05G4
and..
Fundamentals of Programming Languages
By Horowitz, E.
ISBN 978-3-642-69406-6
© 1984
Excerpt copied from http://www.springer.com/la/book/9783642694080
The development of programming languages is one of the finest intellectual achievements of the new discipline called Computer Science.
I got to get a copy of this book.
We need to move on (in a forward direction)
Get back on track as a community, see...
But let's not forget about our past...
Episode 6: Computer Languages
Bits and Bytes TVO
https://www.youtube.com/watch?v=0Ttw9ks05G4
and..
Fundamentals of Programming Languages
By Horowitz, E.
ISBN 978-3-642-69406-6
© 1984
Excerpt copied from http://www.springer.com/la/book/9783642694080
The development of programming languages is one of the finest intellectual achievements of the new discipline called Computer Science.
I got to get a copy of this book.
Re: A new section for FreeBasic on The Joyful Programmers forum
Here is an example of what I might write for the contest. I think this is a good idea because arrays are difficult to interpret and manage.
'program language name: Simple Interpreted Basic
'keyword commands used: Variable, Array, Set, Print, Copy, Add, To
'example code to be interpreted:
Variable i1
Variable i2
Array ia1
Array ia2
Set i1 1
Set ia1 0 1 2 3 4 5
Print i1
Print ia1
Copy i1 To i2
Copy ia1 To ia2
Print i2
Print ia2
Add i1 To i2
Add ia1 To ia2
Print i2
Print ia2
Add i1 To ai1
Print ai1
'program language name: Simple Interpreted Basic
'keyword commands used: Variable, Array, Set, Print, Copy, Add, To
'example code to be interpreted:
Variable i1
Variable i2
Array ia1
Array ia2
Set i1 1
Set ia1 0 1 2 3 4 5
Print i1
Print ia1
Copy i1 To i2
Copy ia1 To ia2
Print i2
Print ia2
Add i1 To i2
Add ia1 To ia2
Print i2
Print ia2
Add i1 To ai1
Print ai1
Last edited by owen on Jun 04, 2017 23:48, edited 2 times in total.
Re: A new section for FreeBasic on The Joyful Programmers forum
Example of how to do this using FreeBASIC
First I would load the source code to be interpreted and then check each line for what it's supposed to do
First I would load the source code to be interpreted and then check each line for what it's supposed to do
Code: Select all
'Simple Interpreted Basic"
Dim As String temp, variable_name(0), array_name(0)
Dim as integer variable_value(0), variable_count, array_1d_value(0,0), array_1d_count
Open "source_code.txt" for input as #1
Do While Not EOF(1)
Line Input #1, temp
If Lcase( Left(temp,8) ) = "variable" then
variable_count+=1
Redim Preserve variable_value(variable_count)
Redim Preserve variable_name(variable_count)
variable_name(variable_count) = Mid(temp,10)
End If
If Lcase( Left(temp,5) ) = "array" then
array_1d_count+=1
Redim Preserve array_name(array_1d_count)
Redim Preserve array_value(array_1d_count,0)
array_name(array_1d_count) = Mid(temp,7)
End If
If Lcase( Left(temp,3) ) = "set" then
'here is where we would need to find the variable name or array name but first I need to parse temp string
'extracting the variable name from the line of text.
'we need to find the the first space " " after the variable name.
tempvn=Mid(temp,5,Instr(6,temp," ")-5)
For i = 1 to variable_count
If tempvn = variable_name(i) then
variable_value(i)=Val(Mid(temp,5+Len(tempvn)))
Exit For
End If
Next
For i = 1 to array_count
If tempvn = variable_name(i) then
array_1d_count+=1
'now here is where would need to find the array length
array_values=Mid(temp,5+Len(tempvn))
array_length+=1
For i = 1 to Len(array_values)
if Mid(array_values,i,1)=" " then array_length+=1
Next
If array_length > max_array_length then max_array_length = array_length
Redim Preserve array_1d_value(array_1d_count,max_array_length)
'now we can set the values
c=0
temp_array_value=""
For i = 1 to Len(array_values)
temp_array_value += Mid(array_values,i,1)
if Mid(array_values,i,1)=" " then
c+=1
array_1d_value(array_1d_count,c)=val(temp_array_value)
temp_array_value=""
end if
Next
Exit For
end if
Next
End If
If Lcase( Left(temp,5) ) = "print" then
...
end if
If Lcase( Left(temp,4) ) = "copy" then
...
end if
If Lcase( Left(temp,3) ) = add" then
...
end if
loop
Re: A new section for FreeBasic on The Joyful Programmers forum
I was watching some MIT lectures while researching the idea of creating a new programming language and the one key point the professor spoke of was that it would need to have at a minimum, associative arrays as a standard data type.
I searched the FB forum and found several discussions of which I will continue investigating so no need to post links to those discussions in order to help me understand the concept. Rather if some can respond to my following question:
What is the difference between an associative array and multidimensional array?
I mean couldn't one just use a 2d array to handle:
Name, Owen
Status, Beginner
IQ, Low
Age, Old
Dim as String A(records,4)
I searched the FB forum and found several discussions of which I will continue investigating so no need to post links to those discussions in order to help me understand the concept. Rather if some can respond to my following question:
What is the difference between an associative array and multidimensional array?
I mean couldn't one just use a 2d array to handle:
Name, Owen
Status, Beginner
IQ, Low
Age, Old
Dim as String A(records,4)
-
- Posts: 538
- Joined: Jul 15, 2005 4:13
Re: A new section for FreeBasic on The Joyful Programmers forum
i THINK that they mean pointers when they say associative array. Like when you use TYPE...end TYPE
the difference is in common programming practice, none, however i think you can manipulate an array using its pointer...
lets say...
player(3) = which in turn keeps all players x,y,z values.
or...
type position
x as integer
y as integer
z as integer
end type
dim player as position
player.x=100
player.y=100
player.z=100
and i believe you can pass all variables to subs or functions using its pointer...and you can all add as many position definitions as you like...
like...
enemy.x
enemy.y
enemy.z...
just by using DIM ENEMY AS POSITION
it immediately assigns or associates x,y,z to variable(pointer) ENEMY.
I should also mention i seldom use any type of pointers and all the voodoo magic programming,, but i believe that certain library's use it such as opengl, and in order to point the array of triangles to be drawn by the library, they need to be put into pointer format, but i could be wrong, its been quite a few years since i used it.
the difference is in common programming practice, none, however i think you can manipulate an array using its pointer...
lets say...
player(3) = which in turn keeps all players x,y,z values.
or...
type position
x as integer
y as integer
z as integer
end type
dim player as position
player.x=100
player.y=100
player.z=100
and i believe you can pass all variables to subs or functions using its pointer...and you can all add as many position definitions as you like...
like...
enemy.x
enemy.y
enemy.z...
just by using DIM ENEMY AS POSITION
it immediately assigns or associates x,y,z to variable(pointer) ENEMY.
I should also mention i seldom use any type of pointers and all the voodoo magic programming,, but i believe that certain library's use it such as opengl, and in order to point the array of triangles to be drawn by the library, they need to be put into pointer format, but i could be wrong, its been quite a few years since i used it.
Re: A new section for FreeBasic on The Joyful Programmers forum
thanks for the quick reply.
so instead of 2d arrays, one could use UDT's as another approach and it's basically the same thing?
so instead of 2d arrays, one could use UDT's as another approach and it's basically the same thing?
Re: A new section for FreeBasic on The Joyful Programmers forum
An associative array is an array of (key, value) pairs. So you could reference a name with a phone number...ie:owen wrote:I was watching some MIT lectures while researching the idea of creating a new programming language and the one key point the professor spoke of was that it would need to have at a minimum, associative arrays as a standard data type.
I searched the FB forum and found several discussions of which I will continue investigating so no need to post links to those discussions in order to help me understand the concept. Rather if some can respond to my following question:
Code: Select all
array("301-555-1212", "Vincent")
name = array("301-555-1212")
-Vince
Re: A new section for FreeBasic on The Joyful Programmers forum
The way i see that is:
function array(s() as string) as string
if ubound s()=1 then ' as in the case of name = array("301-555-1212")
find and return the next thing in a 1d string array after "301-555-1212"
else
add information to the 1d string array 'array("301-555-1212", "Vincent")
end if
end function
but still in order to implement such an idea it is not an array type in freebasic but rather would have to be a function or method etc...
and i suppose in other programming languages it's the same case.
function array(s() as string) as string
if ubound s()=1 then ' as in the case of name = array("301-555-1212")
find and return the next thing in a 1d string array after "301-555-1212"
else
add information to the 1d string array 'array("301-555-1212", "Vincent")
end if
end function
but still in order to implement such an idea it is not an array type in freebasic but rather would have to be a function or method etc...
and i suppose in other programming languages it's the same case.
Re: A new section for FreeBasic on The Joyful Programmers forum
array("301-555-1212", "Vincent")
name = array("301-555-1212")
dim as integer i
dim as string name
dim as string array(2)
array(1)="301-555-1212"
array(2)= "Vincent"
for i = 1 to ubound(array) step 2
if array(i)="301-555-1212" then
name=array(i+1)
exit for
next
name = array("301-555-1212")
dim as integer i
dim as string name
dim as string array(2)
array(1)="301-555-1212"
array(2)= "Vincent"
for i = 1 to ubound(array) step 2
if array(i)="301-555-1212" then
name=array(i+1)
exit for
next
Re: A new section for FreeBasic on The Joyful Programmers forum
using associative array presents the problem of duplicate keys where as indexed arrays have unique index numbers so adding sequential (unique) numbers to each record (object) could solve that problem but wouldn't it just be the same as indexed arrays?