Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.87 KB | None | 0 0
  1. package bots;
  2. import java.util.Random;
  3.  
  4. import gameengine.*;
  5.  
  6. public class TakeDeWeekOnMe implements BotAPI {
  7.  
  8. // The public API of Bot must not change
  9. // This is ONLY class that you can edit in the program
  10. // Rename Bot to the name of your team. Use camel case.
  11. // Bot may not alter the state of the board or the player objects
  12. // It may only inspect the state of the board and the player objects
  13.  
  14. private Player player;
  15. private PlayersInfo playersInfo;
  16. private Map map;
  17. private Dice dice;
  18. private Log log;
  19. private Deck deck;
  20. private boolean moved = false;
  21. private boolean questioned = false;
  22. private int roll = 0;
  23.  
  24. public TakeDeWeekOnMe (Player player, PlayersInfo playersInfo, Map map, Dice dice, Log log, Deck deck) {
  25. this.player = player;
  26. this.playersInfo = playersInfo;
  27. this.map = map;
  28. this.dice = dice;
  29. this.log = log;
  30. this.deck = deck;
  31. }
  32.  
  33. public String getName() {
  34. return "TakeDeWeekOnMe"; // must match the class name
  35. }
  36.  
  37. public String getVersion () {
  38. return "0.1"; // change on a new release
  39. }
  40.  
  41. public String getCommand() {
  42. // Add your code here;
  43. boolean inRoom = false;
  44. if(player.getToken().getRoom() == null){
  45. if(!moved){
  46. moved = true;
  47. return "roll";
  48. }else{
  49. moved = false;
  50. return "done";
  51. }
  52. }else{
  53. if(!questioned){
  54. return "question";
  55. }
  56. else if(player.getToken().getRoom().hasPassage()){
  57. return "passage";
  58. }
  59. else{
  60. return "exit";
  61. }
  62. }
  63. }
  64.  
  65. public String getMove() {
  66. // Add your code here
  67.  
  68. int rollNumber = dice.getTotal();
  69. String playerName = player.getToken().getName();
  70. if(rollNumber > roll){
  71. // System.out.println(playerName);
  72. // System.out.println("Here is the green one working fam?!");
  73. greensMovement();
  74. switch(playerName){
  75. // case "white":
  76. // whitesMovement();
  77. // break;
  78. // case "scarlett":
  79. // scarlettsMovement();
  80. // break;
  81. // case "mustard":
  82. // mustardsMovement();
  83. // break;
  84. // case "plum":
  85. // plumsMovement();
  86. // break;
  87. // case "peacock":
  88. // peacocksMovement();
  89. // break;
  90. case "green":
  91. greensMovement();
  92. break;
  93. }
  94. roll++;
  95. }
  96. String[] array = {"l", "r", "u", "d"};
  97. Random rand = new Random();
  98. int randInt = rand.nextInt( 4);
  99.  
  100. return array[randInt];
  101.  
  102. }
  103.  
  104. private void greensMovement(){
  105. if(player.getName().equalsIgnoreCase("green")){
  106. Coordinates[] currentCoords = playersInfo.getPlayersPositions();
  107. Coordinates checkingCoords = new Coordinates(0,0);
  108. String[] thePlayers = playersInfo.getPlayersNames();
  109. String name = "";
  110. for(int i = 0; i < thePlayers.length; i++){
  111. if(thePlayers[i].equalsIgnoreCase("TakeDeWeeKOnMe")){
  112. checkingCoords = currentCoords[i];
  113. name = thePlayers[i];
  114. }
  115. }
  116. System.out.println(name + " " + checkingCoords);
  117. // System.out.println(player.getToken().getName() + " " + currentCoords[0] + " " + player.getToken().getName() + " " + currentCoords[1] + " " + player.getToken().getName() + " "+ currentCoords[2]);
  118. }
  119. }
  120.  
  121. // private String getNearestDoor(Player player) {
  122. //
  123. // Coordinates location = player.getToken().getPosition();
  124. //
  125. // int column = location.getCol();
  126. // int row = location.getRow();
  127. //
  128. // for(int i=0; i<9; i++){
  129. //
  130. // String currentRoom = Names.ROOM_NAMES[i];
  131. // for
  132. // currentRoom.getDoorCoordinates;
  133. // }
  134. //
  135. // return null;
  136. //
  137. // }
  138.  
  139. public String getSuspect() {
  140. // Add your code here
  141. return Names.SUSPECT_NAMES[0];
  142. }
  143.  
  144. public String getWeapon() {
  145. // Add your code here
  146. return Names.WEAPON_NAMES[0];
  147. }
  148.  
  149. public String getRoom() {
  150. // Add your code here
  151. return Names.ROOM_NAMES[0];
  152. }
  153.  
  154. public String getDoor() {
  155. // Add your code here
  156. return "1";
  157. }
  158.  
  159. public String getCard(Cards matchingCards) {
  160. // Add your code here
  161. return matchingCards.get().toString();
  162. }
  163.  
  164. public void notifyResponse(Log response) {
  165. // Add your code here
  166. }
  167.  
  168. public void notifyPlayerName(String playerName) {
  169. // Add your code here
  170. }
  171.  
  172. public void notifyTurnOver(String playerName, String position) {
  173. // Add your code here
  174. }
  175.  
  176. public void notifyQuery(String playerName, String query) {
  177. // Add your code here
  178. }
  179.  
  180. public void notifyReply(String playerName, boolean cardShown) {
  181. // Add your code here
  182. }
  183.  
  184. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement