I want first of all say thanks to the support received last time regarding my little troubles with the graphic recognition and window operations.
I finished the graphic recognition and the windows focusing/sizing part of my coding, and i also realized some others parts that seem properly working. Now i'm in need to do some operation with the text of a file, where a program write some text.
I don't know the file format, but opening it with notepad it seem delimited.
I tried to write some code for doing this operations, but i suddenly understand that this is over my possibilities (for the moment) without the proper support, hints or gift of part of codes. The code that i tried to write is not working at all, so i decided to don't post my part of already written code asking for the possible mistakes, because i think that this time acting in this way will be fully unuseful; i spent some time in a detailed description of what i need to do.
I will be glad to all who want to give to me suggestions on how to realize or write part of the code that i need, or write parts of this procedure for me.
This is the text that can be found on the file that i need to parse.
Code: Select all
BGF version 1.1
INFO: stake 1.50 limit 3.00
Game 1 - Misterjoeny (0) vs. Rocon23 (X)
Single Game
1. X: (2 4) 8/6 13/9
2. 0: (6 2) 24/16*
3. X: (1 6) bar/18
4. 0: (6 4) 13/7* 24/20
5. X: (3 6) bar/22 24/18*
6. 0: (2 6) bar/23 13/7*
7. X: (4 3) bar/18*
8. 0: (2 4) bar/23 20/16
9. X: (4 5) 22/18 13/8
10. 0: (5 4) 13/8 6/2
11. X: (3 4) 13/6
12. 0: (6 3) 8/2 23/20
13. X: (5 3) 6/1 24/21
14. 0: (5 2) 23/18 20/18
15. X: (6 4) 8/2 6/2
16. 0: (4 2) 8/4* 6/4
17. X: (4 4) can't move
18. 0: (6 1) 16/9
19. X: (1 4) bar/24 13/9*
20. 0: (5 6) bar/20 18/12*
21. X: (6 4) can't move
22. 0: (4 6) 20/16*/10
23. X: (1 2) bar/24
24. 0: (6 5) 18/12 9/4
25. X: (1 2) bar/24 8/6
26. 0: (6 4) 10/4 12/8
27. X: (5 5) 18/13* 18/13 6/1 6/1
28. 0: (6 1) can't move
29. X: (2 3) 8/6 13/10
30. 0: Double
31. 0: (4 6) bar/15*
32. X: (2 2) can't move
33. 0: (3 2) 15/12* 13/11
34. X: (1 1) bar/24
35. 0: (3 1) 8/5 6/5
36. X: (5 5) can't move
37. 0: (4 3) 13/6
38. X: (1 6) bar/18
39. 0: (2 1) 12/10 11/10
40. X: (5 5) 18/3 6/1
41. 0: (3 3) 10/7 10/7 8/2
42. X: (4 4) 6/2 6/2 6/2 6/2
43. 0: (6 2) 8/2 4/2
44. X: (1 1) 3/2
45. 0: (5 6) 7/2
46. X: (6 2) 24/18*/16
47. 0: (4 3) bar/18
48. X: (6 2) 24/16
49. 0: (4 2) 18/12
50. X: (5 4) 16/11 16/12
51. 0: (5 2) 12/5
52. X: (3 2) 12/9 11/9
53. 0: (6 4) 6/off 4/off
54. X: (5 3) 9/4 9/6
55. 0: (3 1) 6/3 6/5
56. X: (5 6) 6/1 24/18
57. 0: (5 1) 5/off 3/2
58. X: (2 2) 18/10
59. 0: (6 1) 5/off 2/1*
60. X: (3 3) bar/22 10/1
61. 0: (5 1) 5/off 5/4
62. X: (6 4) 22/12
63. 0: (5 2) 4/off 2/off
64. X: (4 3) 12/5
65. 0: (6 1) 4/off 1/off
66. X: (5 4) 5/off 4/off
67. 0: (3 2) 4/1 2/off
68. X: (1 4) 1/off 2/off
69. 0: (6 4) 2/off 2/off
70. X: (6 5) 2/off 2/off
71. 0: (5 5) 2/off 2/off 1/off
Misterjoeny Win the Match (2-0)
(Ex. ActivePlayer=Rocon23) so, assuming that i already have a variable called ActivePlayer with the value Rocon23 i need to compare the result of the text analysys with the variable ActivePlayer for know the symbol that identify my known player, and store this results to a variable (Ex. ActivePlayerSymbol=X)
Code: Select all
Misterjoeny (0) vs. Rocon23 (X)
Code: Select all
1. X: (2 4) 8/6 13/9
The part that i need to analyze is the following.
Code: Select all
X:
0:
after this i must parse this part
Code: Select all
(2 4)
In only one case this value can not be present.
This is the case
Code: Select all
30. 0: Double
And, as follow i need to recognize the final part of a move, a value like this.
Code: Select all
8/6 13/9
bar/24 8/6
18/13* 18/13 6/1 6/1
5/off 2/1*
This part of the text to parse is composed by 1 to 4 text part separated by the slash character "/". Generally every text part is composed by 2 numbers between 1 and 24 separated by / . Sometimes the value that come before the / can be "bar". Sometimes the text part to analyze can be followed by this character "*". in this case i simply need to not store this character (*). Sometimes the second part after the / can be "off". I need to store the value of this possible 4 text part in 4 variable.
If only 1, or 2, or 3 and not all four is present, write 0 to others
(Ex. LastMove1=8/6 LastMove2=13/9 LastMove3=0 LastMove4=0)
(Ex2. LastMove1=bar/24 LastMove2=8/6)
(Ex3. LastMove1=18/13 LastMove2=18/13 LastMove3=6/1 LastMove4=6/1)
(Ex4. LastMove1=5/off LastMove2=2/1 LastMove3=0 LastMove4=0)
Last thing
Sometime the last value to parse can be "special" like those ones
Code: Select all
17. X: (4 4) can't move
30. 0: Double
(Ex. LastMove1=0 LastMove2=0 LastMove3=0 LastMove4=0 LastMoveSpecial=can't move)
(Ex2. LastMove1=0 LastMove2=0 LastMove3=0 LastMove4=0 LastMoveSpecial=Double)
When finished i will call another procedure that i have already written that will use the variable data obtained for the operations that must be done.
When the called procedure has finished his operations, the called procedures will be recall this one for a new analysis. When recalled this one must constantly watch the text file (like every 0.4 seconds) waiting for the appearing of a new line. (if the previous line analyzed has started with 1. the new line will start with 2. and so on) for repeat this procedure with the new line. The variable can be overwrited on the new analysis.
Of course i will place a stop condition for not fall in a loop.
I hope that my description is enough detailed, and i thank you all in advance for all the kind of help that you want to give me.
Best Regards