Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bots;
- import java.util.Random;
- import gameengine.*;
- public class TakeDeWeekOnMe implements BotAPI {
- // The public API of Bot must not change
- // This is ONLY class that you can edit in the program
- // Rename Bot to the name of your team. Use camel case.
- // Bot may not alter the state of the board or the player objects
- // It may only inspect the state of the board and the player objects
- private Player player;
- private PlayersInfo playersInfo;
- private Map map;
- private Dice dice;
- private Log log;
- private Deck deck;
- private boolean moved = false;
- private boolean questioned = false;
- private int roll = 0;
- public TakeDeWeekOnMe (Player player, PlayersInfo playersInfo, Map map, Dice dice, Log log, Deck deck) {
- this.player = player;
- this.playersInfo = playersInfo;
- this.map = map;
- this.dice = dice;
- this.log = log;
- this.deck = deck;
- }
- public String getName() {
- return "TakeDeWeekOnMe"; // must match the class name
- }
- public String getVersion () {
- return "0.1"; // change on a new release
- }
- public String getCommand() {
- // Add your code here;
- boolean inRoom = false;
- if(player.getToken().getRoom() == null){
- if(!moved){
- moved = true;
- return "roll";
- }else{
- moved = false;
- return "done";
- }
- }else{
- if(!questioned){
- return "question";
- }
- else if(player.getToken().getRoom().hasPassage()){
- return "passage";
- }
- else{
- return "exit";
- }
- }
- }
- public String getMove() {
- // Add your code here
- int rollNumber = dice.getTotal();
- String playerName = player.getToken().getName();
- if(rollNumber > roll){
- // System.out.println(playerName);
- // System.out.println("Here is the green one working fam?!");
- greensMovement();
- switch(playerName){
- // case "white":
- // whitesMovement();
- // break;
- // case "scarlett":
- // scarlettsMovement();
- // break;
- // case "mustard":
- // mustardsMovement();
- // break;
- // case "plum":
- // plumsMovement();
- // break;
- // case "peacock":
- // peacocksMovement();
- // break;
- case "green":
- greensMovement();
- break;
- }
- roll++;
- }
- String[] array = {"l", "r", "u", "d"};
- Random rand = new Random();
- int randInt = rand.nextInt( 4);
- return array[randInt];
- }
- private void greensMovement(){
- if(player.getName().equalsIgnoreCase("green")){
- Coordinates[] currentCoords = playersInfo.getPlayersPositions();
- Coordinates checkingCoords = new Coordinates(0,0);
- String[] thePlayers = playersInfo.getPlayersNames();
- String name = "";
- for(int i = 0; i < thePlayers.length; i++){
- if(thePlayers[i].equalsIgnoreCase("TakeDeWeeKOnMe")){
- checkingCoords = currentCoords[i];
- name = thePlayers[i];
- }
- }
- System.out.println(name + " " + checkingCoords);
- // System.out.println(player.getToken().getName() + " " + currentCoords[0] + " " + player.getToken().getName() + " " + currentCoords[1] + " " + player.getToken().getName() + " "+ currentCoords[2]);
- }
- }
- // private String getNearestDoor(Player player) {
- //
- // Coordinates location = player.getToken().getPosition();
- //
- // int column = location.getCol();
- // int row = location.getRow();
- //
- // for(int i=0; i<9; i++){
- //
- // String currentRoom = Names.ROOM_NAMES[i];
- // for
- // currentRoom.getDoorCoordinates;
- // }
- //
- // return null;
- //
- // }
- public String getSuspect() {
- // Add your code here
- return Names.SUSPECT_NAMES[0];
- }
- public String getWeapon() {
- // Add your code here
- return Names.WEAPON_NAMES[0];
- }
- public String getRoom() {
- // Add your code here
- return Names.ROOM_NAMES[0];
- }
- public String getDoor() {
- // Add your code here
- return "1";
- }
- public String getCard(Cards matchingCards) {
- // Add your code here
- return matchingCards.get().toString();
- }
- public void notifyResponse(Log response) {
- // Add your code here
- }
- public void notifyPlayerName(String playerName) {
- // Add your code here
- }
- public void notifyTurnOver(String playerName, String position) {
- // Add your code here
- }
- public void notifyQuery(String playerName, String query) {
- // Add your code here
- }
- public void notifyReply(String playerName, boolean cardShown) {
- // Add your code here
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement