Author: Robert Hyatt
Date: 11:45:10 09/08/04
Go up one level in this thread
On September 08, 2004 at 11:24:21, Uri Blass wrote: >1)if (strchr(input_buffer,'\r')) *strchr(input_buffer,'\r')=' '; > >What is the meaning of \r? > carriage return character. Some systems (dos/windows) terminate each line of a text file with a CR/LF pair. Unix only terminates lines with a LF. I strip the CR out so that it doesn't mangle my parsing with an unknown character. >I see Carriage return in the help file but it does not help me much because I do >not understand what is carriage return when it is clear that is not a new line > CR = 0x0D, LF = 0x0A >I also do not understand why there is checking for the case that a new line >appears in buffer(Crafty does the same for "\n") I don't want to have to parse over the terminating characters. a "read()" reads everything into the user's buffer, including the CR/LF if present. I just remove 'em. > >It seems to me to be impossible when fgets was used to read input_buffer Better test it. :) fgets() will give you the LF or CR/LF on the end, every time. > >2) >bracket1=strchr(input_buffer,'\"'); >if (bracket1 == 0) return(1); >bracket2=strchr(bracket1+1,'\"'); >if (bracket2 == 0) return(1); > >I understand that bracket1 should be a pointer to the first appearence of >\" but there is no explanation what \" means standard C. You can't put a " character into a string like this: """ as the compiler will not parse that correctly. You "quote" the quote mark by using this: "\"" that represents a string with a single " as its contents... > >I want to have a function to understand pgn file and I do not like to try it by >copying something that I do not understand but I also do not want to try it by >doing something based on my understanding because I am afraid that my >understanding is wrong and even if I do not see why Crafty does something there >is a reason to do it. > >3)I thought that one of the important things to know in pgn file may be the >rating of the player but unfortunately I see no rating in examples of pgn file >in http://www.ex.ac.uk/~dregis/DR/Standard.txt It isn't a required tag, so you can not depend on it being present. That is one of many problems with the PGN standard... > >[Event "F/S Return Match"] >[Site "Belgrade, Serbia JUG"] >[Date "1992.11.04"] >[Round "29"] >[White "Fischer, Robert J."] >[Black "Spassky, Boris V."] >[Result "1/2-1/2"] > >1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 >O-O 9. h3 Nb8 10. d4 Nbd7 11. c4 c6 12. cxb5 axb5 13. Nc3 Bb7 14. Bg5 b4 15. >Nb1 h6 16. Bh4 c5 17. dxe5 Nxe4 18. Bxe7 Qxe7 19. exd6 Qf6 20. Nbd2 Nxd6 21. >Nc4 Nxc4 22. Bxc4 Nb6 23. Ne5 Rae8 24. Bxf7+ Rxf7 25. Nxf7 Rxe1+ 26. Qxe1 Kxf7 >27. Qe3 Qg5 28. Qxg5 hxg5 29. b3 Ke6 30. a3 Kd6 31. axb4 cxb4 32. Ra5 Nd5 33. >f3 Bc8 34. Kf2 Bf5 35. Ra7 g6 36. Ra6+ Kc5 37. Ke1 Nf4 38. g3 Nxh3 39. Kd2 Kb5 >40. Rd6 Kc5 41. Ra6 Nf2 42. g4 Bd3 43. Re6 1/2-1/2 > > >I am not sure about clear instructions where the rating should appear and I do >not like to read all the content of the link that I gave espacially when I am >not sure that there is information about the rules of wring rating. > >Uri
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.