[Community Puzzle] CGFunge Prime


#1

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.


#2

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.


#3

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


#4

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.


#5

Shame on me ! Thank you :wink:


#6

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).


#7

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


#8

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


#9

@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.


#10

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


#11

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.


#12

Thanks for the information.


#13

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


#14

Yep that’s it


#15

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


#16

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.