[Community Puzzle] CGFunge Prime

Yes, offline computation allows to compute for a bit longer but it’s pointless if it takes years to compute.
So having a fast algorithm is what makes the difference anyway.

Hi,

I wonder why (in python)

solution = “”“1
E”""
print(solution)

lead to this error “Program pointer out of code area at (1/0)”
(before the expected error “Output was: ; expected: NOT PRIME”)
while

solution = “”“1
E “””
print(solution)

works fine just with an added space.

Also why sometimes I get a warning that the input was not entirely read ?

Thanks

I got the warning when the number of lines specified did not match

For such puzzle, it would be feasible to have random numbers as validators, wouldn’t it? Or one random numbers per predefined range.

1 Like

In hindsight I could have made a single validator testing every number within the range (and show the first replay where your solution failed).
But too late to change now, it would break the entire leaderboard.

I don’t mind about breaking the leaderboard of one puzzle that started recently. And that would be fair in this case.

One could still create a new puzzle for checking that a number is within a given list.

Here is a live interpreter I made for CG Funge. Make it easier to see what happens as you change the code.
http://johann-elsass.net/cgfungelive.php

2 Likes

Thanks for sharing.
There’s also this one from Marchete: Coding Games and Programming Challenges to Code Better.
I’m a bit scared to add a link to the statement at this point. I have some history of clearing the entire leaderboard with such small changes.

1 Like

It would be nice to add the link indeed. Thanks for thinking about that. I understand you have some responsibility here about clearing the leaderboard. I wonder if people would loose their submissions, their code. That would be bad because people may not have saved them locally.

Not losing the code. But there’s a risk of removing every player from the leaderboard. If this happens, some scores would be gone forever (inactive users who don’t resubmit).
I think it won’t happen, as CG addressed the issue. At the same time there is a limit for the amount of validators that’s lower now than it was back when I created the puzzle. I really don’t want to risk breaking anything.

Thanks for this puzzle, I had so much fun solving it.
Now, I think I would like to try to climb the leaderboard, but only if I know that there are no cheaters in there… Really, is there no solution to have some randomly selected validators to make certain to get-rid of the hard-coders ?
Having the possibility to play for real would be amazing !

Technically it would even be possible to test every number from 1 to 10000. You just have to test multiple numbers in a single validator. In hindsight that’s what I should have done.

But I’m very hesitant to change anything now, some users have put in a lot of time to optimize. It doesn’t have much to do with prime numbers at the top anymore, it’s more about finding an efficient way of building a binary tree. While it’s not what I had in mind, I wouldn’t call it cheating. It’s still an achievement to compress the tree and wiping out the entire leaderboard (that’s what will happen when I change any testcase/validator) would not be fair to either of those who solved it in the intended way nor those who hard-coded.

Despite being a different problem, it can still be a fun challenge.

The best way to address this would probably be a fork: create a new optimization problem - if that’s a valid concern for multiple users and justifies a new problem. You have my blessing in doing so and using my code.

3 Likes

I get your point.
Well, maybe creating another kind of problem, with the very same langage… I’ll think about this. Thanks for your answer :wink: