DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: minesweep game

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Posts
    18

    minesweep game

    can someone tell me why it is telling me that class Bomb doesn't exist because it does. here is my code:
    Code:
    import java.io.*;
    
    
    public class MineSweep1
    {
    	static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    	static private Bomb[] bmbArry1 = new Bomb[5];
    	static private Bomb[] bmbArry2 = new Bomb[5];
    	static private char matrix[][];
    
    	public static void main(String[] args) throws IOException
    	{
    		int x,y;
    		matrix = new char[x][y];
    		boolean explode;
    		explode = false;
    
    		for(x=0;x<bmbArry1.length;x++)
    			for(y=0;y<bmbArry2.length;y++)
    			matrix[x][y] = '*';
    			System.out.println("");
    
    		while (! (explode))
    		{
    			for(x=0;x<bmbArry1.length;x++)
    			   for(y=0;y<bmbArry2.length;y++)
    			      System.out.print(matrix[x][y]+" ");
    
    			explode = GetUserInput();
    		}
    	}
    
    	static boolean GetUserInput() throws IOException
    	{
    		int userX, userY;
    		System.out.print("Please enter an X position");
    		userX = Integer.parseInt(input.readLine());
    		System.out.print("Please enter an Y position");
    		userY = Integer.parseInt(input.readLine());
    
    		return IsItABomb(userX, userY);
    	}
    
    	static boolean IsItABomb(int X, int Y)
    	{
    		boolean bigboom;
    		if(bmbArry1.GetXpos() == X)
    			bigboom = true;
    			else
    			return false;
    
    		if(bmbArry2.GetYpos() == Y)
    			bigboom = true;
    		else
    			return false;
    
    	}
    }
    and the error i am getting:
    Code:
    F:\JavaAssignments\Minesweep\MineSweep1.java:49: cannot find symbol
    symbol  : method GetXpos()
    location: class Bomb[]
    		if(bmbArry1.GetXpos() == X)
                               ^
    F:\JavaAssignments\Minesweep\MineSweep1.java:54: cannot find symbol
    symbol  : method GetYpos()
    location: class Bomb[]
    		if(bmbArry2.GetYpos() == Y)
                               ^
    2 errors
    
    Tool completed with exit code 1

  2. #2
    Join Date
    Apr 2005
    Posts
    4
    It should be if(bmbArry1[0].GetXpos() == X)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links