Sample

Schnappinger/aoi/artofillusion.procedural.ColorSumModule

Human rating uses the original dataset scale.

Human3.79
Lines64

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
45.5Δ 1.1
Scalabrino0.5230–1; higher is more readable
11.3Δ 33.1
Dorn0.2380–1; higher is more readable
43.6Δ 0.8
Mi0.3690–1; higher is more readable
22.8Δ 21.6
LLOC21Logical lines; fewer is more readable
58.4Δ 14.0
DeepSeek V4 Pro160–20; mean of three runs
47.4Δ 3.0
GPT-6.1 Sol16.330–20; mean of three runs
45.9Δ 1.5
BTTF0.3870–1; higher is more readable
33.0Δ 11.4
Human3.791–4; original rating
44.4

Views

Source code

/* This is a Module which outputs the sum of two colors. */ /* Copyright (C) 2000 by 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 ColorSumModule extends Module { RGBColor color; boolean colorOk; double lastBlur; public ColorSumModule(Point position) { super("+", new IOPort [] {new IOPort(IOPort.COLOR, IOPort.INPUT, IOPort.TOP, new String [] {"Color 1", '('+Translate.text("black")+')'}), new IOPort(IOPort.COLOR, IOPort.INPUT, IOPort.BOTTOM, new String [] {"Color 2", '('+Translate.text("black")+')'})}, new IOPort [] {new IOPort(IOPort.COLOR, IOPort.OUTPUT, IOPort.RIGHT, new String [] {"Sum"})}, 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 summed color. */ public void getColor(int which, RGBColor c, double blur) { if (colorOk && blur == lastBlur) { c.copy(color); return; } colorOk = true; lastBlur = blur; if (linkFrom[0] == null) color.setRGB(0.0f, 0.0f, 0.0f); else linkFrom[0].getColor(linkFromIndex[0], color, blur); if (linkFrom[1] == null) c.setRGB(0.0f, 0.0f, 0.0f); else linkFrom[1].getColor(linkFromIndex[1], c, blur); color.add(c); c.copy(color); } }

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.2036.706−67.211
Source linesThe number of non-empty source lines.64+25.6
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.5.023−7.534

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

Score0.523

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.140.985−2.306
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.140.985+1.47
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.65−1.265
Indentation frequencyHow rapidly indentation changes from line to line.56+1.2
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.56−0.864
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.63.704+0.481
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.092+0.05

Intercept 0.07 + feature contributions = -1.165 (log-odds).
Score = sigmoid(-1.165) = 0.238.

Score0.369
Score21
Run 1

The code demonstrates clear structure with logical separation of constructor, initialization, and color calculation methods. Comments effectively explain purpose without being excessive. Nesting is minimal, with only single-level conditionals in getColor(). Variable and method names are descriptive, making intent clear. Action granularity is mostly one action per line, though constructor IOPort definitions are long. Reading flow is natural, following a top-down progression from initialization to calculation. Minor deductions: some lines in the constructor are excessively long, reducing readability, and the getColor() method handles both caching and computation logic together. The caching check (colorOk && blur == lastBlur) adds slight complexity but is well-named. Overall, the code is concise for its purpose and maintains good readability despite Java's verbose I/O port setup.

Run 2

The code is well-structured and readable. It follows a logical organization with clear separation of constructor, initialization, and computation methods. Nesting is minimal, with only one level of conditional nesting in getColor(). Intent is evident from method names, comments, and the module's purpose. Code length is appropriate—no unnecessary verbosity. Action granularity is mostly one action per line, though the constructor has very long array parameter lists that slightly hamper readability. Reading flow is natural: constructor, then init, then getColor, mirroring the module's execution lifecycle. The use of caching (colorOk, lastBlur) is clear. However, the multi-line array definitions in the super() call reduce readability slightly due to line length and formatting. Overall, the code is maintainable and easy to follow, with only minor formatting concerns.

Run 3

The code is generally readable: it has a clear structure with a small class, straightforward methods, and descriptive comments. Nesting is minimal (one if-else level). Intent is mostly clear from method names like init and getColor, and the input/output ports are explicitly defined. However, readability is reduced by the lengthy constructor with nested IOPort array definitions and string concatenation for labels, which makes the constructor dense and harder to parse. Also, the getColor method does multiple tasks: caching logic, fetching inputs, and combining colors, which slightly obscures the main action. Action granularity is mostly one action per line, but some lines are long due to complex constructor arguments. Overall, good but could be improved with helper methods or clearer port setup.

Run 1

Code Structure: The class is logically organized into construction, cache initialization, and color calculation. Nesting: Control flow is shallow, with a clear early return for cached results. Clarity of intent: The class name, comments, and color operations clearly communicate the purpose, although names such as c and colorOk are less descriptive, and inherited link arrays require context. Code length: The implementation is concise without unnecessary logic. Action granularity: Most statements perform one action, but the constructor compresses several nested object and array creations into long lines. Reading flow: Calculation proceeds naturally from cache checking to retrieving inputs, summing, and copying the result. Dense constructor formatting, inconsistent brace placement, and unbraced conditionals slightly reduce readability.

Run 2

Code Structure: The class is logically organized into construction, cache invalidation, and color calculation. Nesting: Shallow conditionals and an early return keep complexity low. Clarity of intent: The class name and comments clearly explain color addition, although names such as c and colorOk are less descriptive, and inherited link arrays require external context. Code length: The implementation is compact without substantial unnecessary logic; the lengthy license header does not obscure the methods. Action granularity: Most statements perform one action per line, but the constructor packs several nested object and array creations into long lines. Reading flow: Calculation proceeds naturally from cache checking to input retrieval, addition, and output copying. Unusual brace indentation and dense constructor formatting slightly disrupt readability.

Run 3

Code Structure: The class is logically organized into construction, cache invalidation, and color calculation. Nesting: Shallow conditionals and an early return keep complexity low. Clarity of intent: The class name and comments clearly convey color addition, though names such as c and colorOk are less descriptive, and inherited link arrays require context. Code length: The implementation is concise; the lengthy license header is standard boilerplate rather than unnecessary logic. Action granularity: Most statements perform one action per line, but the constructor packs multiple nested port definitions into long lines. Reading flow: Calculation proceeds naturally from cache checking to input retrieval, addition, and output copying. Unusual brace indentation, omitted braces around conditionals, and dense constructor formatting slightly impede scanning.