Codebase analysis · CoreStory V3

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.

Maintained by
Tanner Helland
License
BSD-2-Clause
Commit analyzed
f2703861b9e6a7ed4acdc6eedb2632ca8903f895
Rules extracted
2026-11-13
Extracted by CoreStory V3
873
accepted rules, each with a cited source quote
01 · Rules

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.

calculation
Grayscale-effect/Grayscale.frm

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
conversionFactor = (255 / (numOfShades - 1)) 'This algorithm is well-suited to using a look-up table, so let's build one and (obviously!) prepopulate it Dim grayLookup(0 To 255) As Byte Dim grayTempCalc As Long For x = 0 To 255 grayTempCalc = Int((CDbl(x) / conversionFactor) + 0.5) * conversionFactor grayLookup(x) = ByteMeL(grayTempCalc)

Also cited: L949

calculation with clamping
Contrast-effect/Contrast.frm

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
colorCalculation = x + (((x - 127) * contrast) \ 100) 'Clamp values to 0, 255 If colorCalculation > 255 Then colorCalculation = 255 ElseIf colorCalculation < 0 Then colorCalculation = 0 End If

Also cited: L204

calculation
Levels-effect/Main.frm

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
Dim pStep As Single pStep = 255 / (CSng(inRLimit) - CSng(inLLimit)) For x = 0 To 255 If x < inLLimit Then newLevels(x) = 0 ElseIf x > inRLimit Then newLevels(x) = 255 Else newLevels(x) = ByteMe(((CSng(x) - CSng(inLLimit)) * pStep)) End If Next x 'Now run all input-mapped values through our midtone-correction look-up For x = 0 To 255 newLevels(x) = gLevels(newLevels(x)) Next x
calculation
Brightness-effect/Part 4 - Even faster DIBs/Brightness.frm

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
For x = 0 To 255 NewColor = x + Brightness ByteMe NewColor bTable(x) = NewColor Next x

Also cited: L177–L180

calculation
Grayscale-effect/Grayscale.frm

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
If minValue = True Then gray = ByteMeL(Minimum(r, g, b)) Else gray = ByteMeL(Maximum(r, g, b)) End If

Also cited: L786

calculation
Artificial-life/Organism.cls

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
Public Sub CreateFromCreature(ByRef srcCreature As Organism) 'Split the parent creature's energy with the child srcCreature.Energy = srcCreature.Energy / 2 Energy = srcCreature.Energy ParentID = srcCreature.ID 'If the parent was a member of the founding set of creatures, set ' the AncestralID to match the ParentID If srcCreature.AncestralID = -1 Then AncestralID = srcCreature.ID Else AncestralID = srcCreature.AncestralID End If
validation
Artificial-life/Organism.cls

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
'Thinking takes energy... Energy = Energy - 1 'If it has no energy, it dies If (Energy <= 0) Then Energy = 0 isAlive = False 'If the creature is still alive, count this cycle Else Lifetime = Lifetime + 1 End If
validation
Custom-image-filters/CustomFilters.frm

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
For x = 0 To 24 If Not NumberValid(TxtF(x)) Then AutoSelectText TxtF(x) Exit Sub End If Next x

Also cited: L1046–L1053

02 · Capabilities
03 · Size

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).

04 · Source

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.

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.

Talk to an expert