Tuesday, December 8, 2015

Zombie Dice - Instruction

This page gives instruction on how to prepare a submission. 


Step 1 - Locate the correct file

The file that you are expected to modify is called ai_template.py. Its code is locate here:

This file imports the bare-bone AI class from ZDengine.py. 
  1. You must rename the class to follow the following pattern: zd_yourname_ainame This is the name that will be shown on the leaderboard.
  2. You must rename the file using the exact same pattern, but also adding a .py file extension. 
  3. You must specify which division your entry belongs to. 
You may create any number of AIs, but each must be uniquely named. In the end, you will submit your best entry.


Step 2 - Understand the inputs

The whole thing is pretty simple: The AI has a single method (called Play) that takes a number of inputs and must return True or False. True means to roll again while False implies that the AI will cash-in the brains and pass the cup to the next player. 

player_id (int)

The index of the current player in the other input list called tallies. For example, the current score of the active AI is: 

sum( tallies[player_id] )

tallies (list of list of ints)

This list contains a list of scores for each player in the current game. Therefore, for N players, len(tallies) will be equal to N. Each list is the score for individual rounds. Consider the example above on how to retrieve the score of a particular player by summing these lists of integers. 

hand (list of strings)

An enumeration of dice in hands at the time of making a decision. The only important information is the color or the die since they would remain in the hand only if they were "feet" in the previous roll. The color is defined by a single ASCII character: R for red, G for green and Y for yellow. 

For example, the list ["G", "Y"] implies that the hand contains one green and one yellow die. These are still in your hand because they resulted in the "feet" result in the previous round. An empty list implies that three new dice will be drawn from the cup if the method returns True. 

cup (list of strings)

Same format as hand, except that it lists the dice in the cup.

n_brain and n_shotgun (integers)

The count of brains that could be cashed-in, and the count of shotgun blasts at the time of taking the decision. The color or the dice is not relevant since the list of dice still in hand and in the cup are already available. 

Please take note that it is forbidden to manipulate any of the attributes of the base class ZDPlayer. Any assignment to these from your own code will lead to a disqualification. 

Step 3 - Output

The method Play must return True to indicate that the AI wants to roll again, False for cashing-in the brains and end the turn. 

Step 4 - Test

Save your file in the same folder as the tournament script. Run ZDtournament.py and all ai classes that begin with zd_ will be included. The output of the tournament will show in the terminal. 

1 comment:

  1. 1Solutions is a top-rated SEO company in California specializing in helping our clients achieve top rankings in Google for their chosen keywords. Our team of experienced SEO consultants will work with you to develop a customized SEO plan that fits your business goals and budget. We also offer a wide range of other digital marketing services, including social media marketing, pay-per-click advertising, and web design and development. Contact us today to learn more about how we can help you grow your business online.

    ReplyDelete