From: "Jesús Gabriel y Galán" Date: 2012-08-03T22:22:44+09:00 Subject: Re: Having difficulty processing text files - some techniques? On Fri, Aug 3, 2012 at 12:07 PM, b1_ __ wrote: > How I imagined the program would work is like so: > 1. Step into first-hand-processing mode. > 2. Create hand-data hash with date, player no, blind level. > 3. Extract raw numbers and save to players raw-data text file, > organising the raw numbers using the hand-data hash made in previous > step. > 4. Clear hand-data hash. > 5. Exit first-hand-processing mode. > 6. Step into second-hand-processing mode. > 7. Create hand-data hash with date, player no., blind level. > 8. etc. This is exactly what I proposed with two exceptions: The hand data is not cleared after each Hand, so that you accumulate in that hash the data for all hands by date, players, etc. The second is that writing the file should be done at the end once. The reason is that it's easier to accumulate in a hash than in a file. Your point 3 is more complex than you think. > So no extracting all the lines of the hand and putting that into a hash > or something. The only container object created is the hand-data hash > which gets wiped on moving to the next hand. I thought maybe this would > speed up the program, exspecially if I needed to process 1000's of > hands. > > I'm not really fussed though. It's more important I understand the code > and there is some elegance about it and perhaps some expandability at > this stage. If it's too confusing to use nested state machines I'm happy > to use whatever is suggested. > > I'm not a fast reader of code so still digesting what you've posted... Hope you get some ideas, Jesus.