CSV file reader

Norm Koger's The Operational Art of War III is the next game in the award-winning Operational Art of War game series. TOAW3 is updated and enhanced version of the TOAW: Century of Warfare game series. TOAW3 is a turn based game covering operational warfare from 1850-2015. Game scale is from 2.5km to 50km and half day to full week turns. TOAW3 scenarios have been designed by over 70 designers and included over 130 scenarios. TOAW3 comes complete with a full game editor.

Moderators: ralphtricky, JAMiAM

Post Reply
User avatar
larryfulkerson
Posts: 41287
Joined: Sat Apr 16, 2005 9:06 pm
Location: Tucson, AZ,usa,sol, milkyway
Contact:

CSV file reader

Post by larryfulkerson »

Hey you guys: I found the link to my CSV file viewer dead so I uploaded it to a file server again just now.

Click here for the CSVviewer.exe file

The CSV file is one of the sitrep files that get output by the game engine when you authorize it by setting
the appropriate switches on the Play->Player Options screen and turn on the sitrep logs. I use that as
the input file and produce something like below.

Image
Attachments
temp.gif
temp.gif (19.04 KiB) Viewed 161 times
Vet to another vet: "When I get home I'm going to make love with the wife and then set the luggage down and close the door."
User avatar
larryfulkerson
Posts: 41287
Joined: Sat Apr 16, 2005 9:06 pm
Location: Tucson, AZ,usa,sol, milkyway
Contact:

RE: CSV file reader

Post by larryfulkerson »

