Package edu.wisc.game.saved

## Class BoardManager

- java.lang.Object
- - edu.wisc.game.saved.BoardManager

-     public class BoardManager
      extends Object

  Reading and writing Boards to CSV files

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BoardManager()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static HashMap<String,​Board>` | `readBoardFile​(File f, HashMap<String,​Boolean> useImagesTable)` | Reads a CSV file into which a number of boards have been written by Board.saveToFile().
    `static void` | `saveToFile​(Board b, String pid, String eid, File f)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BoardManager

          public BoardManager()

  - ### Method Detail

    - #### saveToFile

          public static void saveToFile​(Board b,
                                        String pid,
                                        String eid,
                                        File f)

    - #### 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`