Question: Im currently working on a tetris program I wanted to know if someone could correct the implementation of my saveToFile and retrieveFromFile methods. The saveToFile

Im currently working on a tetris program I wanted to know if someone could correct the implementation of my saveToFile and retrieveFromFile methods. The saveToFile method should allow the user to save a run of the game to a file that they are allowed to name with .gam appended to it. The retrieveFromFile should allow the user to access and display a previously played game. I wont be showing my full game just what I believe may be neccessary for the fix.
Program:
public class TetrisGame
{
private TetrisBrick fallingBrick;
private int rows =2;
private int cols =2;
private int numBrickTypes =7;
private Random randomGen;
private int[][] background;
private int state;
private int score;
public TetrisGame(int rows, int cols)
{
this.rows = rows;
this.cols = cols;
initBoard();
this.randomGen = new Random();
spawnBrick();
}
public String toString()
{
String gameFile="";
for(int row=0; row
Im currently working on a tetris program I wanted

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!