Question: ITCS 3153 Introduction to Artificial Intelligence Instructions Your script will be used on a character while another classmates script will be used on the opposing

ITCS 3153 Introduction to Artificial Intelligence

Instructions Your script will be used on a character while another classmates script will be used on the opposing character. Please refer to the information below on how and where to write the code.

Download the Bomber Belts 2014 Project from Moodle

Open the Scene named Menu inside of the Assets folder

Locate the AI_Template.cs file inside of the Assets / Resources / AI Scripts folder

This is the script you will modify to create your AI algorithm

Refer to the information below on available functions to call

You may also use the AI_Sample.cs script to see an example implementation

Change the name of the script to AIScript_YourName.cs

You will also need to change the class name

Do NOT make any modifications to any other scripts in the project

Any modifications to the speed of the bombs or players, or any adjustments to the game that grants an unfair advantage to a player will automatically result in a zero for this assignment.

To test your script, simply run the Menu screen and select your script.

Coding Framework Information All of the functionality for moving your character, sending bombs, and positional/state information of the belts and bombs have been written for you inside other scripts. You can access those functions by using the mainScript variable that is already declared and initialized for you inside of the AI_Template.cs file. Below is a complete list of functions.

void moveUp()

Moves the player up. The player will continue to move up until otherwise instructed.

void moveDown()

Moves the player down. The player will continue to move down until otherwise instructed.

void push()

Attempts to push the closest button. If the character is too far from the button, the button is already engaged, or is on cooldown, nothing will happen.

float getCharacterLocation()

Returns the position of the character as a float

float getOpponentLocation()

Returns the position of the opposing character as a float

float[] getButtonLocations()

Returns an array of floats for representing the position of each button on your side

float[] getButtonCooldowns()

Returns an array of floats representing the time remaining before each button may be pressed again.

bool[] getBeltDirection()

Returns an array of Boolean values that corresponds to whether or not the buttons on your side of the board have been engaged. True means the belt/button is engaged and the bomb is moving towards your opponent.

float[] getBombDistances()

Returns an array of float values that represent the distance each bomb is from its corresponding button on your side

float getPlayerSpeed()

Returns the speed at which the characters move

float getBombSpeed()

Returns the speed at which the bombs move

Submission Information Make sure that youve changed the name of the script to AIScript_YourName.cs and that youve also changed the class name to match the file name. Upload your completed AI script to Moodle.

A Few Points

Whenever a button is pressed, that belt becomes disabled for 1.0 second. Neither player may press a button on that belt until the second has elapsed. Example: the blue player presses the button on belt 1. Both the blue players button 1 and the red players button 1 become disabled for 1.0 second.

You can access the list of each bombs current cooldown by calling getButtonCooldowns().

Calling moveUp()at the very top will have no effect. This is likewise true for moveDown()at the bottom.

Make sure your script has elements of AI. Simply copying what the opponent is doing (i.e., following) or doing the same time every time regardless of what environmental percepts dictate is not AI.

___________________________________________________________________________________________________

AI Temple.cs

using UnityEngine;

using System.Collections;

public class AI_Template : MonoBehaviour {

public CharacterScript mainScript;

public float[] bombSpeeds;

public float[] buttonCooldowns;

public float playerSpeed;

public int[] beltDirections;

public float[] buttonLocations;

// Use this for initialization

void Start () {

mainScript = GetComponent();

if (mainScript == null)

{

print("No CharacterScript found on " + gameObject.name);

this.enabled = false;

}

buttonLocations = mainScript.getButtonLocations();

playerSpeed = mainScript.getPlayerSpeed();

}

// Update is called once per frame

void Update () {

buttonCooldowns = mainScript.getButtonCooldowns();

beltDirections = mainScript.getBeltDirections();

//Your AI code goes here

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!