Just to be clear, this is not part of a moderation service Adam is a really helpful member, whether being a mod or not. The rest of the mod team is mean...Lyudmil Tsvetkov wrote:Many thanks Adam!Adam Hair wrote:Hi Lyudmil,Lyudmil Tsvetkov wrote:Hi Adam.Lyudmil Tsvetkov wrote: Many thanks Adam!!
You are an absolute whizzard. I knew I should have studied computer science once.
Many thanks also to Miguel, of course, for his precious Gaviota tool. It seems that the mods here are doing an extremely useful job, hats off.
Concerning the book, that is how a computer shines over a human: I never thought there wer so many duplicates, maybe some 4/9ths, I supposed there were some when I entered the moves, but my memory failed me.
Now, one last thing about the book: would you please give me an advice if the pgn format is the best for a book, or maybe there is some other format preferable, for example bin file? What would most engine events use?
Is it possible to also add a bin file to the download option, maybe someone could help with transforming the pgn to bin?
Finally, would you mind if I use your download address to post a brief message, maybe on the main forum, to let users know there is a new book to use?
Maybe thanks again for the incredible help!
Just to ask once again if you have some comments on the above questions of mine?
I have not checked for a few hours, so I missed your response.
I think the format that would be most used is pgn, but it would probably useful to make it available in various formats. Tomorrow (Sunday) I will upload a folder of the book in pgn, epd, bin, and possibly Arena and ChessGui formats. When I have uploaded the folder, I will share the link. You can freely post the link wherever you like.
I helped out because I admire your contributions to computer chess. I am no programmer, but I saw how I could use a text editor, a spreadsheet, and some computer chess tools to reformat your book. It took less than 4 hours total. However, if the book was 3 moves or more deep, I would have not made the effort. I have better things to do on the weekends
I will be waiting for the link.
If you are no programmer, I am unable to read this message.
I suppose all the openings now will be played with equal frequency.
I again say the mods are great.
Adam beat me to it, but I thought yesterday that the format translation was a nice exercise and I quickly hacked a ruby script. By that time, Adam posted it.
This is the ruby script that will translate your format to pgn (named lt2pgn.rb and execute it like this
ruby lt2pgn.rb book.txt > book.pgn
If Adam uses it again, it will be neede to clean up the moves (de4 ---> dxe4), and later find duplicates, but that is pretty automatic.
Miguel
PS: Ruby is fantastic, it allows me to do this even though my knowledge of ruby is extremely limited.
Code: Select all
def get_lines filename
lines = []
File.open filename, "r" do |f|
lines = f.readlines
end
return lines
end
def outputheader
puts '[Event "?"]'
puts '[Site "?"]'
puts '[Date "????.??.??"]'
puts '[Round "?"]'
puts '[White "?"]'
puts '[Black "?"]'
puts '[Result "*"]'
end
def outputtail
puts
end
def outputline a
if (a != nil)
o = ''
a.each do |x|
if (x == nil)
o += 'NIL'
else
o += x
end
o += ' '
end
puts o + '*'
else
puts 'NIL'
end
end
def getfromto a,i,d
x = []
while (i < d) do
x << a[i]
i += 1
end
x
end
#== PROGRAM STARTS =================================
linearr = get_lines ARGV[0]
current = ''
clen = 0
round = 0
linearr.each do |line|
if line != nil
line = line.chomp.strip
if (line.length > 0)
a = line.split(' ')
alen = a.length
if (round == 0)
clen = alen
newcurr = a
else
d = clen - alen
if (d < 0)
puts 'length problems'
exit 0
end
newcurr = getfromto(current,0,d)
newcurr += a
end
outputheader
outputline newcurr
outputtail
current = newcurr
round += 1
end
end
end