Skip to content

Add prism#376

Open
BNAndras wants to merge 3 commits intoexercism:mainfrom
BNAndras:add-prism
Open

Add prism#376
BNAndras wants to merge 3 commits intoexercism:mainfrom
BNAndras:add-prism

Conversation

@BNAndras
Copy link
Member

No description provided.

@BNAndras BNAndras added x:module/practice-exercise Work on Practice Exercises x:rep/large Large amount of reputation labels Feb 16, 2026
@BNAndras BNAndras requested a review from a team February 16, 2026 06:48
AssertEqual g:expected, FindSequence(g:prisms, g:start)

Execute (multiple prisms floating point precision):
let g:prisms = [{'id': 26, 'angle': 6.555, 'x': 5.8, 'y': 73.4}, {'id': 24, 'angle': -0.304, 'x': 36.2, 'y': 65.2}, {'id': 20, 'angle': 45.17, 'x': 20.4, 'y': 82.8}, {'id': 31, 'angle': 30.615, 'x': -20.2, 'y': 48.8}, {'id': 30, 'angle': 28.771, 'x': 24.0, 'y': 0.6}, {'id': 29, 'angle': 61.327, 'x': 31.4, 'y': 79.4}, {'id': 28, 'angle': -18.157, 'x': 36.4, 'y': 31.4}, {'id': 22, 'angle': 54.745, 'x': 47.0, 'y': 57.8}, {'id': 38, 'angle': 49.05, 'x': 36.4, 'y': 79.2}, {'id': 10, 'angle': 11.978, 'x': 37.8, 'y': 55.2}, {'id': 18, 'angle': 22.661, 'x': -26.0, 'y': 42.6}, {'id': 25, 'angle': 51.958, 'x': 38.8, 'y': 76.2}, {'id': 2, 'angle': -21.817, 'x': 0.0, 'y': 42.4}, {'id': 35, 'angle': -171.579, 'x': 21.4, 'y': 44.8}, {'id': 7, 'angle': 19.081, 'x': 14.2, 'y': -1.6}, {'id': 33, 'angle': -165.941, 'x': 11.2, 'y': 44.4}, {'id': 11, 'angle': 66.262, 'x': 15.4, 'y': 82.6}, {'id': 16, 'angle': 35.852, 'x': 30.8, 'y': 6.6}, {'id': 15, 'angle': 53.782, 'x': -3.0, 'y': 79.2}, {'id': 4, 'angle': 17.016, 'x': 29.0, 'y': 75.4}, {'id': 23, 'angle': 70.763, 'x': 41.6, 'y': 59.8}, {'id': 8, 'angle': -9.24, 'x': -10.0, 'y': 15.8}, {'id': 13, 'angle': 45.812, 'x': 48.6, 'y': 51.8}, {'id': 1, 'angle': 17.937, 'x': 13.2, 'y': 77.0}, {'id': 34, 'angle': -4.199, 'x': -8.8, 'y': 36.8}, {'id': 21, 'angle': 20.783, 'x': 24.4, 'y': 75.8}, {'id': 17, 'angle': 24.709, 'x': -4.4, 'y': 74.6}, {'id': 9, 'angle': -165.413, 'x': 30.8, 'y': 41.8}, {'id': 32, 'angle': 40.892, 'x': 4.2, 'y': 78.6}, {'id': 37, 'angle': 33.29, 'x': -15.8, 'y': 47.0}, {'id': 6, 'angle': 51.295, 'x': 1.0, 'y': 80.6}, {'id': 36, 'angle': 92.52, 'x': -27.0, 'y': 47.8}, {'id': 14, 'angle': -52.001, 'x': -2.0, 'y': 34.4}, {'id': 5, 'angle': 31.866, 'x': 23.2, 'y': 80.2}, {'id': 27, 'angle': -75.303, 'x': -5.6, 'y': 32.8}, {'id': 12, 'angle': 0.0, 'x': -1.0, 'y': 0.2}, {'id': 3, 'angle': 46.72, 'x': -6.6, 'y': 3.2}, {'id': 19, 'angle': -9.205, 'x': -13.8, 'y': 24.2}]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let g:prisms = [{'id': 26, 'angle': 6.555, 'x': 5.8, 'y': 73.4}, {'id': 24, 'angle': -0.304, 'x': 36.2, 'y': 65.2}, {'id': 20, 'angle': 45.17, 'x': 20.4, 'y': 82.8}, {'id': 31, 'angle': 30.615, 'x': -20.2, 'y': 48.8}, {'id': 30, 'angle': 28.771, 'x': 24.0, 'y': 0.6}, {'id': 29, 'angle': 61.327, 'x': 31.4, 'y': 79.4}, {'id': 28, 'angle': -18.157, 'x': 36.4, 'y': 31.4}, {'id': 22, 'angle': 54.745, 'x': 47.0, 'y': 57.8}, {'id': 38, 'angle': 49.05, 'x': 36.4, 'y': 79.2}, {'id': 10, 'angle': 11.978, 'x': 37.8, 'y': 55.2}, {'id': 18, 'angle': 22.661, 'x': -26.0, 'y': 42.6}, {'id': 25, 'angle': 51.958, 'x': 38.8, 'y': 76.2}, {'id': 2, 'angle': -21.817, 'x': 0.0, 'y': 42.4}, {'id': 35, 'angle': -171.579, 'x': 21.4, 'y': 44.8}, {'id': 7, 'angle': 19.081, 'x': 14.2, 'y': -1.6}, {'id': 33, 'angle': -165.941, 'x': 11.2, 'y': 44.4}, {'id': 11, 'angle': 66.262, 'x': 15.4, 'y': 82.6}, {'id': 16, 'angle': 35.852, 'x': 30.8, 'y': 6.6}, {'id': 15, 'angle': 53.782, 'x': -3.0, 'y': 79.2}, {'id': 4, 'angle': 17.016, 'x': 29.0, 'y': 75.4}, {'id': 23, 'angle': 70.763, 'x': 41.6, 'y': 59.8}, {'id': 8, 'angle': -9.24, 'x': -10.0, 'y': 15.8}, {'id': 13, 'angle': 45.812, 'x': 48.6, 'y': 51.8}, {'id': 1, 'angle': 17.937, 'x': 13.2, 'y': 77.0}, {'id': 34, 'angle': -4.199, 'x': -8.8, 'y': 36.8}, {'id': 21, 'angle': 20.783, 'x': 24.4, 'y': 75.8}, {'id': 17, 'angle': 24.709, 'x': -4.4, 'y': 74.6}, {'id': 9, 'angle': -165.413, 'x': 30.8, 'y': 41.8}, {'id': 32, 'angle': 40.892, 'x': 4.2, 'y': 78.6}, {'id': 37, 'angle': 33.29, 'x': -15.8, 'y': 47.0}, {'id': 6, 'angle': 51.295, 'x': 1.0, 'y': 80.6}, {'id': 36, 'angle': 92.52, 'x': -27.0, 'y': 47.8}, {'id': 14, 'angle': -52.001, 'x': -2.0, 'y': 34.4}, {'id': 5, 'angle': 31.866, 'x': 23.2, 'y': 80.2}, {'id': 27, 'angle': -75.303, 'x': -5.6, 'y': 32.8}, {'id': 12, 'angle': 0.0, 'x': -1.0, 'y': 0.2}, {'id': 3, 'angle': 46.72, 'x': -6.6, 'y': 3.2}, {'id': 19, 'angle': -9.205, 'x': -13.8, 'y': 24.2}]
let g:prisms = [
{'id': 26, 'angle': 6.555, 'x': 5.8, 'y': 73.4},
{'id': 24, 'angle': -0.304, 'x': 36.2, 'y': 65.2},
{'id': 20, 'angle': 45.17, 'x': 20.4, 'y': 82.8},
{'id': 31, 'angle': 30.615, 'x': -20.2, 'y': 48.8},
{'id': 30, 'angle': 28.771, 'x': 24.0, 'y': 0.6},
{'id': 29, 'angle': 61.327, 'x': 31.4, 'y': 79.4},
{'id': 28, 'angle': -18.157, 'x': 36.4, 'y': 31.4},
{'id': 22, 'angle': 54.745, 'x': 47.0, 'y': 57.8},
{'id': 38, 'angle': 49.05, 'x': 36.4, 'y': 79.2},
{'id': 10, 'angle': 11.978, 'x': 37.8, 'y': 55.2},
{'id': 18, 'angle': 22.661, 'x': -26.0, 'y': 42.6},
{'id': 25, 'angle': 51.958, 'x': 38.8, 'y': 76.2},
{'id': 2, 'angle': -21.817, 'x': 0.0, 'y': 42.4},
{'id': 35, 'angle': -171.579, 'x': 21.4, 'y': 44.8},
{'id': 7, 'angle': 19.081, 'x': 14.2, 'y': -1.6},
{'id': 33, 'angle': -165.941, 'x': 11.2, 'y': 44.4},
{'id': 11, 'angle': 66.262, 'x': 15.4, 'y': 82.6},
{'id': 16, 'angle': 35.852, 'x': 30.8, 'y': 6.6},
{'id': 15, 'angle': 53.782, 'x': -3.0, 'y': 79.2},
{'id': 4, 'angle': 17.016, 'x': 29.0, 'y': 75.4},
{'id': 23, 'angle': 70.763, 'x': 41.6, 'y': 59.8},
{'id': 8, 'angle': -9.24, 'x': -10.0, 'y': 15.8},
{'id': 13, 'angle': 45.812, 'x': 48.6, 'y': 51.8},
{'id': 1, 'angle': 17.937, 'x': 13.2, 'y': 77.0},
{'id': 34, 'angle': -4.199, 'x': -8.8, 'y': 36.8},
{'id': 21, 'angle': 20.783, 'x': 24.4, 'y': 75.8},
{'id': 17, 'angle': 24.709, 'x': -4.4, 'y': 74.6},
{'id': 9, 'angle': -165.413, 'x': 30.8, 'y': 41.8},
{'id': 32, 'angle': 40.892, 'x': 4.2, 'y': 78.6},
{'id': 37, 'angle': 33.29, 'x': -15.8, 'y': 47.0},
{'id': 6, 'angle': 51.295, 'x': 1.0, 'y': 80.6},
{'id': 36, 'angle': 92.52, 'x': -27.0, 'y': 47.8},
{'id': 14, 'angle': -52.001, 'x': -2.0, 'y': 34.4},
{'id': 5, 'angle': 31.866, 'x': 23.2, 'y': 80.2},
{'id': 27, 'angle': -75.303, 'x': -5.6, 'y': 32.8},
{'id': 12, 'angle': 0.0, 'x': -1.0, 'y': 0.2},
{'id': 3, 'angle': 46.72, 'x': -6.6, 'y': 3.2},
{'id': 19, 'angle': -9.205, 'x': -13.8, 'y': 24.2}
]

Not a big deal, but I wonder if we should do this instead.

From a readers standpoint this is "kinder". From a machine standpoint, it does not care.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The online editor has text-wrapping so it's less of an issue there. This would though require tweaking the test generator if we want to manually split it across multiple lines. That's not a huge deal (famous last words), but we just need to agree on how long a collection should get before we split it across multiple lines. That in turn means we should probably agree on how to break up a nested collection.

let g:prisms = [
    {'id': 26, 'angle': 6.555,  .... lots of stuff},
 ]

or

let g:prisms = [
    {
        'id': 26,
        'angle': 6.555,
        .... lots of stuff each on its new line
     },
 ]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

80 columns, likely the target. Allow for that being a soft limit where it makes sense, 120 is likely the limit where it becomes a nuisance.

Of course, Vim itself allows for wrap or no wrap settings. (For those that know the editor, they know gj, gk for transitioning through "visual lines" that are not really lines.)

Of course, not a requirement. Just was surprising to see such long lines. Controlling it where it is more easily read separated per the individual items to a line seems like a good idea.

Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with the comment about the extremely long lines, which are surely something you can find with tooling, but visually much of the information is likely past the viewport of the terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

x:module/practice-exercise Work on Practice Exercises x:rep/large Large amount of reputation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants