• Display with Attacker and Teleportation

    At the end of this problem you should submit to Laulima (please zip these files to work around the 5 file limit):

    • a file named UHusername_display_attacker_teleportation.c
    • a file named UHusername_display_attacker_teleportation.h
    • a file named UHusername_display_attacker_teleportation_constants.h
    • a file named UHusername_display_attacker_teleportation_helpers.c
    • a file named UHusername_display_attacker_teleportation_helpers.h
    • a file named UHusername_display_attacker_teleportation_setup.h

      example:

      • zhaol_display_attacker_teleportation.c
      • zhaol_display_attacker_teleportation.h
      • zhaol_display_attacker_teleportation_constants.h
      • zhaol_display_attacker_teleportation_helpers.c
      • zhaol_display_attacker_teleportation_helpers.h
      • zhaol_display_attacker_teleportation_setup.h
    • Update the display program that you completed from Lab 09

      It will be beneficial for you to leave your previous lab work untouched by copying them to a new folder for this lab and modify only the files in the new folder

      If you were not able to complete Display with Boundaries and Items from the Lab 09, you can modify a fresh copy of the display program. The feature set between both lab assignments are independent. Just follow the download instructions from Lab 09 and coordinate with your lab instructor.

      Update your Display with Boundaries and Items program from Lab 09 to add the following features:

      1. Add an attacker to the program:

        • an attacker is an entity that will always move towards the token
        • the attacker moves once each time the token makes a move
        • when the attacker and the token share the same spot, the game ends
      2. Hints (feel free to not use them):

        • use return to end a program; return does not always need to be at the end of the main function; and there can be multiple returns
        • you will most likely need to track another set of x and y positions
        • you will most likely need to have a function that compares the x and y positions of the token and the attacker
        • you will most likely need to have a function that compares two locations and returns how to get closer from one location to the other
        • you will need to update the redraw_screen() function in display_helpers.c to display the attacker
      3. Add teleportation to the program:

        • update the program so the token and attacker can warp to the other side boundary whenever they try to move outside of the boundary
            for example:
          • if the token/attacker is on the far right side of the screen and tries to move right, it will warp to the far left side of the screen
          • if the token/attacker is on the far left side of the screen and tries to move left, it will warp to the far right side of the screen
          • if the token/attacker is at the bottom of the screen and tries to move down, it will warp to the top of the screen
          • if the token/attacker is at the top of the screen and tries to move up, it will warp to the bottom of the screen
      4. Hints (feel free to not use them):

        • you should familiarize yourself with the mod (short for modulo) operator % and see how it can be applied to this problem
          • it is one of the most useful operators in programming
          • a lot of the simple processing of information that humans do on a normal basis (without ever knowing it), when broken down for computers to replicate, will require the mod operator %