Tanner Helland VB6 Code
A collection of Visual Basic 6 sample programs by Tanner Helland: image effects (brightness, contrast, grayscale, levels, filters), plus fractal, map-editor and artificial-life demos.
Business rules, traced to source lines.
These 8 rules are a sample of the 873 CoreStory V3 extracted from Tanner Helland VB6 Code. Each one links to the exact lines on GitHub at commit f270386. The statement is CoreStory V3’s wording; the code excerpt is the source it cites.
The custom-shades method computes conversionFactor = 255 / (numOfShades - 1), builds a 256-entry lookup table where each index x maps to Int((x / conversionFactor) + 0.5) * conversionFactor clamped by ByteMeL, and applies the lookup to (R+G+B) integer-divided by 3.
- 255 — numerator of conversion factor
- 1 — subtracted from numOfShades in conversion factor
- 0.5 — rounding offset in lookup formula
- 255 — upper index of lookup table
- 3 — divisor of channel sum when indexing lookup
Also cited: L949
For each possible input channel value x from 0 to 255, the adjusted value is colorCalculation = x + (((x - 127) * contrast) \ 100); if the result exceeds 255 it is clamped to 255, and if it is below 0 it is clamped to 0.
- 0 — minimum input value and lower clamp bound
- 255 — maximum input value and upper clamp bound
- 127 — midtone offset used in the contrast formula
- 100 — divisor in the contrast formula
Also cited: L204
pStep = 255/(inRLimit - inLLimit). For each x in 0..255: if x < inLLimit, newLevels(x)=0; if x > inRLimit, newLevels(x)=255; otherwise newLevels(x)=ByteMe((x - inLLimit)*pStep). Then each newLevels entry is replaced by gLevels(newLevels(x)).
- 255 — numerator of pStep and value from which levels above input-right are mapped
- 0 — value from which levels below input-left are mapped
A lookup table of all 256 possible byte color values is built, mapping each source value x (0 through 255) to x + Brightness clamped to 0..255.
- 255 — upper loop bound inclusive
- 0 — lower loop bound inclusive
Also cited: L177–L180
The decompose method assigns the gray value from Minimum(r,g,b) clamped by ByteMeL when minValue is True (the default), otherwise from Maximum(r,g,b) clamped by ByteMeL.
- true — default minValue selecting the minimum channel
Also cited: L786
When creating a creature from an existing creature, the parent's energy is halved and the child receives that halved amount; the child's ParentID is set to the parent's ID, and if the parent's AncestralID is -1, the child's AncestralID is set to the parent's ID, otherwise it inherits the parent's AncestralID.
- 2 — divisor splitting parent energy
- -1 — sentinel AncestralID indicating founding ancestor
Each call to Brain subtracts 1 from Energy; if Energy is less than or equal to 0, Energy is clamped to 0 and isAlive is set to False; otherwise Lifetime is incremented by 1.
- 1 — energy cost per thinking cycle and lifetime increment
- 0 — energy death threshold and clamp value
Exactly 25 filter coefficient text boxes, TxtF(0) through TxtF(24), must each contain a valid numeric value before an effect is applied; otherwise the routine selects the offending text box and exits.
- 0 — lowest text box index validated
- 24 — highest text box index validated
Also cited: L1046–L1053
What was analyzed
- Visual Basic · 81 files · 8,650 lines
- Markdown · 3 files · 38 lines
Whole repository: 220 files. cloc 2.06 counts 8,688 lines of code in 84 of them (21,177 lines with comments and blanks).
Where this came from
Extracted by CoreStory V3 (build 4470 with two small engine fixes) using DeepSeek-V4.1-Flash from the public repository at commit f270386 on 2026-11-13.
- Repository tannerhelland/vb6-code
- Commit f2703861b9e6a7ed4acdc6eedb2632ca8903f895
- Line counts cloc 2.06
- Rule citations Each rule shown was checked: its quote was compared with the repository source at the cited lines at this commit.
Code excerpts are from the upstream repository and remain under its BSD-2-Clause license. CoreStory is not affiliated with or endorsed by Tanner Helland.
Want this for your own codebase?
Talk to us about mapping the business rules in your repositories.