Sample
Dorn/python/75
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 31.5Δ 51.8 |
| Scalabrino | 0.474 | 0–1; higher is more readable | 38.0Δ 45.3 |
| Dorn | 0.755 | 0–1; higher is more readable | 71.9Δ 11.4 |
| Mi | 0.641 | 0–1; higher is more readable | 71.3Δ 12.0 |
| LLOC | 38 | Logical lines; fewer is more readable | 2.9Δ 80.4 |
| DeepSeek V4 Pro | 9 | 0–20; mean of three runs | 34.7Δ 48.6 |
| GPT-6.1 Sol | 12.33 | 0–20; mean of three runs | 24.4Δ 58.9 |
| BTTF | 0.663 | 0–1; higher is more readable | 87.2Δ 3.9 |
| Human | 3.8 | 1–5; original rating | 83.3 |
Views
Select the downloaded ZIP or its extracted folder. Files stay in your browser.
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (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. | 1340.1 | −44.223 |
| Source linesThe number of non-empty source lines. | 50 | +20 |
| 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.635 | −6.953 |
Intercept 8.87 + feature contributions = -22.306 (log-odds).
Score = sigmoid(-22.306) = 0.
| Score | 0.474 |
|---|
Feature contributions
| Feature | Value | Contribution (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. | 62.98 | +0.998 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 51 | −0.769 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 43 | +0.75 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 43 | −0.566 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 49.844 | +0.287 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 61.745 | +0.192 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.08 | +0.165 |
Intercept 0.07 + feature contributions = 1.127 (log-odds).
Score = sigmoid(1.127) = 0.755.
| Score | 0.641 |
|---|
| Score | 38 |
|---|
Run 1
The code suffers from poor readability due to several issues. The structure begins with a fragment showing only dictionary entries, missing the opening brace and context. The encode method mixes multiple responsibilities: string preprocessing, validation, encoding, and binary conversion. Nesting is relatively flat but logical flow is scattered. Variable names like 'result', 'encoded', and 'colour' are generic and unclear. There's a typo 'isposible', and comments are inconsistent - one comment is confusing rather than helpful. Multiple statements per line are present (e.g., char = '-'). The binary conversion logic is convoluted and difficult to follow: toggling colours while processing characters makes the intent obscure. The code lacks proper spacing and follows old Python conventions (has_key). Overall, it's difficult to understand what's happening without deep analysis.
Run 2
The code has some strengths, such as clear variable names and generally flat nesting, and it uses a dictionary mapping for readable character-to-binary conversion. However, critical issues lower the score: inconsistent indentation and spacing make structure unclear, and there are spelling/grammar errors in comments. The encoding logic is split into two loops with string concatenation, which makes the overall intent harder to follow. The color toggling logic (if/else changing '1' to '0') works but is verbose and could be simplified. The use of `has_key` is outdated. Comments are overly long and occasionally unclear. Many lines perform multiple actions (e.g., assignments with method calls), reducing action granularity. Overall, the code works but requires effort to read and maintain, placing it below average in readability.
Run 3
The code shows a reasonably logical structure with a clear encode method and separate encoding dictionary. However, it has several readability issues: the dictionary is not properly indented or enclosed, missing opening brace; the loop checks 'encoding.has_key(char)' which suggests Python 2 syntax; variable names like 'result' and 'encoded' are vague; the final encoding logic for black/white alternating colors is somewhat opaque without comments explaining the marker transformation. Nesting is shallow which is positive. Action granularity is generally one action per line but the color toggling logic could be simplified. The comment 'Now we need to encode the code39, best read the code to understand what it's up to' does not clarify intent. Overall, the code is understandable but requires domain knowledge and has minor structural inconsistencies.
Run 1
Code Structure: The lookup entries and two sequential encoding passes are logically organized, but the snippet starts mid-dictionary and ends without showing how the output is used. Nesting: Shallow loops and conditionals are easy to follow. Clarity of intent: Comments identify barcode encoding and explain colour values, but generic names such as Object, result, and data obscure details; the instruction to read the code adds little explanation. Code length: Reasonably concise, though repetitive string concatenation and colour toggling could be expressed more clearly. Action granularity: Statements generally perform one action per line; unnecessary semicolons and uneven spacing introduce visual noise. Reading flow: Uppercasing, adding delimiters, mapping characters, and expanding marker widths form a natural sequence, but incomplete context, dated has_key syntax, and weak comments interrupt comprehension.
Run 2
Code Structure: The mapping and two sequential encoding stages are logically organized, but the excerpt starts mid-dictionary and ends without showing how the encoded result is used. Nesting: Shallow loops and conditionals are easy to follow. Clarity of intent: Barcode conversion is identifiable, but the generic class name Object, vague variable data, unexplained bit patterns, and unhelpful comments obscure details. Code length: Reasonably concise, although repeated string concatenation and verbose colour toggling add clutter. Action granularity: Most lines perform one action; inline comments and unnecessary semicolons introduce minor stylistic noise. Reading flow: The progression from normalization to character lookup to marker expansion is natural, but inconsistent spacing, outdated has_key usage, and incomplete context interrupt readability.
Run 3
Code Structure: The lookup table and two encoding stages are logically separated, but the snippet starts mid-table and ends without showing how the output is returned. Nesting: Shallow loops and conditionals are easy to follow. Clarity of intent: The barcode conversion purpose is apparent, but the generic class name Object, vague variables such as result and data, and unhelpful comments obscure details. Code length: Reasonably short, although repeated concatenation and explicit colour toggling are verbose. Action granularity: Most lines perform one action; inline comments and unnecessary semicolons add minor clutter. Reading flow: Execution proceeds naturally from normalization to character lookup to marker expansion, but inconsistent spacing, outdated has_key syntax, and poorly worded comments interrupt readability.