by Alupis · 12y ago · 0 comments
It just means you are using a more abstracted version of whatever.
In reality, a 111 lines of Python program is likely thousands of lines if you were to count all of the standard Python libraries and/or any 3rd party libraries used.
What if I took this program, wrapped it in say, 5 lines of Python, then said I implemented chess in 5 lines of Python? Did I really? Of course not... but it makes for a good attention grabber.
No. It's a tradition that goes back a long way. When it started it was about making code better - more efficient; faster; smaller. Part of that was the limited hardware available.
Now, when huge computing power is available to almost anyone, it's about the fun of finding that shortcut or that weird trick to remove a few lines of code.
There's some cool techniques different people use to solve some seemingly major problems in just a few characters.
I am proud to not contribute much to LOC counts on most of the teams I worked as I clean up a lot after my colleagues to keep code duplications low and pointless code out. Less code is normally easier to maintain as long as you follow some other coding practices and don't go and inline everything.
- Using an actual text representation of the board, rather than a binary. - Having separate functions for move generation, search and evaluation. - Using a python hashmap rather than a simple zobrist hash. - Using a direct piece square table rather than some compressed/generated nonsense.
I do however also think, that trying to shorten the move generation of some programs, which can be hundreds or thousands of lines, to something like this, is a good exercise in finding patterns, and has a certain beauty ;)
Clearly there's a line beyond which the code is no longer readable, but that is not to say that more lines is better, or that there is no elegance in implementing things more concisely.