I have to make an application that can read positions from a Draughts game and update it in a diagram (10x10 board).
Im running into a lot of problems and I would appreciate any help a lot.
the positions are stored in this format.
W7,13,50:B25,30,45 C. Blankenaar (1898)
everything after W goes in the white pieces textual display (jTextframe)
everything after B goes in the black pieces textual display (jTextframe)
the last part goes in another seperate jTextframe
I'm reading the files with a buffered filereader, and the next step is to separate the lines and put the positions in the correct display.
I would appreciate if it you could give me any pointers how to do this.
It doesn't seem to be a tough task to me. The method must parse the file using regex and then set the values to the text frames.
You can use a regex like W.*?: to get white coordinates and then use the split method to split the coordinates from commas. Same can be done for black coordinates. I hope I have understood the problem correctly ...
I think regex is probably overkill: the positions are delimited by the first space. Perhaps just grabbing up to the space, splitting on colon, then splitting on commas would be sufficient (taking the color character into account).