Search found 1165 matches
- May 23, 2015 13:36
- Forum: General
- Topic: Position item in an array larger than 3D
- Replies: 94
- Views: 13859
Re: Position item in an array larger than 3D
scope const XSIZE = 3 const YSIZE = 2, YPITCH = XSIZE dim array(YSIZE-1, XSIZE-1) as integer => {{0,1,2},{3,4,5}} print "2 dimensions:" for i as integer = 0 to YSIZE*XSIZE - 1 var y = (i ) \ YPITCH var x = (i - y*YPITCH) print using "i:# y:# x:# array(y,x):#"; i; y; x; array(y, ...
- May 17, 2015 0:30
- Forum: Community Discussion
- Topic: Dim Byref syntax
- Replies: 134
- Views: 25951
Re: Dim Byref syntax
@grindstone Hi, it would not only alias named objects, but also things like, dim byref i as integer = *(some_complex_pointer_math) Other than superficial syntactic sugar, references give you a few guarantees that pointers don't: You're dealing with an actual object. Pointers can be invalid. You're d...
- May 16, 2015 17:28
- Forum: Community Discussion
- Topic: Dim Byref syntax
- Replies: 134
- Views: 25951
Re: Dim Byref syntax
I like the first syntax as well, very excited to see the development of this. :)
- May 15, 2015 16:56
- Forum: Sources, Examples, Tips and Tricks
- Topic: Text Scrambling
- Replies: 6
- Views: 2349
Re: Text Scrambling
Cool, glad you got some new things to think about. :) One of my favorite NES games uses a cipher like the ones we've posted to encrypt the passwords it gives you when you save the game. It was lots of fun to mess around with the debugger and figure out how the game was doing that, I even wrote a FB ...
- May 15, 2015 2:50
- Forum: Sources, Examples, Tips and Tricks
- Topic: Text Scrambling
- Replies: 6
- Views: 2349
Re: Text Scrambling
Hi. Randomize is used to seed the random number generator; a different seed will tell Rnd to produce a different sequence of random numbers. But if you use the same seed (our key ), Rnd will produce the same sequence. When you have time, look into hash functions; they take a stream of characters and...
- May 14, 2015 23:47
- Forum: Sources, Examples, Tips and Tricks
- Topic: Text Scrambling
- Replies: 6
- Views: 2349
Re: Text Scrambling
Hi, good observation about the wrap-around effect. :) If you want to play around with more ways to encrypt text, this is a good place to start: http://en.wikipedia.org/wiki/Cryptography http://en.wikipedia.org/wiki/Stream_cipher http://en.wikipedia.org/wiki/RC4 For example, here's a simple synchrono...
- May 14, 2015 11:06
- Forum: Sources, Examples, Tips and Tricks
- Topic: Josephus problem - Linked list example
- Replies: 9
- Views: 3715
Re: Josephus problem - Linked list example
Hi, here's another linked list version. const N = 41 const K = 3 const S = "The prisoner standing at position ## is eliminated. ## prisoner(S) eliminated." dim nextp(1 to N) as integer for i as integer = 1 to N-1 nextp(i) = i + 1 next i nextp(N) = 1 var eliminated = 0, skipped = 0 var p = ...
- May 13, 2015 0:17
- Forum: Beginners
- Topic: FreeBASIC variable initialization
- Replies: 14
- Views: 5835
Re: FreeBASIC variable initialization
RockTheSchock, I didn't know about the VAR keyword. Now I have tried it. This is almost what I want. But the VAR keyword is redundant. Why do I have to type four additional characters 'var '? The general idea is that it's better to be explicit with your intent. The compiler always knows the first t...
- Feb 07, 2015 7:17
- Forum: Community Discussion
- Topic: [offtopic]I'm old :-)
- Replies: 38
- Views: 9176
Re: [offtopic]I'm old :-)
Happy belated half-century D.J.Peters :)
- Jul 20, 2013 14:21
- Forum: General
- Topic: Function Ptr inside Function not recognised by ... [solved]
- Replies: 3
- Views: 1231
Re: Function Ptr inside Function not recognised by compiler
Just quickly looking over the code, _GetDriverVersion needs to be declared with the Shared keyword so that it can be accessed within procedures.
http://www.freebasic.net/wiki/wikka.php ... eyPgShared
http://www.freebasic.net/wiki/wikka.php ... eyPgShared
- Jun 27, 2013 11:53
- Forum: General
- Topic: Questions on inheritance in FreeBASIC
- Replies: 337
- Views: 69283
Re: Questions on inheritance in FreeBASIC
You could skip the run-time type checks by using some helper classes: ' two interfaces type Source extends Object declare abstract function ReadByte () as byte end type type Sink extends Object declare abstract sub WriteByte ( byval x as byte ) end type ' forward declaration type StringStream_ as St...
- May 07, 2011 2:20
- Forum: Beginners
- Topic: TYPE, and redim array in them
- Replies: 15
- Views: 5401
badidea, nice codes. Sometimes an allocator will allocate a little more memory at the beginning of the array for housekeeping info (sizes, ptrs to internal memory blocks, etc.) and simply return the address of the user data immediately following this housekeeping info. May be something to look into ...
- May 06, 2011 21:13
- Forum: Archive
- Topic: LLVM Headers
- Replies: 4
- Views: 2021
- May 06, 2011 17:03
- Forum: General
- Topic: VAL - 27 kb ?
- Replies: 14
- Views: 3143
- May 06, 2011 16:53
- Forum: General
- Topic: VAL - 27 kb ?
- Replies: 14
- Views: 3143