📄 queryrobot.java
字号:
/**
* Robot masters everything which UrRobt masters. Further he is able to recieve
* informations from its environment.
*/
public class QueryRobot extends UrRobot
{
/**
* As like the class UrRobot the class UrRobot contains only one constructor.
* It expects parameters where to place the robot,
* wihch direction it shows in and how many beepers it has.
* @param street The parameter street gives the street where the robot should be placed.
* @param avenue The parameter avenue gives the avenue where the robot should be placed.
* @param direction The parameter direction gives the direction which the robot looks in.
* @param beepers The parameter beepers gives the numbers of beepers the robot carries.
*/
/**/public QueryRobot( int street, int avenue, int beepers, direction dir )
{
super( street, avenue, beepers, dir );
}
/**
* @return Returns true if the robot still carries beepers else it returns false.
*/
/**/public boolean anyBeepersInBeeperBag()
{
return World.getWorld().getBeepers( robotId ) != 0;
}
/**
* @return Returns true if the robot looks east else false.
*/
/**/public boolean facingEast()
{
return World.getWorld().getDirection( robotId ) == East.getValue();
}
/**
* @return Returns true if the robot looks north else false.
*/
/**/public boolean facingNorth()
{
return World.getWorld().getDirection( robotId ) == North.getValue();
}
/**
* @return Returns true if the robot looks south else false.
*/
/**/public boolean facingSouth()
{
return World.getWorld().getDirection( robotId ) == South.getValue();
}
/**
* @return Returns true if the robot looks west else false.
*/
/**/public boolean facingWest()
{
return World.getWorld().getDirection( robotId ) == West.getValue();
}
/**
* @return Returns true if no wall, x- or y-axis infront of the robot else false.
*/
/**/public boolean frontIsClear()
{
return World.getWorld().frontIsClear( robotId );
}
/**
* @return Returns true if there are one or more beepers at the position the robot stands at.
*/
/**/public boolean nextToABeeper()
{
return World.getWorld().nextToABeeper( robotId );
}
/**
* @return Returns true if there are one or more robots at the position the robot stands at.
*/
/**/public boolean nextToARobot()
{
return World.getWorld().nextToARobot( robotId );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -