Ok. I have a connect 4 program working fine, the game plays and all is good. What I want to do is allow a player to save the game in its current state, and load it back up again. The best way of doing this in the context of my program is to create a new text file containing all relevent variables for each saved game so as to make parsing relatively simple.
Obviously this will mean that a user can't make two text files with the same name otherwise problems will occur! Therefore I need a method to look at the current directory (ie the one the java file is in) for text files with the same name as the one the user specified. If there is one with the same name then the method should return an error and the user should be forced to type in a new name etc etc. My UI is entirely text-based by the way!
Anyone got any ideas, algorithms, links as to how I could go about this?
Cheers bluds.