Circle fish help

hey i have a project and i need help with coding some parts. im supposed t oadd a CircleFish to the Marine Bio case study. this fish will always try to move up, then diagonally to the right, eventually moving in a circle.
Rules for Circle Fish Movement:
The Circle fish alternates between moving forward and to the right. It goes one cell forward, if possible. Next it moves diagonally to the right if that cell is empty, turning right at the same time. If either type of move is blocked because the target cell is not empty, then the CircleFish stays in palce but turns right. Whenever a CircleFish turns, it attempts to move forward next.
i can't figure out how to code the diagonall part
     protected Location nextLocation()
        Environment env = environment();
        Location oneInFront = env.getNeighbor(location(), direction());
        Location twoInFront = env.getNeighbor(oneInFront, direction());
        Debug.println("  Location in front is empty? " +
                        env.isEmpty(oneInFront));
        Debug.println("  Location in front of that is empty? " +
                        env.isEmpty(twoInFront));
        if ( env.isEmpty(oneInFront) )
            if ( env.isEmpty(twoInFront) )
                return twoInFront;
            else
                return oneInFront;
        // Only get here if there isn't a valid location to move to.
        Debug.println("  CircleFish is not moving.");
        return location();
    }if you need the other pieces of my code like the constructors i could paste them too. i just need help w/ direction because that code i wrote only to check if the space is empty. then it returns the circle fish's current location. plz help!

as i said before, this one wasnt updated. i did more
work and posted a new topic. whats so wrong?It cuts down on the effectiveness of responses, leads to people wasting their time answering what others have already answered, makes for difficult discussion, and is generally just annoying and bad form.

