|
[Home] [Projects] [Delphi Techniques] [Math Topics] [Library] [Utilities] |
|
|
Beginners often need "bootstrap" examples to get them started. I've written dozens of these simple apps to provide this kind of sample code over the years. This page may provide a place to post those that seem most useful. Recently I've received several requests for help with a few Delphi techniques that are not too difficult once you do one. Here is the current offerings:
Features and techniques illustrated are used in a number of programs on DFF, but it's easy to lose the essential characteristics in programs that may have 1,000 or more lines of code. Each of these programs contains less than 100 lines. Scroll down to see all offerings. Image Manipulation (ParKing Lot)
Click here to download Parking Lot Simulation source code TChartDemo1 and TChartDemo2
Addendum December 2, 2005: A viewer recently asked about getting user input data from a list box or memo into a chart. Here's TChartDemo2 which shows a few additional techniques for charting user data. It includes a "missing" Delphi function, StrToFloatDef. which tries to convert an input string to a floating point number and returns either the numeric value of the string or a default value if the input string does not represent a valid number. Click here to download TChart Demos source code BackTracking
Click here to download Backtracking Demo source code
Addendum June 8, 2005: Here are three more additions: DrawDice
CountWordsHow do you count words in a text document? Like loving a porcupine - very carefully. Here's simple start though, with a Getword routine which looks for a predefined set of delimiters marking the ends of words. Words from a text file are extracted and listed. There is also a Summarize button that accumulates number of occurrences by word. Click here to download CountWords source code.
Expressions864Find all solutions where the sum of two numbers equals 864. And by the way, the Click here to download Expressions864 source code.
Addendum September 30, 2005 AllwordsGiven a letter string, find all possible subsets of letters ("words") that can be formed. Optionally, list only words that can validated against a given dictionary. This code is fairly simple because it uses two other pre-built units as helper "tools". UComboV2 contains the class which generates the permutations which help us form the words. UDict contains the dictionary class that lets us validate our trial words. Click here to download AllWords source Click here to download AllWords executable MemLeakDemo
Even though the use of records and pointers is less critical today than in the pre-object days, some schools still teach their use.
And the use of record pointers in the objects field of TStringlists is
sometimes convenient. Click here to download MemLeakDemo source
Addendum February 15, 2006 Draw Olympic Rings
Click here to download Draw Olympic Rings source Click here to download Draw Olympic Rings executable
Addendum March 12, 2006 We have a decryption program elsewhere at DFF which checks all possible substitution ciphers and check results against a dictionary to determine success. The problem is, this approach can run for hours, and if the text contains words not in the dictionary, may not succeed at all. My Mensa "Puzzle-A-Day" calendar periodically contains messages encrypted with a simple "shift cipher", also known as the "Caesar Cipher" because Julius Caesar used it to encrypt message in ancient Roman times. In the shift cipher, each letter is replaced by a letter at some fixed distance away in the normal "abcd..." listing of letters. For example, if all plain text "a"s were replaced by "c"s, then "b"s, becomes "d"s, "c"s becomes "e"s etc. to produce the encrypted text. It takes less than 40 lines of user written Delphi code to scan lines of input text using all 25 possible encryption choices (26 if you count the one that maps each letter back to itself). You provide the dictionary check scanning the outputs to determine which one is correct. And, of course it will encrypt as well as it will decrypt! Click here to download Simple Decrypt source Click here to download Simple Decrypt executable
|
[Feedback] [Newsletters (subscribe/view)] [About me]Copyright © 2000-2008, Gary Darby
All rights reserved.
|