Sample

JetBrains/e54

Human rating uses the original dataset scale.

DatasetJetBrains
Human0.44
Lines21

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
40.7Δ 29.2
Scalabrino0.5280–1; higher is more readable
35.6Δ 24.2
Dorn0.720–1; higher is more readable
90.7Δ 79.2
Mi0.490–1; higher is more readable
50.0Δ 38.6
LLOC16Logical lines; fewer is more readable
38.6Δ 27.1
DeepSeek V4 Pro140–20; mean of three runs
35.2Δ 23.7
GPT-6.1 Sol15.330–20; mean of three runs
17.8Δ 6.4
BTTF0.4410–1; higher is more readable
39.0Δ 27.5
Human0.440–1; original rating
11.4

Views

Source code

public class KolakoskiSequence { public static void main(String[] args) { int[] sequence = new int[1000]; sequence[0] = 1; sequence[1] = 2; int count = 2, num = 1, index = 1; while (count < 1000) { for (int i = 0; i < sequence[index]; i++) { sequence[count++] = num; if (count >= 1000) { break; } } num = num == 1 ? 2 : 1; index++; } for (int i = 0; i < 1000; i++) { System.out.print(sequence[i] + " "); } } }

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.780.699−25.763
Source linesThe number of non-empty source lines.21+8.4
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.3.473−5.21

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

Score0.528

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.58.952+1.168
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.1+1.001
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.126−0.285
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.19.667−0.135
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.21−0.061
Indentation frequencyHow rapidly indentation changes from line to line.21−0.011

Intercept 0.07 + feature contributions = 0.943 (log-odds).
Score = sigmoid(0.943) = 0.72.

Score0.49
Score16
Run 1

The code has a clear overall structure and logic but suffers from several readability issues. The variable names are too generic (`count`, `num`, `index`), making the Kolakoski sequence generation logic hard to follow. The loop conditions and break statement create moderately complex nesting. The initial magic value `1000` is repeated four times without explanation. Action granularity is mostly good, with roughly one operation per line, but the `sequence[count++] = num` combines assignment and increment. Reading flow is somewhat natural but lacks explanatory comments about the sequence's rules. The code is concise but would benefit from better variable names, a constant for the sequence length, and a brief comment explaining the Kolakoski generation algorithm.

Run 2

The code is logically structured and compact, but clarity suffers due to a lack of explanation and somewhat cryptic variable usage. The algorithm is implemented in a single main method without helper methods or comments, making the intent less obvious to unfamiliar readers. Nesting is shallow, which is good, and most lines perform a single action. However, the while and for loop with a break condition adds slight control-flow complexity. Variable names like 'num' and 'index' are understandable in context but could be more descriptive. Overall the structure is readable for someone familiar with the Kolakoski sequence, but less so for general readers.

Run 3

The code is relatively concise and follows a logical structure, but several readability issues lower its score. The Kolakoski sequence generation logic is not immediately clear due to ambiguous variable names like 'count', 'num', and 'index', which obscure intent. The while loop with a nested for-loop and an internal if-break check adds unnecessary nesting and disrupts the flow. Some lines combine multiple actions (e.g., sequence[count++] = num), reducing action granularity. The final printing loop is straightforward but could be extracted or formatted. Overall, it is understandable to an experienced programmer, but intent and structure could be clearer.

Run 1

Code Structure: Generation and output are logically ordered, though both reside in main. Nesting: The while/for/if nesting is moderate and easy to follow. Clarity of intent: The class name identifies the sequence, but generic names such as count, num, and index leave their algorithmic roles unclear; initialization lacks explanation. Code length: Compact without substantial unnecessary code, though repeated 1000 literals could use a named constant or sequence.length. Action granularity: Most lines perform one action, but the combined variable declaration and sequence[count++] assignment combine operations. Reading flow: Execution proceeds naturally from initialization through generation to printing; separating these phases visually would improve readability.

Run 2

Code Structure: Initialization, sequence generation, and output are logically ordered, though all reside in main. Nesting: The while/for/if nesting is moderate and easy to follow. Clarity of intent: The class name identifies the sequence, but generic names such as num and index and the lack of an algorithm explanation obscure how generation works. Code length: Compact without substantial unnecessary code, although the repeated literal 1000 could be replaced with sequence.length or a named constant. Action granularity: Most lines perform one action, but the combined variable declaration and sequence[count++] assignment compress multiple operations. Reading flow: Execution proceeds naturally from setup to generation to printing; descriptive names and spacing between phases would improve readability.

Run 3

Code Structure: Initialization, generation, and output are logically ordered, although all logic resides in main. Nesting: The while/for/if nesting is moderate and manageable. Clarity of intent: The class name identifies the sequence, but generic variables such as num and index, unexplained initial values, and the absence of comments make the generation algorithm less obvious. Code length: Compact without substantial unnecessary code, though repeating the literal 1000 reduces maintainability. Action granularity: Most lines perform one action, but the combined variable declaration and sequence[count++] assignment compress multiple operations. Reading flow: Consistent indentation and sequential phases make the code easy to follow; the boundary check and alternating-value expression require some extra attention.