package us.palpant.games.territories.ai {
import us.palpant.games.players.PlayerManager;
import us.palpant.games.territories.*;
public class RandomAI implements ITerritoriesAI {
public function RandomAI() { }
public function get name():String { return "Random"; }
/**
* Shiitttyy AI example
* @param args the TerritoriesModel to randomly select
* @return the randomly selected Territory
*
*/
public function select(model:TerritoriesModel, playerManager:PlayerManager):Territory {
var randomRow:uint = Math.floor(Math.random() * model.length);
var randomColumn:uint = Math.floor(Math.random() * (model[0] as Array).length);
var potentialSelection:Territory = model[randomRow][randomColumn] as Territory;
if(!potentialSelection.selected)
return potentialSelection;
return select(model, playerManager);
}
}
}