17 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for Reverend Jim

This code generates an ascii maze of up to size 30x30. If you try to generate a larger maze then you will likely run out of stack space. There is no way to increase the size of the stack in vbscript. Each cell in the maze is represented by a …

Member Avatar for Reverend Jim
0
594
Member Avatar for BustACode
Member Avatar for vegaseat
Member Avatar for vegaseat
4
682
Member Avatar for Schol-R-LEA

One of the more common functions in any language is conversion of an integer to a string. This implementation, which demonstrates not only the common function activation record format but also a simple recursive function, was written in response to a recent question in which the OP posted an incomplete …

Member Avatar for Kiệt
0
7K
Member Avatar for mike_2000_17

Hi all, I was just playing around with some ideas about optimizing a core piece of my library: the run-time type identification system (RTTI). What does that have to do with compile-time string concatenation? Well, the whole point of the RTTI is to provide information on the type of objects, …

Member Avatar for mike_2000_17
6
12K
Member Avatar for TrustyTony

I [saw interesting problem](http://www.daniweb.com/software-development/legacy-languages/threads/478323/prolog) of generating spiral of numbers and realized I could reuse [my code for rotation](http://www.daniweb.com/software-development/python/code/371536/rotate-sequences-left-or-right) I posted earlier.

3
775
Member Avatar for Szabi Zsoldos

Raffle function to generate unique numbers for each player, related to the same table with a recursive aproach. I had to do a simple raffle system for a contest that I was working on and tried many things and the most simple and the most effective one to generate unique …

Member Avatar for diafol
0
893
Member Avatar for zeroliken

I bet all Computer Science related courses would learn low level or machine level languanges in due time and in our university we used the portable 80x86 assembler NASM for our Assembly code So here's my experimentation on how to use "functions" and recursion using a Fibonacci Solver as a …

0
1K
Member Avatar for TrustyTony

Here you see how one could use recursion together with generators for (inefficient) permutations generator. It is kind of interesting to know how one can do it recursively (of course there exist many ways). Anyway this snippet demonstrates how you can use recursive generator call to feed a for statement. …

0
431
Member Avatar for TrustyTony

Here slightly edited code from one of my earliest posts to DaniWeb. Limitted by recursion limit of Python as it uses recursion, but interesting for me.

Member Avatar for TrustyTony
0
1K
Member Avatar for TrustyTony

Here is my newest version of the pretty printer I posted earlier. Not doing all that fancy stuff of printing looped recursive structures, but if you put one deeper structure inside flat one, works better for me than pprint module. I do not use often object oriented structures though. Dedicated …

0
658
Member Avatar for TrustyTony

Based on thread [url]http://www.daniweb.com/forums/thread323401.html[/url], I did this recursive version for comparision. Thanks for posters of the thread!

Member Avatar for TrustyTony
0
1K
Member Avatar for raj26061990

The two numbers are accepted as Commamnd line arguements and GCD of those numbers are found using a recursive method.

Member Avatar for raj26061990
0
2K
Member Avatar for ryuurei

I had been working on this program for a while. It was inspired by the slowness of Windows' search feature. I made it so I could simply look for files to see if/where they existed quickly. I eventually added in the feature to delete files. It was no major extension …

Member Avatar for tls-005
3
448
Member Avatar for TrustyTony

Here is my practise with [URL="http://www.boggled.org/"]boggle [/URL]letter square non-overlapping word finder after some drastic debugging and cleaning. I think it is reasonable speed also. Comments wellcome.

Member Avatar for TrustyTony
0
1K
Member Avatar for ddanbe

Whenever you hear the word recursion, factorials or Towers of Hanoi are never far away. Well here they get mentioned, because we are not going to talk about these guys at all! Iteration and recursion are in fact quite similar: they both loop until a certain condition is met. As …

2
3K
Member Avatar for lllllIllIlllI

This code shows an example of using recursion to simply solve a problem. Note though, it can take a long time to do larger numbers such as the 50th fibonacci numbers this way. Hope this helps! :)

Member Avatar for sneekula
0
207

The End.