- #1
fluidistic
Gold Member
- 3,924
- 261
Hello guys!
There's an open source chess engine (Stockfish) that I really like and I always want the latest version. The project is so active that there's approximately a new version every day. I decided to make a script that auto downloads the code, auto compile Stockfish, auto move the executable to a folder I want, auto rename another file (for the settings of the engine) and auto remove the unnecessary files and folders. I have succeeded in doing this.
However I wish to include a new part in my script: I want to edit the code of Stockfish (a file more precisely, called endgame.cpp) prior to compiling it, but I don't know how to use "vi" nor a similar program to do so. In fact I don't even know programming.
Because the project is very active, they may modify endgame.cpp and so the lines I want to modify may not be "constant". I.e. maybe today I want to modify lines 25 to 32 but tomorrow this would be lines 37 to 44.
More precisely, I want to comment the lines
so that the new/modified code would look like:
I have done some google searches but I don't really know how to do it. I guess I'd have to type a command to "search" a line, comment it, "search" another line, comment it, etc. until the last line and then "save" the file.
Any help is appreciated, thank you!
There's an open source chess engine (Stockfish) that I really like and I always want the latest version. The project is so active that there's approximately a new version every day. I decided to make a script that auto downloads the code, auto compile Stockfish, auto move the executable to a folder I want, auto rename another file (for the settings of the engine) and auto remove the unnecessary files and folders. I have succeeded in doing this.
However I wish to include a new part in my script: I want to edit the code of Stockfish (a file more precisely, called endgame.cpp) prior to compiling it, but I don't know how to use "vi" nor a similar program to do so. In fact I don't even know programming.
Because the project is very active, they may modify endgame.cpp and so the lines I want to modify may not be "constant". I.e. maybe today I want to modify lines 25 to 32 but tomorrow this would be lines 37 to 44.
More precisely, I want to comment the lines
Code:
add<KPK>("KPK");
add<KNNK>("KNNK");
add<KBNK>("KBNK");
add<KRKP>("KRKP");
add<KRKB>("KRKB");
add<KRKN>("KRKN");
add<KQKP>("KQKP");
add<KQKR>("KQKR");
add<KNPK>("KNPK");
add<KNPKB>("KNPKB");
add<KRPKR>("KRPKR");
add<KRPKB>("KRPKB");
add<KBPKB>("KBPKB");
add<KBPKN>("KBPKN");
Code:
// add<KPK>("KPK");
// add<KNNK>("KNNK");
// add<KBNK>("KBNK");
// add<KRKP>("KRKP");
// add<KRKB>("KRKB");
// add<KRKN>("KRKN");
// add<KQKP>("KQKP");
// add<KQKR>("KQKR");
// add<KNPK>("KNPK");
// add<KNPKB>("KNPKB");
// add<KRPKR>("KRPKR");
// add<KRPKB>("KRPKB");
// add<KBPKB>("KBPKB");
// add<KBPKN>("KBPKN");
I have done some google searches but I don't really know how to do it. I guess I'd have to type a command to "search" a line, comment it, "search" another line, comment it, etc. until the last line and then "save" the file.
Any help is appreciated, thank you!