Virtual Hungry Bot Assignment


This assignment invovles programming a virtual bot's game-playing strategy. In the game, virtual bots from different students interact in a common world. The goal of the game is to be the bot with the highest energy level at the end of the game. Energy is acquired by consuming food items or stealing energy from another bot.

Background and Prerequisites

This assignment is taken from Paul Kube's "Snack Time" game assignment. It is used as the final assignment in CSE 11, which is a first course in the CSE major, but one intended for accelerated students (students with prior programming experience). CSE 11 is a programming course taught in Java, that is also supposed to introduce students to basic data structures and algorithms (such as sorting). Therefore, learning objectives for original version include Java class inheritance, and fast sorting.

COGS8 Version

What Students Need to Do

Like the CSE 11 version, the students' responsibility for the assignment is to implement a "move()" function. The function takes as its only argument the current state of the virutal world, in the form of an array of tuples, each representing an object in the world. Objects in the world are either food items or other players. Each tuple is three integers: (x,y,energy), where x and y are the coordinates of the object's current location, and energy is its energy level. The move() function returns an (x,y) tuple representing the location of the next move for its bot.

The next move can be no further (in Euclidean distance) from the bot's current location than a specified limit (a function of the bot's current energy level). Otherwise the behavior of the bot is at the student programmer's discretion. For more information on game rules and strategies, see the CSE 11 assignment description.

Programming Environment Requirements

The game, as used in CSE 11, includes a robust and quite attractive GUI. The server and client (including client GUI) are all written in Java. We will retain the entire framework, including Java-based server and Java- based client GUI and network interface. But instead of asking students to also write their move() function in a Java class, our students will implement the move() function in python.

Sample Solution

The code here is an example of what the students would generate and turn in. The example just demonstrates how to properly format the python source code so that the jythonc can make a Java class called Action.