I used the CSV file from my PBEM game with Thomas Harvey (he's handing me my head ) and got some spurious results. The problem
is the quotes in the name field(s) in the CSV file. I'm going to change my program to look for the comma between fields instead of the
quote mark. Stay tuned. I'll post another version as soon as I've fixed this bad boy.

Image
Attachments
temp.gif
temp.gif (87.77 KiB) Viewed 161 times
Vet to another vet: "When I get home I'm going to make love with the wife and then set the luggage down and close the door."
tcarusil
Posts: 219
Joined: Sun May 01, 2011 12:50 pm
Location: Indianapolis, IN

RE: CSV file reader

Post by tcarusil »

Looks like the problem is that the log is adding quotation marks before and after the nickname of the Japanese planes. Compare the "SBD Dauntless" with the "A5M "Claude"". I wonder where those extra quotation marks are coming from. Could it be something in the equipment file? Hopefully, parsing by commas will do the trick.

TomC
User avatar
larryfulkerson
Posts: 41287
Joined: Sat Apr 16, 2005 9:06 pm
Location: Tucson, AZ,usa,sol, milkyway
Contact:

RE: CSV file reader

Post by larryfulkerson »

ORIGINAL: tcarusil
Looks like the problem is that the log is adding quotation marks before and after the nickname of the Japanese planes. Compare the "SBD Dauntless" with the "A5M "Claude"". I wonder where those extra quotation marks are coming from. Could it be something in the equipment file? Hopefully, parsing by commas will do the trick.
I like that idea Tom dude. Maybe the names of the equipment in the equipment file have an extra Quote mark. This is a problem that
could probably be fixed but on the other hand my program has to be able to handle it. So I'm going to come up with a new version.
I was working on it last night and I'm on the cusp of a breakthrough. I couldn't find the source code so I'm recreating it by hand. It's a
laborous process as you can imagine.
Vet to another vet: "When I get home I'm going to make love with the wife and then set the luggage down and close the door."
tcarusil
Posts: 219
Joined: Sun May 01, 2011 12:50 pm
Location: Indianapolis, IN

RE: CSV file reader

Post by tcarusil »

I've never had cause to use the equipment editor, but this riddle kept nagging me. I downloaded the editor and sure enough unlike the other aircraft, the Japanese aircraft have their "nicknames" in quotes. Not sure which would be easier, rewriting your program or editing the 30 odd Japanese aircraft in the equipment file.

TomC
User avatar
larryfulkerson
Posts: 41287
Joined: Sat Apr 16, 2005 9:06 pm
Location: Tucson, AZ,usa,sol, milkyway
Contact:

RE: CSV file reader

Post by larryfulkerson »

ORIGINAL: tcarusil
I've never had cause to use the equipment editor, but this riddle kept nagging me. I downloaded the editor and sure enough unlike the other aircraft, the Japanese aircraft have their "nicknames" in quotes. Not sure which would be easier, rewriting your program or editing the 30 odd Japanese aircraft in the equipment file.
Whether or not you edit your equipment file I still want my program to handle "dirty" data without crashing. I've not programmed a
computer in about 15 years but I'm rapidly picking it up and making my way. I couldn't find the source code, did I tell you guys that?
So I'm recreating it from fresh scratch and I've gotten to where I'm tweaking the spacing on the various columns. I want to make it
look pretty. I'll keep you guys in the loop and post something soon.
Vet to another vet: "When I get home I'm going to make love with the wife and then set the luggage down and close the door."
User avatar
shunwick
Posts: 2427
Joined: Sat Oct 14, 2006 10:20 pm

RE: CSV file reader

Post by shunwick »

Larry,

Would it be possible to add a table of total losses after every turn? Or is loss information not listed in the csv file?

Best wishes,
Steve
I love the smell of TOAW in the morning...
User avatar
larryfulkerson
Posts: 41287
Joined: Sat Apr 16, 2005 9:06 pm
Location: Tucson, AZ,usa,sol, milkyway
Contact:

RE: CSV file reader

Post by larryfulkerson »

ORIGINAL: shunwick
Would it be possible to add a table of total losses after every turn? Or is loss information not listed in the csv file?
Of course it's possible my friend. I'm only just now getting some output worth publishing. I've gotten it to read the
input data and parse the CSV file and construct some records that look useful. I've got to save the input records in
their processed form so I can do the totals per turn and so on. I'm hopeful I can get the HTML record to have the
equipment pictures and everything. I've been working on it day and night for the past couple of of days now. I'm
learning how to program all over again. It's pretty cool all things considered.

Image
Attachments
temp.gif
temp.gif (91.25 KiB) Viewed 161 times
Vet to another vet: "When I get home I'm going to make love with the wife and then set the luggage down and close the door."
User avatar
shunwick
Posts: 2427
Joined: Sat Oct 14, 2006 10:20 pm

RE: CSV file reader

Post by shunwick »

Great stuff. How about a keeping a running total of all losses throughout the scenario?

Best wishes,
Steve
I love the smell of TOAW in the morning...
User avatar
larryfulkerson
Posts: 41287
Joined: Sat Apr 16, 2005 9:06 pm
Location: Tucson, AZ,usa,sol, milkyway
Contact:

RE: CSV file reader

Post by larryfulkerson »

ORIGINAL: shunwick
Great stuff. How about a keeping a running total of all losses throughout the scenario?
I don't see why that can't be done, in principle. I'd have to invent a separate file to keep the running totals for all the files read in
so far and up-date it to reflect current numbers to date. But that's doable I think.

And by the way, here's the way to turn on these CSV records. On the menu choose Play->Player Options or something like that
and you'll be presented with all the different options. Turn on the one pertaining to the sitrep log files. And then restart TOAW.
You'll start to collect a bunch of them. One for each turn. And then the next thing to try to make happen is the ability to read a
list of files and process all of them at one time and keep a running total of all of them. It's only milli-seconds for processing a typical
turn so doing about 10 of them would take the blink of an eye I'm guessing. And then I could put a checkbox on there if you wanted
the file produced to be presented in your browser. Or presenting the HTML file produced in my own mini-browser built in so that
the output could be checked without going to your external browser to see it.

You guys tell me how you'd like to use it and I'll see if I can't design it to do that. So far I'm getting the idea that running totals would
be a good idea. I'll work on that. Anything else?

Image
Attachments
temp.gif
temp.gif (156.32 KiB) Viewed 161 times
Vet to another vet: "When I get home I'm going to make love with the wife and then set the luggage down and close the door."
User avatar
larryfulkerson
Posts: 41287
Joined: Sat Apr 16, 2005 9:06 pm
Location: Tucson, AZ,usa,sol, milkyway
Contact:

RE: CSV file reader

Post by larryfulkerson »

Okie dokie.......I've gotten it to put out all the elements of the loss report now I just need to put a bow on it and put it in the mailbox.
I'm thinking I can put something together to do running totals and stuff.

Image
Attachments
temp.gif
temp.gif (49.1 KiB) Viewed 161 times
Vet to another vet: "When I get home I'm going to make love with the wife and then set the luggage down and close the door."
Post Reply

Return to “Norm Koger's The Operational Art Of War III”