The Student Room Group

COMP4 and Problems with Python

For my COMP4 project, I have decided to make a program that brute forces, literally, millions of possible outcomes, due to the size of such a task, only compiled languages such as C/C++ etc, that can be significantly faster, really have any chance of completing the project. I'm quite competent with C/C++ as well as a few other compiled languages, however, none of the languages I know are excepted for the COMP4 project. After searching around however I found a rather useful tool which is a Just-in-Time compiler (That lovely word "compiler") which essentially reads through my code, compiles it, and runs it. This literally hammered the total time by a good double digit division (maybe even a triple digit, the test done without the program, Pypy2, didn't finish).

My question now is, can I package this program when sending off my project, or does my project even need to complete the problem on the examiners computer, allowing me to complete it on my own computer and just send off the proof?
(edited 7 years ago)
I doubt that you would be able to use a JIT compiler for your solution. Since in the end, the point of this task is to to create a program that other users can use, and it would be unreasonable to force users to download a JIT compiler. If (if) the examiner wants to moderate it, they have to be able to run it themselves. I would have to question why any program is going through a brute force approach, surely there must be an easier way? What are you trying to do?
Original post by BobBobson
I doubt that you would be able to use a JIT compiler for your solution. Since in the end, the point of this task is to to create a program that other users can use, and it would be unreasonable to force users to download a JIT compiler. If (if) the examiner wants to moderate it, they have to be able to run it themselves. I would have to question why any program is going through a brute force approach, surely there must be an easier way? What are you trying to do?


Peg Solitaire! There are other ways to go about completing it, but they involve particularly complicated steps, and a lot of pages to read through.
(edited 7 years ago)
Original post by xepicxmonkeyx
Peg Solitaire! There are other ways to go about completing it, but they involve particularly complicated steps, and a lot of pages to read through. Would it be alright, if I sent it off in essentially an .exe, with a seperate file for the source code?


I'm assuming the .exe is the one that PyPy made by compiling it? In that case how can you be sure that the examiners machine can run the exe file? The machine code written in the exe file might run on your machine but not on the examiners machine. I would definitely ask your teacher about this because it could be fine just to have it run on your machine and that's it. This is one of the many reasons why I dislike Python and think it's overrated. I've never heard of peg solitaire before, so I'm not sure I can help, but it may be worth going through those complicated steps to make it run quicker.
Original post by BobBobson
I'm assuming the .exe is the one that PyPy made by compiling it? In that case how can you be sure that the examiners machine can run the exe file? The machine code written in the exe file might run on your machine but not on the examiners machine. I would definitely ask your teacher about this because it could be fine just to have it run on your machine and that's it. This is one of the many reasons why I dislike Python and think it's overrated. I've never heard of peg solitaire before, so I'm not sure I can help, but it may be worth going through those complicated steps to make it run quicker.


Yeah, it probably wouldn't. I was gonna ask, but it'll have to be in a week, given the holidays, and that's not time I want to waste. Total agree with Python being overrated, I don't like most interpreted languages, excluding Js. but Python is way too slow. And Peg Solitair is a one person board game, where you have to jump one peg over one of the other 33 pegs, into an empty space, with the completed board having one remaining peg. Very difficult!

Quick Reply