Class BoardManager


  • public class BoardManager
    extends Object
    Reading and writing Boards to CSV files
    • Constructor Detail

      • BoardManager

        public BoardManager()
    • Method Detail

      • readBoardFile

        public static HashMap<String,​Board> readBoardFile​(File f,
                                                                HashMap<String,​Boolean> useImagesTable)
                                                         throws IOException,
                                                                IllegalInputException
        Reads a CSV file into which a number of boards have been written by Board.saveToFile().

        Since GS 8.0, every game piece needs an ID. Previously, unfortunately, those weren't saved; so when reading old (pre-GS-8.0) board files, this method assigns to each object a "substitute ID", which just happens to be equal to its position number. (When transcripts are read in, substutute IDs are assigned in the same way, so everything matches. Now, the old detailed transcripts do have true IDs in them, but we aren't using them).

        When reading a board, this method checks for duplicates (based on the real or substutute ID) and drops them. Such duplicates may occur because the episode-saving routine may very occasionally save the same episode twice by mistake.

        Parameters:
        f - A player's boards file, from the saved/boards directory.
        useImagesTable - Contains info which episodes use image-and-properties objects. One can supply null here, for use in a unit test on a known non-IPB player.
        Returns:
        A hash map that maps episode IDs to initial boards.
        Old:
        //#playerId,episodeId,y,x,shape,color
        //vmf001,20201008-131657-06RY9E,4,1,STAR,YELLOW
        New (thru ver 7.*):
        //#playerId,episodeId,y,x,shape,color,objectType
        //vm-2021-08-29-b,20210829-224113-YWLKSX,1,2,STAR,RED,RED_STAR
        
        // from ver 8.0
        "#playerId,episodeId,objectId,y,x,shape,color,objectType"
        Throws:
        IOException
        IllegalInputException