Linux lorencats.com 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l
Apache/2.4.59 (Raspbian)
: 10.0.0.29 | : 216.73.216.130
Cant Read [ /etc/named.conf ]
7.3.31-1~deb10u7
root
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
Greenfoot /
scenarios /
java /
ants /
[ HOME SHELL ]
Name
Size
Permission
Action
images
[ DIR ]
drwxr-xr-x
Ant.class
2.62
KB
-rw-r--r--
Ant.java
3.65
KB
-rw-r--r--
AntHill.class
1.24
KB
-rw-r--r--
AntHill.java
1.45
KB
-rw-r--r--
AntWorld.class
1.46
KB
-rw-r--r--
AntWorld.java
2.29
KB
-rw-r--r--
Counter.class
1.48
KB
-rw-r--r--
Counter.java
1.04
KB
-rw-r--r--
Creature.class
2.49
KB
-rw-r--r--
Creature.java
5.2
KB
-rw-r--r--
Food.class
1.6
KB
-rw-r--r--
Food.java
1.88
KB
-rw-r--r--
Pheromone.class
1.14
KB
-rw-r--r--
Pheromone.java
1.39
KB
-rw-r--r--
README.TXT
368
B
-rw-r--r--
project.greenfoot
3.87
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : Creature.java
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * A creature in a simulation. The creature has a known home. It can move and head towards or away from home. * * Movement of the creature is arranged by storing a deltaX/deltaY pair: the offsets in the x/y direction * that the creature will move in the next step. The value for these is capped by the SPEED constant: * the delta values will always be in the range [-SPEED..SPEED]. * * @author Michael Kölling * @version 1.0 */ public class Creature extends Actor { /** The maximum movement speed of the ant. */ private static final int SPEED = 3; /** Current movement. Defined as the offset in x and y direction moved in each step. */ private int deltaX; private int deltaY; /** The home ant hill. */ private AntHill home; /** * Crtae a new creature with neutral movement (movement speed is zero). */ public Creature() { deltaX = 0; deltaY = 0; } /** * Set the home hill of this creature. */ public void setHomeHill(AntHill homeHill) { home = homeHill; } /** * Get the home hill of this creature. */ public AntHill getHomeHill() { return home; } /** * Walk around randomly (random direction and speed). */ public void randomWalk() { if (randomChance(50)) { deltaX = adjustSpeed(deltaX); deltaY = adjustSpeed(deltaY); } walk(); } /** * Try to walk home. Sometimes creatures get distracted or encounter small obstacles, so * they occasionally head in a different direction for a moment. */ public void walkTowardsHome() { if(home == null) { //if we do not have a home, we can not go there. return; } if (randomChance(2)) { randomWalk(); // cannot always walk straight. 2% chance to turn off course. } else { headRoughlyTowards(home); walk(); } } /** * Try to walk away from home. (Goes occasionally off course a little.) */ public void walkAwayFromHome() { if(home == null) { //if we do not have a home, we can not head away from it. return; } if (randomChance(2)) { randomWalk(); // cannot always walk straight. 2% chance to turn off course. } else { headRoughlyTowards(home); // first head towards home... deltaX = -deltaX; // ...then turn 180 degrees deltaY = -deltaY; walk(); } } /** * Adjust the walking direction to head towards the given co-ordinates. */ public void headTowards(Actor target) { deltaX = capSpeed(target.getX() - getX()); deltaY = capSpeed(target.getY() - getY()); } /** * Walk forward in the current direction with the current speed. * (Does not change direction or speed.) */ public void walk() { setLocation(getX() + deltaX, getY() + deltaY); setRotation((int) (180 * Math.atan2(deltaY, deltaX) / Math.PI)); } /** * Adjust the walking direction to head somewhat towards the given co-ordinates. This does not * always head in the same direction. The heading is slightly random (but likely to be somewhat * towards the target) to make it look more natural. */ private void headRoughlyTowards(Actor target) { int distanceX = Math.abs(getX() - target.getX()); int distanceY = Math.abs(getY() - target.getY()); boolean moveX = (distanceX > 0) && (Greenfoot.getRandomNumber(distanceX + distanceY) < distanceX); boolean moveY = (distanceY > 0) && (Greenfoot.getRandomNumber(distanceX + distanceY) < distanceY); deltaX = computeHomeDelta(moveX, getX(), target.getX()); deltaY = computeHomeDelta(moveY, getY(), target.getY()); } /** * Compute and return the direction (delta) that we should steer in when * we're on our way home. */ private int computeHomeDelta(boolean move, int current, int home) { if (move) { if (current > home) return -SPEED; else return SPEED; } else return 0; } /** * Adjust the speed randomly (start moving, continue or slow down). The * speed returned is in the range [-SPEED .. SPEED]. */ private int adjustSpeed(int speed) { speed = speed + Greenfoot.getRandomNumber(2 * SPEED - 1) - SPEED + 1; return capSpeed(speed); } /** * Make sure the speed returned is in the range [-SPEED .. SPEED]. */ private int capSpeed(int speed) { if (speed < -SPEED) return -SPEED; else if (speed > SPEED) return SPEED; else return speed; } /** * Return 'true' in exactly 'percent' number of calls. That is: a call * randomChance(25) has a 25% chance to return true. */ private boolean randomChance(int percent) { return Greenfoot.getRandomNumber(100) < percent; } }
Close