Similar Messages

  • My mac starts up in a white screen with a loading bar and a loading circle please help

    My mac starts up in a white screen with a loading bar and a loading circle please help

    I do hope you have recent backup, because it look like your hard disk is failing. You can start up in Recovery Mode, and run Disk Utility to see if the disk can be fixed:  OS X: About OS X Recovery - Apple Support

  • HT1338 I need help with numbers. I try to open numbers and I get a message stating that I need an update. When I go to update apple say I am up to date, but I still can't open numbers. I keep going around and circles. Help

    I cannot open numbers. When I click to open the message says that, I need to update. When I go to updates is says I am updated. I keep going around and circles. Can anyone help?

    Look in your Applications folder for the new version.
    Remove the old icon from the Dock and drag down the new one for ease of use.

  • Updating itunes is taking round in circles! HELP!

    I have attempted to update itunes but everytime I open it, it prompts me to go through itunes set-up, choose language etc. no idea what i am doing wrong. i've tried to uninstall it but it will not let me as says that i have the latest version of itunes on my computer. why cant i open itunes then? and just constantly get taken to install it which is then followed by this error?? im probably missing something very simple but its getting very frustrating.
    please help...cant cope without my ipod!!!
    thanks.

    Bump! Why am I always getting taken into the setup of updating itunes but it recognises that my ipod is up-to-date? It tells me to reboot, which I do, and then why I try to open itunes we start the whole circle again.
    Please help! Thanks.

  • Grey dotted circle - music - HELP!

    Hello guys, i have a problem that grey dotted circle appears next to my music in library. It is whole grey and when I sync it nothing syncs and I cant play the music on my iPhone! Help please!

    After over an hour, I think I just figured this out!  (at least it finally synched about 200 recent songs from my PC to my iPhone which would never auto-synch!)
    Connect your iPhone to your PC.  Open iTunes on your PC and navigate to your iPhone. On the Music tab, select Sync "Entire music Library".  Navigate to the Summary tab, select "manually manage music and videos".  Click Sync (if it doesn't automatically synch).
    This pushed all my recent PC additions to my iPhone.  Hope it helps others.

  • My iPhone 4 is frozen on the "turn off spinning circle page" Help!!

    After I tried to turn off my iPhone 4, it froze on the turn off page where the spinning circle spins before completely turning off. Its been like this for hours! I asked my collegues and my friends and they don't know. I tried to click the awake/sleep button with the home button at the same time and it won't turn off. Neither would clicking the sleep/awake button work where the red slide pops up. I tried connecting it to the computer and it won't load;only an error pops up and won't sync. Please Help!!

    Not sure where you are now in trying to fix this? What was the Error # and message?
    Lets start over. Reset, Hold both Home and Power Buttons until the iPhone begins to restart.
    If nothing, connect to Wall Charger for at least 10 minutes, the iPhone may start on own and be fine. If not, keep connected to Wall Charger and Reset again. If still problem you may need to Restore the iPhone Firmware.
    If you decide to Restore Firmware. With iTunes open connect iPhone to Computer. Hold both Home and Power buttons until iTunes recognizes iPhone in Recovery Mode. This usually take 20 seconds. Restore Firmware.
    If this does not work then try DFU Mode Restore.
    If still problems and you have Warranty or AppleCare Coverage take iPhone to Apple for resolution.

  • I played both assistive touch and voiceover ....and I can't push my password because of the circle please help

    I can't push password number 1 and 4 because between these numbers there is a circle for assistive touch and also I played voiceover so it's difficult to push the numbers

    Gift cards are country specific.
    They can only be used inside the borders of the country of issue.

  • TS1389 cant find the place to authorize my computer.  just going around in circles.  help

    Cant find the place on the web sight to authorize my computer.  Why is it so difficult?  Keep going around in circles. Where is the menu for that option?

    Open itunes.
    Click the word Store at the top of your computer screen, then click Authorize
    If you do not have the menu bar, then click Control -B

  • My mac wont get passed the grey screen with the apple logo and the timing circle, please help

    My macbook wont get passed the grey screen, I rebooted it, any suggestions?

    Work your way throught this knowledge base article:
    Gray screen appears during startup
    http://support.apple.com/kb/TS2570
    MacBook Pro, Mac OS X (10.6.7), 2.4GHz IntelCore i5 320 HD 8GB RAM

  • I went away for a week and shut my MacBook Pro down. Since being back it has been super slow so I decided to restart it. Now it gets stuck at the white screen with the apple and spinning circle. HELP!!! I tried restarting over again and it didnt help.

    Sometimes it will stay at the apple screen and sometimes it just shuts back off. The battery is fully charged.

    ashleymay wrote:
    I'm pretty sure it's mountain lion. Neither of your links worked tho, but thanks for trying! I'm new to Macs and only really know the basics of how to use it. When I power on and hold the option key I can chose to recover my Mac. What will that do? Will I lose pictures and stuff? I just went to Mexico and all my pics are on there and I'd hate to lose them, also lots of pics of my little boy.
    Hmmmm, they are both working for me.   What happened when you clicked on the links?  Any error messages?

  • When i try to open photoshop this shows up Please uninstall and reinstall the product.  If this problem still occurs, please contact Adobe technical support for help, and mention the error code shown at the bottom of this screen.  Error: 16

    i had to take my photoshop file into a hardrive because my dad was going to give me a new Mac and when things didn't work out and went back to my old one i use the time capsule thing to save everything before but didn't give me photoshop so i physically moved the file and tried to open it but then this error shows up
    Please uninstall and reinstall the product.
    If this problem still occurs, please contact Adobe technical support for help, and mention the error code shown at the bottom of this screen.
    Error: 16
    and when i click the uninstall app on the file it tells me this
    The alias “Uninstall Adobe Photoshop CS6 2” can’t be opened because the original item can’t be found
    and when i click fix alias i click on photoshop and the app just turns into photoshop and i just run in circles
    please help thank you

    Run the cleaner tool and reinstall.
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    Download CS6 products
    Mylenium

  • Aperture wont start , it needs an update and is telling me to log onto a hotmail account that no longer exists so I am stuck .I would even re-purchase aperture just to get up and running again but I cant do that either - help, I need these photographs !

    Aperture wont start when I booted up this morning . There is an upgrade that it needs to install and I am being directed to log onto a hotmail account that does not exist to install it . I cant get any sense out of hotmail and the account has been deleted because I have never used it .
    I need to get into my files asap but I am just going around in circles - please help - anyone ?

    APERTURE was bought via the Apple On Line Store .
    I kew there is an update cause when I clicked on updates , there was an update that I needed cause Aperture was not running as it should  ie . it would not load
    I am running Mavericks OS.
    My Apple ID is the same as my email account but I have discovered that I have two  Apple ID accounts and I could not remember my password on the one that I used to download the original Aperture - I have since contacted Apple and they have merged the two so Ihave sorted it out that way .
    When Aperture would not start , it wasn't asking me to log onto my email account, it was asking me for my Apple ID which was the same thing but it was my emergency ID and I could not remember the password . Being enturely thick where computers are concerned , I got very confused and remain confused because having bought a new MACBOOK AIR , I find it wont recognise my back up hard drive or my AIRPORT so I am not having a great time with MAC products to be honest - cant get my business back up and running after nearly three weeks so Apple and MAC are not my favourite words !
    Anyway, I did get it sorted finally by ringing Apple but thanks for replying anyway - it turned out that Aperture was the very least of my problems  when my hard drive failed installing Mavericks - wasnt Mavericks fault, my drives have to work hard and it just died .

  • I am logging in - but the Adobe FormsCentral will not open.  It just shows an explanation mark in a circle.  How do I open my surveys and results?

    I have several surveys/questionnaires in Adobe FormsCentral and when I log in -- it won't open.  It just gives me an explanation mark in a circle.  Help!  Mary

    Hi maryfulton,
    I checked your account, and there are no issues there. If you're still having trouble logging in, please clear the browser cache, and then try logging in directly to https://formscentral.acrobat.com. Any luck?
    Best,
    Sara

  • Brush tool appears as a brush not a circle!!!

    The title says it all. My brush tool cursor is a brush not the circle.
    HELP, i have heard of color select(Alt) and crosshairs(CAPSLOCK) brush cursors but have not heard of a picture of a brush as my cursor!!!!
    Thanks anyway

    What do you have set in Edit - Preferences - Cursors?  Standard, I'll bet.
    Change it to Normal Brush Tip.
    -Noel

  • How can i do this effect in a circle?

    I don't know how to apply this effect in a circle?
    HElp PLEASE!!

    Hi,
    You could use the Polygon Tool to create the circle with humps, you just have to set the number of sides and then use the Geometry Options to make the humps.
    You have to set all the options before drawing out the Polygon Tool.
    Then use the Ellipse Tool to cut out the center

Maybe you are looking for