Sample

Schnappinger/aoi/artofillusion.procedural.ColorLightenModule

Human rating uses the original dataset scale.

Human2.8
Lines80

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
44.1Δ 26.0
Scalabrino0.4130–1; higher is more readable
4.1Δ 14.0
Dorn0.1020–1; higher is more readable
33.7Δ 15.5
Mi0.2530–1; higher is more readable
16.5Δ 1.7
LLOC27Logical lines; fewer is more readable
51.5Δ 33.3
DeepSeek V4 Pro16.330–20; mean of three runs
53.1Δ 35.0
GPT-6.1 Sol160–20; mean of three runs
38.9Δ 20.8
BTTF0.3150–1; higher is more readable
23.1Δ 5.0
Human2.81–4; original rating
18.2

Views

Source code

/* This is a Module which outputs the lighter of two colors. */ /* Copyright (C) 2001 by David M. Turner <novalis@novalis.org> and Peter Eastman This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ package artofillusion.procedural; import artofillusion.*; import artofillusion.math.*; import artofillusion.ui.*; import java.awt.*; public class ColorLightenModule extends Module { RGBColor color; boolean colorOk; double lastBlur; public ColorLightenModule(Point position) { super(Translate.text("menu.lighterModule"), new IOPort [] {new IOPort(IOPort.COLOR, IOPort.INPUT, IOPort.TOP, new String [] {"Color 1", '('+Translate.text("white")+')'}), new IOPort(IOPort.COLOR, IOPort.INPUT, IOPort.BOTTOM, new String [] {"Color 2", '('+Translate.text("white")+')'})}, new IOPort [] {new IOPort(IOPort.COLOR, IOPort.OUTPUT, IOPort.RIGHT, new String [] {"Lighter"})}, position); color = new RGBColor(0.0f, 0.0f, 0.0f); } /* New point, so the color will need to be recalculated. */ public void init(PointInfo p) { colorOk = false; } /* Calculate the lighter color. */ public void getColor(int which, RGBColor c, double blur) { if (colorOk && blur == lastBlur) { c.copy(color); return; } float brightness1, brightness2; colorOk = true; lastBlur = blur; if (linkFrom[0] == null) { color.setRGB(1.0f, 1.0f, 1.0f); brightness1 = 1.0f; } else { linkFrom[0].getColor(linkFromIndex[0], color, blur); brightness1 = color.getBrightness(); } if (linkFrom[1] == null) { c.setRGB(1.0f, 1.0f, 1.0f); brightness2 = 1.0f; } else { linkFrom[1].getColor(linkFromIndex[1], c, blur); brightness2 = c.getBrightness(); } if (brightness1 > brightness2) c.copy(color); else color.copy(c); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.2377.724−78.465
Source linesThe number of non-empty source lines.80+32
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.95−7.426

Intercept 8.87 + feature contributions = -45.02 (log-odds).
Score = sigmoid(-45.02) = 0.

Score0.413

Feature contributions

FeatureValueContribution
(log-odds)
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.173.975−3.704
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.173.988+2.003
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.80−1.796
Indentation frequencyHow rapidly indentation changes from line to line.72+1.753
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.72−1.231
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.78.863+0.693
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.093+0.035

Intercept 0.07 + feature contributions = -2.177 (log-odds).
Score = sigmoid(-2.177) = 0.102.

Score0.253
Score27
Run 1

The code is well-structured and readable. It has a clear class hierarchy, with methods logically organized and named clearly (init, getColor). Nesting is minimal, mostly limited to a few if-else blocks. The intent is unambiguous, with descriptive comments explaining the module's purpose and the meaning of key steps. The code is concise but not overly terse; it avoids repetition where sensible, though the two nearly identical color-input blocks introduce some redundancy. Action granularity is generally good—each line does one thing, though some lines contain both method calls and assignments. Reading flow is natural: the method follows a predictable sequence, from cache check to input processing to output selection. The main weaknesses are the duplicated input handling logic, which could be refactored for even better clarity, and occasional dense lines in the constructor. Overall, it is highly readable, maintainable code.

Run 2

The code is generally readable with clear structure and logical organization. The class has a single responsibility and methods are well-separated. Variable names are descriptive and the comments help explain the module's purpose. However, there are some readability issues: the constructor has deeply nested method calls and long parameter lists that span multiple lines, making it harder to follow. The getColor method contains moderate nesting with multiple if-else branches and lacks clear separation between the two color calculation blocks - extracting helpers would improve clarity. The blur caching logic is not immediately obvious from the code itself. Action granularity is mostly good, though multiple operations occur in single lines (e.g., setting color and brightness together). The reading flow is natural overall, with comments guiding the reader through the algorithm's intent.

Run 3

The code is generally well-structured and readable. It has clear class and method organization, with logical separation of concerns (constructor, initialization, and color calculation). Nesting is minimal, with only a few shallow conditional blocks. The intent is clearly communicated through comments and meaningful method/variable names like 'getColor', 'brightness1/2', and 'linkFrom'. Code length is appropriate—not overly verbose. Action granularity is good, with one main operation per line in most cases. Reading flow is natural: the module description at the top, followed by imports, class declaration, constructor, and methods. Minor deductions: the getColor method has slightly complex control flow with multiple early returns and state flags (colorOk, lastBlur), which could be made clearer. Some magic numbers (1.0f for white) could be constants. The conditional block formatting is slightly inconsistent. Overall, it's maintainable and understandable code.

Run 1

Code Structure: Clearly separated constructor, cache reset, and color calculation methods provide logical organization. Nesting: Shallow conditionals and an early cache return keep complexity low. Clarity of intent: The module comment, method names, and brightness comparison explain the purpose, although colorOk, c, and implicit cache/output synchronization require interpretation. Code length: The implementation is reasonably concise, with minor duplication in input handling; the lengthy license is standard boilerplate. Action granularity: Most statements perform one action per line, but the constructor compresses several nested array and port constructions into long lines. Reading flow: Execution follows a natural sequence from cache check to input retrieval and brightness comparison. Unconventional brace indentation and dense constructor formatting slightly hinder scanning.

Run 2

Code Structure: Clearly separated constructor, initialization, and color calculation methods; caching and comparison logic are logically organized. Nesting: Shallow conditionals and an early return keep complexity low. Clarity of intent: Comments, method names, and brightness variables explain the purpose, though colorOk and c are vague, and using c as both a temporary input color and output requires attention. Code length: Mostly concise, with some repetitive input-handling logic and a dense constructor. Action granularity: Most lines perform one action, but constructor lines combine multiple nested object and array constructions. Reading flow: Calculation proceeds naturally from cache check to input retrieval to brightness comparison; unconventional brace indentation, long constructor lines, and implicit cache updates slightly interrupt readability.

Run 3

Code Structure: Clear separation between construction, cache invalidation, and color selection, though getColor mixes caching, input retrieval, and comparison. Nesting: Shallow conditionals and an early return keep complexity low. Clarity of intent: Comments, class naming, and brightness variables explain the purpose; colorOk, c, and implicit use of color as both temporary storage and cache require interpretation. Code length: Compact overall, with some repetitive input-handling logic. Action granularity: Most lines perform one action, but the constructor packs several nested object and array initializations into long lines. Reading flow: The progression from cache check through input evaluation to selection is natural, although unusual brace indentation and dense constructor formatting interrupt readability.