I have seen the latter two. And Zortech used to sell the Fortran to C translator. I probably still have a copy in my office. I used it to make the original translation of the CB source to C back in 1994. The code was not very clean looking, because it was just a one-for-one translation to C. And since FORTRAN didn't have pointers in the f77 standard, the resulting C code did not use pointers. So it needed a lot of cleaning up to become "decent C". But the output of the translator would compile and run and produce identical results to the original FORTRAN program.Dann Corbit wrote:Basic to C++?bob wrote:I don't agree with those.Dann Corbit wrote:Typical reasons for rewriting:Don wrote:I don't rewrite just for the sake of it.Houdini wrote:Rewriting for the sake of rewriting doesn't serve any purpose at all.Don wrote:I think you are correct. I personally AM a fan of rewrites but I think there are many chess authors that don't ever rewrite, or have only done so once in years.
Software with a good architecture will survive many years and many changes.
1. Change of language (e.g. C to C++)
2. Change of underlying data structures (e.g. mailbox to bitboard)
3. Increased programming ability (every decade, my programming skills increase quite a bit, so the code I wrote 20 years ago will benefit considerably from a rewrite).
4. Lost code (yes, it does happen -- I have sent code back to chess authors who lost their original code and who had also sent their code to me on several occasions, for instance).
(1) can be solved via translation. A good program can be translated to a new language without rewriting a thing...
Pascal to Java?
Fortran to C?
I think there is even a GNU fortran to C translator. I have not used it, but have noticed it in installing several different Linux distros. Something like f2c or something. But no info on how well it works...
I can't speak for everyone, but I produce a lot more than 10 lines per hour. Don't forget, half of those 40K + lines of code are simply comments that don't need translation, and also help in understanding... I would suspect it would take a year of solid work to rewrite Crafty from scratch, assuming I could access the comments but not the source instructions, to get it back to something close to the current state. Might take longer to get the speed back to where it is...Crafty is a giant machine with nearly 40K lines of code. At ten lines per hour and $100/hour that would translate to $400,000 worth of work. It would be a titanic effort, therefore, to rewrite crafty. Smaller programs of a few hundred lines would be far more likely candidates for such an effort.(2) I did the mailbox-to-bitboard translation with Crafty. It only affects a part of the code. Search is unchanged. Move ordering is unchanged. Several other things are completely board representation independent.
I lost about 80% of everything in 1995. Not the current version as it is always kept in multiple locations such as my office box, my laptop, and a central NFS file server on top of that. But old versions I kept only on my office box and a disk crash and later discovery that all backups were unreadable lost a lot of old stuff. I now have everything stored in three places, with a simple mechanism to scatter the duplicates to the right places after a change is made...I have done it, but typically with small projects. TSCP needs a complete rewrite, for instance.(3) I don't think is that common. One does not rewrite _everything_ just because they are a better programmer now than 10 years ago. you might rewrite _parts_. But not the whole thing. That is a huge waste of time and effort.It is the result of carelessness when code is lost, but it does happen. I suspect that you have lost at least one or more snapshot of a released version of Cray Blitz or Crafty (at least in the early stages) because with hobby projects that are not producing revenue we sometimes are not quite as careful as when a big pile of money is at stake.(4) Never had that happen to the current version of code since I always keep duplicates and backups scattered around.