[Community Puzzle] CGFunge Prime

https://www.codingame.com/multiplayer/optimization/cgfunge-prime

Send your feedback or ask for help here!

Created by @eulerscheZahl,validated by @dbdr,@dwarfie and @pac-nam.
If you have any issues, feel free to ping them.

1 Like

Hi @eulerscheZahl, @dbdr, @dwarfie, @pac-nam,

I’ve got a code passing all the test but only 88% of the validators (23,27,31,35,37,43,47,49,51,57,63,65 are not validated).

Maybe a certain class of numbers is used in validator and not in test.

Can someone help me investigating this issue please ?

EDIT: I’ve found the problem. A class of integer is indeed present only in validators. @eulerscheZahl feel free to contact me to find a solution.

1 Like

Hi all,
My code succeeds all the validators but 22 ! Can I get a tip to solve this problem ?
Thank you

Could you write English here on the forum please?
You can find the validators on my github.
Validator 22 (“bonus validator 2”) is here, you have to check if 3 is prime.

1 Like

Shame on me ! Thank you :wink:

Hi, @eulerscheZahl

What is the range of integers on the stack? This should be clarified in the problem statement. It does seem to be the range of normal 32-bit integers (or maybe there is a bug in the stack visualization).

Maybe you can program a test for that question :smiley:

Here’s an ocaml code :

let l = (* ~ GOTO OK ! GOTO FALSE*)
[String.make 33 ‘2’^“v”;
String.make 33 ‘*’^"<"
]

let _ = Format.printf “%d@.” (List.length l)
let _ = List.iter (fun s -> Format.printf “%s@.” s) l

It is an int in the Java referee. So it’s a normal signed 32bit integer, going from -2^31 to 2^31-1.

@eulerscheZahl @Boulet

Thanks. I just realized I made a mistake. There is a delay in the visualization and the change of the stack is reflected only two commands afterwards (where the green cursor points to). In other words, the stack shows the action of the command that is two commands before the position of the green cursor. So I made a wrong assumption on where the program was actually at in my tests.

Is there any way to run custom test cases like some puzzles for the challenge?

Not online at least. It’s just not possible for me to add such an option.
You can download the game and add your custom test in this file, then execute the code offline.

Thanks for the information.

Is the final score the total number of steps executed in all validators?

Yep that’s it

Those little red letters over black background have given me a headache, Literally.

1 Like

I created a CGFunge Batch Interpreter that I used some time ago. I can’t use the IDE, too complex and I needed something more direct, like highlighting the execution path, total steps and some other info you can’t get from the IDE.

As it’s tech.io it works right out the box. If you want to make tests locally you just need a Java compiler. It’s just a single file with 2 classes, no weird imports or boring downloads, just a simple “javac CGFunge.java” . I can’t recall what Java version I used, also I only tested it in Linux, especially for background colors in terminal.

Feel free to use to your needs.

2 Likes

agreed, completely unreadable

Very unique puzzle, well done.

I suspect that top of the leaderboard just hardcoded all validators with some binary search (or they might know some serious math stuff which I don’t…) :slight_smile:

It seems to me that whitespaces are counted towards the points. That means this is a two-in-one optim puzzle: (1) find the algorithm with the fewest befunge instruction steps; (2) codegolf your solution by arranging it in the 2D grid as tight as possible…

Looking at leaderboard language selections: LOL, I always knew that there MUST be a puzzle where php is the best choice… :slight_smile:

yes unfortunately to be at the top of the leaderboard… just need to hard-code the validators…

“just” need to hard-code :wink: