This site requires JavaScript, please enable it in your browser!
Greenfoot back
SweetCaroline36
SweetCaroline36 wrote ...

2018/11/30

Greenfoot Terminal won't open. Tried previous solutions to no avail

SweetCaroline36 SweetCaroline36

2018/11/30

#
The greenfoot icon is open in my taskbar, but I can't see it on screen. I've tried moving it with shift click, doesn't work. I looked in properties as many other people have suggested and the x and y were at 16. I deleted them anyway like another suggestion said, and nothing changed. What do I do?
SweetCaroline36 SweetCaroline36

2018/11/30

#
I just noticed this is the case for only one program I'm working on. The others open just fine. I'm not sure if it's a code problem or what, so here's one of my classes. It's still in progress so pretty messy rn
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.util.HashSet;

/**
 * Write a description of class MyWorld here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class MyWorld extends World
{
    public static int ybounds = 5;
    public static int xbounds = 5;
    public Square[][] sq = new Square[xbounds][ybounds];
    private HashSet<Square> blankChunk;
    public static int totalBombs = 0;
    public static int totalNotBombs;
    public MyWorld()
    {    
        // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
        super(1500, 900, 1); 
        
        for(int i = 0; i<xbounds; i++)
        {
            for(int j = 0; j<ybounds; j++)
            {
                sq[i][j] = new Square();
            }
        }
        blankChunk = new HashSet<Square>();
        setBombs();
        setAdj();
        setBlanks();
        //setAdjToBlank();
        
        totalNotBombs = (ybounds*xbounds) - totalBombs;
        //revealChunk();
        createMap();
        
    }
    
    public void createMap()
    {
        for(int i = 0; i<xbounds; i++)
        {
            for(int j = 0; j<ybounds; j++)
            {
                addObject(sq[i][j], i*100 + 50, j*100 + 50);
            }
        }
    }
    
    // public void revealChunk()
    // {
        // for(int i = 0; i<bounds; i++)
        // {
            // for(int j = 0; j<bounds; j++)
            // {
                // if(sq[i][j].adjacentToBlank)
                // {
                    
                // }
            // }
        // }
    // }
    public void revealChunk()
    {
        if(Square.clickedBlank)
        {
            for(int i = 0; i<xbounds; i++)
            {
                for(int j = 0; j<ybounds; j++)
                {
                     //if(sq[i][j].adjacentToBlank)
                     //{
                         //sq[i][j].setNumberImage();
                     //}
                }
            }
           
        }
    }
    
    public void setBombs()
    {
        for(int i = 0; i<xbounds; i++)
        {
            for(int j = 0; j<ybounds; j++)
            {
                if(Greenfoot.getRandomNumber(5) > 3)
                {
                    sq[i][j].setBomb();
                    totalBombs++;
                }
            }
        }
    }
    public void setAdj()
    {
        for(int i = 0; i<xbounds; i++)
        {
            for(int j = 0; j<ybounds; j++)
            {
                if(sq[i][j].isBomb)
                {
                    if(inBounds(i+1,j))
                    {
                       if(!sq[i+1][j].isBomb)
                       {
                           sq[i+1][j].setAdjacent();
                           sq[i+1][j].addBombAround();
                           //totalAdj++;
                       }
                    }
                    if(inBounds(i+1, j+1))
                    {
                       if(!sq[i+1][j+1].isBomb)
                       {
                           sq[i+1][j+1].setAdjacent();
                           sq[i+1][j+1].addBombAround();
                           //totalAdj++;
                       }
                    }
                    if(inBounds(i+1, j-1))
                    {
                       if(!sq[i+1][j-1].isBomb)
                       {
                           sq[i+1][j-1].setAdjacent();
                           sq[i+1][j-1].addBombAround();
                           //totalAdj++;
                       }
                    }
                    if(inBounds(i, j+1))
                    {
                       if(!sq[i][j+1].isBomb)
                       {
                           sq[i][j+1].setAdjacent();
                           sq[i][j+1].addBombAround();
                           //totalAdj++;
                       }
                    }
                    if(inBounds(i-1, j))
                    {
                       if(!sq[i-1][j].isBomb)
                       {
                           sq[i-1][j].setAdjacent();
                           sq[i-1][j].addBombAround();
                           //totalAdj++;
                       }
                    }
                    if(inBounds(i-1, j+1))
                    {
                       if(!sq[i-1][j+1].isBomb)
                       {
                           sq[i-1][j+1].setAdjacent();
                           sq[i-1][j+1].addBombAround();
                           //totalAdj++;
                       }
                    }
                    if(inBounds(i-1, j-1))
                    {
                       if(!sq[i-1][j-1].isBomb)
                       {
                           sq[i-1][j-1].setAdjacent();
                           sq[i-1][j-1].addBombAround();
                           //totalAdj++;
                       }
                    }
                    if(inBounds(i, j-1))
                    {
                       if(!sq[i][j-1].isBomb)
                       {
                           sq[i][j-1].setAdjacent();
                           sq[i][j-1].addBombAround();
                           //totalAdj++;
                       }
                    }
                }
            }
        }
    }
    public void setBlanks()
    {
        for(int i = 0; i<xbounds; i++)
        {
            for(int j = 0; j<ybounds; j++)
            {
                if(!sq[i][j].isBomb && !sq[i][j].isAdjacent)
                {
                    sq[i][j].setBlank();
                }
            }
        }
    }
    // public void setAdjToBlank()
    // {
        // for(int i = 0; i<xbounds; i++)
        // {
            // for(int j = 0; j<ybounds; j++)
            // {
                // if(sq[i][j].blank)
                // {
                    // if(inBounds(i+1,j))
                    // {
                       // if(!sq[i+1][j].blank)
                       // {
                           // sq[i+1][j].setAdjacentToBlank();
                       // }
                    // }
                    // if(inBounds(i+1, j+1))
                    // {
                       // if(!sq[i+1][j+1].blank)
                       // {
                           // sq[i+1][j+1].setAdjacentToBlank();
                       // }
                    // }
                    // if(inBounds(i+1, j-1))
                    // {
                       // if(!sq[i+1][j-1].blank)
                       // {
                           // sq[i+1][j-1].setAdjacentToBlank();
                       // }
                    // }
                    // if(inBounds(i, j+1))
                    // {
                       // if(!sq[i][j+1].blank)
                       // {
                           // sq[i][j+1].setAdjacentToBlank();
                       // }
                    // }
                    // if(inBounds(i-1, j))
                    // {
                       // if(!sq[i-1][j].blank)
                       // {
                           // sq[i-1][j].setAdjacentToBlank();
                       // }
                    // }
                    // if(inBounds(i-1, j+1))
                    // {
                       // if(!sq[i-1][j+1].blank)
                       // {
                           // sq[i-1][j+1].setAdjacentToBlank();
                       // }
                    // }
                    // if(inBounds(i-1, j-1))
                    // {
                       // if(!sq[i-1][j-1].blank)
                       // {
                           // sq[i-1][j-1].setAdjacentToBlank();
                       // }
                    // }
                    // if(inBounds(i, j-1))
                    // {
                       // if(!sq[i][j-1].blank)
                       // {
                           // sq[i][j-1].setAdjacentToBlank();
                       // }
                    // }
                // }
            // }
        // }
    // }
    
    public boolean inBounds(int r, int c)
    {
        if((r < 0 )||( c < 0 )||( r > xbounds-1 )||( c > ybounds-1))
        {
            return false;
        }
        else
        {
            return true;   
        }
    }
}
danpost danpost

2018/11/30

#
If on a Windows system, try hovering over task bar icon; then, move to mini-image and right click to select "Maximize".
You need to login to post a reply.