PlummersSoftwareLLC / Primes

Prime Number Projects in C#/C++/Python
https://plummerssoftwarellc.github.io/PrimeView/
2.46k stars 573 forks source link

Adding Terra programming language to the race #870

Closed Enter1he closed 1 year ago

Enter1he commented 1 year ago

Description

A solution for counting number of primes up to 1 million. Made with Terra programming language

Contributing requirements

rbergen commented 1 year ago

@Enter1he Thank you for submitting this. To allow inclusion of the solution in the drag race, please:

Enter1he commented 1 year ago

Added Dockerfile and hopefully fixed the output. Should be correct now

Enter1he commented 1 year ago

Well, I changed Dockerfile and output. However, I can't test it on pure Linux machine, so test results are from Windows. Dockerfile were tested on wsl and it works fine, but I need additional tests on Linux to actually get the speed of my program.

rbergen commented 1 year ago

I've tested this version on my machine. The Dockerfile now works, but can be condensed quite a lot. Before we get to that though, there is a more pressing issue: the solution itself doesn't work. This is the output I get when I run the solution using Docker:

Computing primes to 1000000 on 1 thread for 5 seconds.

 Passes: 7, Time: 5.784000, Avg: 0.826286, Limit: 1000000, Count: 0, Valid: 0
Enter1he;7;5.784000;1;algorithm=other,faithful=no,bits=64

The issues are:

Enter1he commented 1 year ago

Yep, final fix - the problem was clock function. Because originally written on Windows - clock was a real big mistake to use(WIndows handles it different) Now even in wsl everything works fine.

rbergen commented 1 year ago

It seems your Dockerfile no longer works. I believe this is because you changed the name of the executable file from "Sieve" to "Sieve.exe", and did not update your Dockerfile accordingly.

Disregarding that for a second, I took a closer look at your program's logic and I'm sorry to say we cannot accept this solution in its current form. What the program seems to do is run a sieve once (I say "a" sieve because I have difficulty identifying the algorithm as the Sieve of Eratosthenes). It then reports:

That's too far of a deviation from the contributing guidelines to be admissible as a solution for this project.

Some of the basic rules that apply to solutions in this repo are:

If you would still like to submit a solution in the Terra language, I encourage you to read the contributing guidelines in full. Then, please make sure your solution complies with the guidelines and works correctly in a Linux-based Docker container before requesting a(nother) review.

Enter1he commented 1 year ago

I still need some help to classify my new solution. Can it be classify as faithfull? And is my bit array can be classified as is_prime array or I should specifically make a boolean one? I don't see any of those in PrimeCPP solution_1 on which I'm usually trying to compare mine.

rbergen commented 1 year ago

It looks to me like your solution now creates and destructs the Primes struct with every pass, which is an important criterion for a faithful solution. With that in place, I do think your solution can be considered faithful. Your bit array can indeed be considered a suitable is_primes array as it is, so returning it will suffice to meet that requirement.

Enter1he commented 1 year ago

I added workdir to dockerfile.

rbergen commented 1 year ago

Thank you, I've taken the liberty of making it an absolute directory (/opt/app instead of opt/app). CI is now running.