import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.ArrayList; 

// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
import java.util.Scanner;
// #[regen=yes,id=DCE.F6CE6D44-4C3C-2513-7CDA-1C56335CAC50]
// </editor-fold> 
public class Risk {

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.694759CD-A2F7-0587-BAD7-FDACC2DBC956]
    // </editor-fold> 
    private ArrayList<Partida> mPartida;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.CAB22704-6619-F413-0560-47FEABF6C351]
    // </editor-fold> 
    public Risk () {
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.628FA064-11D3-5A22-ADB6-ACE8BF21B928]
    // </editor-fold> 
    public ArrayList<Partida> getPartida () {
        return mPartida;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,regenBody=yes,id=DCE.2864BC29-9B05-E9AA-07DB-1D473224DA3F]
    // </editor-fold> 
    public void setPartida (ArrayList<Partida> val) {       
        this.mPartida = val;
    }
    
    
    
    public static Partida cargarPartida()
    {
        try 
        {
            ObjectInputStream streamCargar = new ObjectInputStream(
                    new FileInputStream("PartidaGuardada.rsk"));
            return (Partida)streamCargar.readObject();
        }
        catch (Exception e) 
        {
            System.out.println(e.getMessage());
        }
        return null;
    }
    
    public static void main (String args[])
    {       
        Scanner tecla = new Scanner(System.in);
                
        Partida P;
        
        try
        {                                                                  
            System.out.print("Desea cargar una partida? (y/n): ");
            if (tecla.nextLine().charAt(0) == 'y')
                P  = cargarPartida();
            else            
                P = new Partida();
            
            P.jugar();            
        }
        catch (Exception error)
        {
            System.out.println(error.getMessage());
        }                
    }        

}

