From 7acbb5a84220876670bfb8ce782dc2487e6363e2 Mon Sep 17 00:00:00 2001 From: "sanchit.sinha" Date: Sun, 2 Feb 2025 22:28:46 +0530 Subject: [PATCH] solved snake and ladder implementation --- snakeAndLadder/pom.xml | 30 +++ .../src/main/java/org/machinecoding/Main.java | 49 +++++ .../java/org/machinecoding/models/Board.java | 7 + .../org/machinecoding/models/BoardEntity.java | 54 +++++ .../java/org/machinecoding/models/Dice.java | 7 + .../java/org/machinecoding/models/Player.java | 29 +++ .../models/teleports/Ladder.java | 7 + .../machinecoding/models/teleports/Snake.java | 7 + .../models/teleports/Teleporter.java | 6 + .../models/teleports/TeleporterEntity.java | 29 +++ .../strategy/DiceMovementStrategy.java | 22 ++ .../strategy/GameMovementStrategy.java | 34 +++ .../strategy/MovementStrategy.java | 6 + .../strategy/TeleporterMovementStrategy.java | 37 ++++ .../strategy/GameMovementStrategyTest.java | 202 ++++++++++++++++++ .../target/machineCoding-1.0-SNAPSHOT.jar | Bin 0 -> 11157 bytes .../target/maven-archiver/pom.properties | 3 + .../compile/default-compile/createdFiles.lst | 13 ++ .../compile/default-compile/inputFiles.lst | 13 ++ .../default-testCompile/createdFiles.lst | 0 .../default-testCompile/inputFiles.lst | 1 + 21 files changed, 556 insertions(+) create mode 100644 snakeAndLadder/pom.xml create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/Main.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/models/Board.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/models/BoardEntity.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/models/Dice.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/models/Player.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Ladder.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Snake.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Teleporter.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/models/teleports/TeleporterEntity.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/strategy/DiceMovementStrategy.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/strategy/GameMovementStrategy.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/strategy/MovementStrategy.java create mode 100644 snakeAndLadder/src/main/java/org/machinecoding/strategy/TeleporterMovementStrategy.java create mode 100644 snakeAndLadder/src/test/java/org/machinecoding/strategy/GameMovementStrategyTest.java create mode 100644 snakeAndLadder/target/machineCoding-1.0-SNAPSHOT.jar create mode 100644 snakeAndLadder/target/maven-archiver/pom.properties create mode 100644 snakeAndLadder/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 snakeAndLadder/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 snakeAndLadder/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst create mode 100644 snakeAndLadder/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst diff --git a/snakeAndLadder/pom.xml b/snakeAndLadder/pom.xml new file mode 100644 index 00000000..424f86a0 --- /dev/null +++ b/snakeAndLadder/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + org.machinecoding + snakeAndLadder + 1.0-SNAPSHOT + + + 23 + 23 + UTF-8 + + + + org.junit.jupiter + junit-jupiter + RELEASE + test + + + org.mockito + mockito-core + 4.0.0 + test + + + diff --git a/snakeAndLadder/src/main/java/org/machinecoding/Main.java b/snakeAndLadder/src/main/java/org/machinecoding/Main.java new file mode 100644 index 00000000..430d4645 --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/Main.java @@ -0,0 +1,49 @@ +package org.machinecoding; + +import org.machinecoding.models.Board; +import org.machinecoding.models.BoardEntity; +import org.machinecoding.models.Dice; +import org.machinecoding.models.Player; +import org.machinecoding.models.teleports.Ladder; +import org.machinecoding.models.teleports.Snake; +import org.machinecoding.models.teleports.TeleporterEntity; + +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +public class Main { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int targetCell = 100; + + int numSnakes = scan.nextInt(); + List teleporterList = new ArrayList<>(); + for (int i = 0; i < numSnakes; i++) + teleporterList.add(new Snake(scan.nextInt(), scan.nextInt())); + + int numLadder = scan.nextInt(); + for (int i = 0; i < numLadder; i++) + teleporterList.add(new Ladder(scan.nextInt(), scan.nextInt())); + + int numPlayers = scan.nextInt(); + List playerList = new ArrayList<>(); + for (int i = 0; i < numPlayers; i++) + playerList.add(new Player(scan.next(), 0, targetCell)); + + // debug +// for (TeleporterEntity teleporter : teleporterList) +// System.out.println("start: " + teleporter.getStartCell() + +// ", end: " + teleporter.getEndCell()); +// +// for (Player player : playerList) +// System.out.println(player.getName() + " is at " + player.getPosition()); + + List diceList = new ArrayList<>(); + diceList.add(new Dice()); + + BoardEntity boardEntity = new BoardEntity(new Board(targetCell), + teleporterList, playerList, diceList); + boardEntity.start(); + } +} \ No newline at end of file diff --git a/snakeAndLadder/src/main/java/org/machinecoding/models/Board.java b/snakeAndLadder/src/main/java/org/machinecoding/models/Board.java new file mode 100644 index 00000000..64f66bf8 --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/models/Board.java @@ -0,0 +1,7 @@ +package org.machinecoding.models; + +public class Board { + private int cells; + + public Board(int cells) { this.cells = cells; } +} diff --git a/snakeAndLadder/src/main/java/org/machinecoding/models/BoardEntity.java b/snakeAndLadder/src/main/java/org/machinecoding/models/BoardEntity.java new file mode 100644 index 00000000..9efb7a13 --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/models/BoardEntity.java @@ -0,0 +1,54 @@ +package org.machinecoding.models; + +import org.machinecoding.models.teleports.TeleporterEntity; +import org.machinecoding.strategy.DiceMovementStrategy; +import org.machinecoding.strategy.GameMovementStrategy; +import org.machinecoding.strategy.TeleporterMovementStrategy; + +import java.util.List; + +public class BoardEntity { + private final Board board; + private final List teleports; + private final List players; + private final List dices; + + private GameMovementStrategy movementStrategy; + + public BoardEntity(Board board, List teleports, List players, List dices) { + this.board = board; + this.teleports = teleports; + this.players = players; + this.dices = dices; + + this.movementStrategy = new GameMovementStrategy(new DiceMovementStrategy(dices), new TeleporterMovementStrategy(teleports)); + } + + public void start() { + while(shouldPerformRound()){ + performOneRound(); + } + } + + private boolean shouldPerformRound() { + return players.stream().filter(p -> !p.isWinner()).count() > 1; + } + + public void performOneRound(){ + for (Player player : players) { + if(!shouldPerformRound()) return; + + int currentPosition = player.getPosition(); + int newPosition = movementStrategy.move(currentPosition); + player.move(newPosition); + + System.out.println(player.getName() + " rolled a " + movementStrategy.getDiceValue() + " and moved from " + + currentPosition + " to " + player.getPosition()); + + if (player.isWinner()) { + System.out.println(player.getName() + " wins the game"); + } + } + } +} + diff --git a/snakeAndLadder/src/main/java/org/machinecoding/models/Dice.java b/snakeAndLadder/src/main/java/org/machinecoding/models/Dice.java new file mode 100644 index 00000000..c8aba8dd --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/models/Dice.java @@ -0,0 +1,7 @@ +package org.machinecoding.models; + +public class Dice { + public int roll() { + return (int) (Math.random() * 6) + 1; + } +} diff --git a/snakeAndLadder/src/main/java/org/machinecoding/models/Player.java b/snakeAndLadder/src/main/java/org/machinecoding/models/Player.java new file mode 100644 index 00000000..b9f54f75 --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/models/Player.java @@ -0,0 +1,29 @@ +package org.machinecoding.models; + +public class Player { + private final String name; + private int position; + private final int targetPosition; + + public Player(String name, int startPosition, int targetPosition){ + this.name = name; + this.position = startPosition; + this.targetPosition = targetPosition; + } + + public void move(int newPosition){ + this.position = (newPosition > targetPosition) ? position : newPosition; + } + + public boolean isWinner(){ + return (position == targetPosition); + } + + public int getPosition(){ + return position; + } + + public String getName(){ + return name; + } +} diff --git a/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Ladder.java b/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Ladder.java new file mode 100644 index 00000000..896afcee --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Ladder.java @@ -0,0 +1,7 @@ +package org.machinecoding.models.teleports; + +public class Ladder extends TeleporterEntity { + public Ladder(int startCell, int endCell) { + super(startCell, endCell); + } +} diff --git a/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Snake.java b/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Snake.java new file mode 100644 index 00000000..63f45446 --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Snake.java @@ -0,0 +1,7 @@ +package org.machinecoding.models.teleports; + +public class Snake extends TeleporterEntity { + public Snake(int startCell, int endCell) { + super(startCell, endCell); + } +} diff --git a/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Teleporter.java b/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Teleporter.java new file mode 100644 index 00000000..7ce3302f --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/Teleporter.java @@ -0,0 +1,6 @@ +package org.machinecoding.models.teleports; + +public interface Teleporter { + boolean canBeUsed(int currentPosition); + int teleport(); +} diff --git a/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/TeleporterEntity.java b/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/TeleporterEntity.java new file mode 100644 index 00000000..3e03eb8f --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/models/teleports/TeleporterEntity.java @@ -0,0 +1,29 @@ +package org.machinecoding.models.teleports; + +public class TeleporterEntity implements Teleporter { + private final int startCell; + private final int endCell; + + public TeleporterEntity(int startCell, int endCell){ + this.startCell = startCell; + this.endCell = endCell; + } + + @Override + public boolean canBeUsed(int currentPosition) { + return (startCell == currentPosition); + } + + @Override + public int teleport() { + return endCell; + } + + public int getStartCell() { + return startCell; + } + + public int getEndCell() { + return endCell; + } +} diff --git a/snakeAndLadder/src/main/java/org/machinecoding/strategy/DiceMovementStrategy.java b/snakeAndLadder/src/main/java/org/machinecoding/strategy/DiceMovementStrategy.java new file mode 100644 index 00000000..a01d73de --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/strategy/DiceMovementStrategy.java @@ -0,0 +1,22 @@ +package org.machinecoding.strategy; + +import org.machinecoding.models.Dice; + +import java.util.List; + +public class DiceMovementStrategy implements MovementStrategy { + private final List dices; + + public DiceMovementStrategy(List dices) { + this.dices = dices; + } + + @Override + public int move(int pos) { + int steps = 0; + for (Dice dice : dices) { + steps += dice.roll(); + } + return pos + steps; + } +} diff --git a/snakeAndLadder/src/main/java/org/machinecoding/strategy/GameMovementStrategy.java b/snakeAndLadder/src/main/java/org/machinecoding/strategy/GameMovementStrategy.java new file mode 100644 index 00000000..64a6c1af --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/strategy/GameMovementStrategy.java @@ -0,0 +1,34 @@ +package org.machinecoding.strategy; + +public class GameMovementStrategy implements MovementStrategy { + final DiceMovementStrategy diceMovementStrategy; + final TeleporterMovementStrategy teleporterMovementStrategy; + + private int diceValue = 0; + private int teleporterValue = 0; + + public GameMovementStrategy(DiceMovementStrategy diceMovementStrategy, + TeleporterMovementStrategy teleporterMovementStrategy) { + this.diceMovementStrategy = diceMovementStrategy; + this.teleporterMovementStrategy = teleporterMovementStrategy; + } + + @Override + public int move(int pos) { + int diceMovedPosition = diceMovementStrategy.move(pos); + this.diceValue = diceMovedPosition - pos; + + int teleporterMovedPosition = teleporterMovementStrategy.move(diceMovedPosition); + this.teleporterValue = teleporterMovedPosition - diceMovedPosition; + + return teleporterMovedPosition; + } + + public int getDiceValue() { + return diceValue; + } + public int getTeleporterValue() { + return teleporterValue; + } + +} diff --git a/snakeAndLadder/src/main/java/org/machinecoding/strategy/MovementStrategy.java b/snakeAndLadder/src/main/java/org/machinecoding/strategy/MovementStrategy.java new file mode 100644 index 00000000..f7931c34 --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/strategy/MovementStrategy.java @@ -0,0 +1,6 @@ +package org.machinecoding.strategy; + +public interface MovementStrategy { + int move(int pos); + +} diff --git a/snakeAndLadder/src/main/java/org/machinecoding/strategy/TeleporterMovementStrategy.java b/snakeAndLadder/src/main/java/org/machinecoding/strategy/TeleporterMovementStrategy.java new file mode 100644 index 00000000..58d537ea --- /dev/null +++ b/snakeAndLadder/src/main/java/org/machinecoding/strategy/TeleporterMovementStrategy.java @@ -0,0 +1,37 @@ +package org.machinecoding.strategy; + +import org.machinecoding.models.teleports.TeleporterEntity; + +import java.util.List; + +public class TeleporterMovementStrategy implements MovementStrategy { + private final List teleports; + + public TeleporterMovementStrategy(List teleports) { + this.teleports = teleports; + } + + @Override + public int move(int pos) { + int currentPosition = pos; + + while (true) { + boolean teleported = false; + + for (TeleporterEntity teleport : teleports) { + if (teleport.canBeUsed(currentPosition)) { + currentPosition = teleport.teleport(); + teleported = true; + break; + } + } + + if (!teleported) { + break; + } + } + + return currentPosition; + } + +} diff --git a/snakeAndLadder/src/test/java/org/machinecoding/strategy/GameMovementStrategyTest.java b/snakeAndLadder/src/test/java/org/machinecoding/strategy/GameMovementStrategyTest.java new file mode 100644 index 00000000..f9c0ad8c --- /dev/null +++ b/snakeAndLadder/src/test/java/org/machinecoding/strategy/GameMovementStrategyTest.java @@ -0,0 +1,202 @@ +package org.machinecoding.strategy; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +class GameMovementStrategyTest { + + private DiceMovementStrategy diceMovementStrategy; + private TeleporterMovementStrategy teleporterMovementStrategy; + private GameMovementStrategy gameMovementStrategy; + + @BeforeEach + void setUp() { + diceMovementStrategy = Mockito.mock(DiceMovementStrategy.class); + teleporterMovementStrategy = Mockito.mock(TeleporterMovementStrategy.class); + gameMovementStrategy = new GameMovementStrategy(diceMovementStrategy, teleporterMovementStrategy); + } + + // Test Scenario: Test the move method to ensure it correctly calculates the new position using both dice and teleporter strategies, and updates diceValue and teleporterValue accordingly. + @Test + void testMoveMethodCalculatesNewPositionAndUpdatesValues() { + int initialPosition = 0; + when(diceMovementStrategy.move(initialPosition)).thenReturn(5); + when(teleporterMovementStrategy.move(5)).thenReturn(10); + + int finalPosition = gameMovementStrategy.move(initialPosition); + + assertEquals(10, finalPosition); + assertEquals(5, gameMovementStrategy.getDiceValue()); + assertEquals(5, gameMovementStrategy.getTeleporterValue()); + } + + // Test Scenario: Test if the GameMovementStrategy correctly utilizes the DiceMovementStrategy to calculate the diceValue when move is called. + @Test + void testDiceValueCalculation() { + int initialPosition = 2; + when(diceMovementStrategy.move(initialPosition)).thenReturn(7); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getDiceValue()); + } + + // Test Scenario: Test the behavior of GameMovementStrategy when teleporterMovementStrategy returns a position that is significantly different from the diceMovementStrategy's result, ensuring teleporterValue is calculated correctly. + @Test + void testTeleporterValueWithSignificantDifference() { + int initialPosition = 3; + when(diceMovementStrategy.move(initialPosition)).thenReturn(8); + when(teleporterMovementStrategy.move(8)).thenReturn(20); + + gameMovementStrategy.move(initialPosition); + + assertEquals(12, gameMovementStrategy.getTeleporterValue()); + } + + // Test Scenario: Verify that the diceValue is correctly updated after the move method is called, reflecting the difference between the initial position and the position after the dice movement strategy is applied. + @Test + void testDiceValueUpdateAfterMove() { + int initialPosition = 4; + when(diceMovementStrategy.move(initialPosition)).thenReturn(9); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getDiceValue()); + } + + // Test Scenario: Test teleporterValue calculation when teleporterMovementStrategy moves the position forward. + @Test + void testTeleporterValueCalculationForwardMove() { + int initialPosition = 5; + when(diceMovementStrategy.move(initialPosition)).thenReturn(10); + when(teleporterMovementStrategy.move(10)).thenReturn(15); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getTeleporterValue()); + } + + // Test Scenario: Test the constructor to ensure it correctly initializes the GameMovementStrategy with given DiceMovementStrategy and TeleporterMovementStrategy instances. + @Test + void testConstructorInitialization() { + GameMovementStrategy strategy = new GameMovementStrategy(diceMovementStrategy, teleporterMovementStrategy); + assertEquals(diceMovementStrategy, strategy.diceMovementStrategy); + assertEquals(teleporterMovementStrategy, strategy.teleporterMovementStrategy); + } + + // Test Scenario: Verify that the GameMovementStrategy constructor correctly assigns the provided DiceMovementStrategy instance to the diceMovementStrategy field, ensuring that subsequent calls to move() use this instance for dice movement calculations. + @Test + void testDiceMovementStrategyAssignmentInConstructor() { + GameMovementStrategy strategy = new GameMovementStrategy(diceMovementStrategy, teleporterMovementStrategy); + assertEquals(diceMovementStrategy, strategy.diceMovementStrategy); + } + + // Test Scenario: Verify that the teleporterMovementStrategy correctly updates the teleporterValue after moving from the diceMovedPosition, ensuring the teleporterValue reflects the difference between the teleporterMovedPosition and diceMovedPosition. + @Test + void testTeleporterMovementStrategyUpdatesTeleporterValue() { + int initialPosition = 6; + when(diceMovementStrategy.move(initialPosition)).thenReturn(11); + when(teleporterMovementStrategy.move(11)).thenReturn(16); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getTeleporterValue()); + } + + // Test Scenario: Test the move method with a starting position of 0, ensuring the dice and teleporter strategies are called correctly, and the final position is calculated accurately. + @Test + void testMoveMethodWithStartingPositionZero() { + int initialPosition = 0; + when(diceMovementStrategy.move(initialPosition)).thenReturn(3); + when(teleporterMovementStrategy.move(3)).thenReturn(8); + + int finalPosition = gameMovementStrategy.move(initialPosition); + + assertEquals(8, finalPosition); + } + + // Test Scenario: Test the move method to ensure it correctly updates diceValue when diceMovementStrategy returns a positive move. + @Test + void testDiceValueUpdateWithPositiveMove() { + int initialPosition = 7; + when(diceMovementStrategy.move(initialPosition)).thenReturn(12); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getDiceValue()); + } + + // Test Scenario: Verify that the diceValue is correctly updated when the move method is called, ensuring it reflects the difference between the new position after dice movement and the initial position. + @Test + void testDiceValueCorrectUpdateAfterMove() { + int initialPosition = 8; + when(diceMovementStrategy.move(initialPosition)).thenReturn(13); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getDiceValue()); + } + + // Test Scenario: Test teleporter movement when dice movement results in a position that triggers a teleportation event. + @Test + void testTeleporterMovementOnDiceTrigger() { + int initialPosition = 9; + when(diceMovementStrategy.move(initialPosition)).thenReturn(14); + when(teleporterMovementStrategy.move(14)).thenReturn(19); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getTeleporterValue()); + } + + // Test Scenario: Test teleporterValue calculation when teleporterMovementStrategy moves forward by 5 positions from a diceMovedPosition of 10. + @Test + void testTeleporterValueCalculationWithForwardMove() { + int initialPosition = 10; + when(diceMovementStrategy.move(initialPosition)).thenReturn(15); + when(teleporterMovementStrategy.move(15)).thenReturn(20); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getTeleporterValue()); + } + + // Test Scenario: Verify that the move method correctly updates the teleporterMovedPosition based on the teleporterMovementStrategy's move result, ensuring the teleporterValue reflects the difference between the teleporterMovedPosition and diceMovedPosition. + @Test + void testTeleporterMovedPositionUpdate() { + int initialPosition = 11; + when(diceMovementStrategy.move(initialPosition)).thenReturn(16); + when(teleporterMovementStrategy.move(16)).thenReturn(21); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getTeleporterValue()); + } + + // Test Scenario: Verify that the getDiceValue() method returns the correct dice movement value after a move operation is performed. + @Test + void testGetDiceValueMethod() { + int initialPosition = 12; + when(diceMovementStrategy.move(initialPosition)).thenReturn(17); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getDiceValue()); + } + + // Test Scenario: Verify that getTeleporterValue() returns the correct teleporter movement value after move() is called. + @Test + void testGetTeleporterValueMethod() { + int initialPosition = 13; + when(diceMovementStrategy.move(initialPosition)).thenReturn(18); + when(teleporterMovementStrategy.move(18)).thenReturn(23); + + gameMovementStrategy.move(initialPosition); + + assertEquals(5, gameMovementStrategy.getTeleporterValue()); + } +} \ No newline at end of file diff --git a/snakeAndLadder/target/machineCoding-1.0-SNAPSHOT.jar b/snakeAndLadder/target/machineCoding-1.0-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..cc99851e3757cb6408942969f4813a7fdfd04432 GIT binary patch literal 11157 zcmbVS1z43!w+89%6iEr`?oMH|>5!7#ba$6@w;-V)AV{Y)64KpBHz-P%)ZHAc>FC1%$3 zwdJ*Y5I2+fK39V~bA<*^!p7d@uWA0e2j<^Btn>{{&8$I&Hb!RFf9g;0%l=k2Mj%Uv zKaipL(=bPnCCJvs-tkWW_kRiC;ApS!2r_Z|f%4t$LIV%{XS=NQok7-r=uGzS&S3U2 z{*F0!X)*mb!~X^oyXEwE0lL{cm}pM#6EKJxBm~4m@b}H${Y?CCPK(;;+Z!<&TIxGE zc*z6g+L*D^p64QP_$BR6laftU>BKHlW8mKN&IL%%150VH>CdYBZFU3fNgo&`UU-z2)=Qe+mvdc zbp}XZgTO>iI<>dM^@=*^%SYQQ)^nc`6cPSfo!5trdo08GlUIb=djpWVfQSYs^*v*5 zJ$@rjlez2gX+BfutDw_F4PP?DcH(G?jtX78C}!BY9+!j0D8B1%wA+(+!??o)?>EX6NnbCg%g~U2Pd=)ScrM$p8GB37j%MWSxKjJ8DuF&ar*iDne{sY zUSD0BDrOyaO0J2o5rom2kg{N_5bx1`QeYaYlb+##HQW5VzEjUfo+ss&?C zG3+PF{z_3qK>|y~Pi}@Fa-*^@S$~Uw&%#z?VBk~k{hewKYLC}z1oHvHbERnr0m|b? zSeV|iVYrou?Cy2>8&;hT(sXMFw5~w}@&v^jbU`ZgNntYcV^ofviRGL)fSf``3nNGM z7JEO}9N?q_yF5vHh|Q$Edr712;8xOeMg*KRU9Vx3fQ)*Y5a+@e7VSr++^o;79EDrV z{d(W}er4n-;7c4TC?yX8ZN{8hz;sX?1eDR%i&w!QX~|(9cx8q;)r3fQ^`9}7<`eFE zwg90K@KrI|-2GzsjPd#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F2Eev0`+!vJ6zxv1uj6_Sz{i{q{7kE;vV|uiSDPGo6aJLS1r)7J!7J@Oh8~((%P+ z$Ndve?XOF5)0tKy0;UuRX~q;PMvopB(~^BQJ8p6t*r^}@K7KRKWt+-d%|2>rVx?{{ zTQ2apowviqH=%gXy!O3Io-L!aJO5K9;t1~UAbsJscBBpomR6GRvyVKL^mrprsCd$P zBWWU~Hp19GzdW-!Kg3BTnk7V(AEV}JLA#c)kb*D5uy6HP^vU`-SH zhXD=nf}(z1l{mT)TIwMUon3rl_c**EoX$2rzY8A!2C5}<^_iZ!6oHdN2+CL{(-$rN zD98RPRx3pM1 z$u0kH$`jC}8|Q?;e18mn1pa^gx3#yi1=%~AfgAwzwB51*S;jrtvVNfKKvy5YX+XZa z53nJ_)WgI85w?z(^H~HGN5%@um-vu!=2ji#4qMma9R=A!d_|@W)>V-Au%UimRRf+L zxS>OQ5xM#PM^e5I`+b$oP3N1I?MDs%`_Hf+YHofc{Hqd~zlQ%sxDfn$6M6a5h?|m` z@9k!)1K`(x$7=pG{-%WHd%GEb1%Cba_$;y1~l@9hSL1ANAQ3v(MX`qR8_ zN^EWcoqq}Vk7x5E(A_eao06Mbpb{|9Kb!KO0-W1r-5pH!pRs@K$LzlcgID>lf}G#O z-GtJ3aLT|6wyCpjRfzS3c1%v-~3w|irxr=zWcI6f^6P%X% zGvbfQgS)tQGl#dh9^fmxDEPlZ`bU-gK1gzx#9eRpmP9S#A4%Lw$*(Q>yM*q# z2DgO9AN-Nfe+PfpOuvQCBmN`&?~V2!SMV#l>y`vBSi}Awb>QDt*pD=RWn0|Rs3ZS> b(YUoV6aX;bYCZ@E0`P|pT!gFg*KPMd;T;ic literal 0 HcmV?d00001 diff --git a/snakeAndLadder/target/maven-archiver/pom.properties b/snakeAndLadder/target/maven-archiver/pom.properties new file mode 100644 index 00000000..5d69c9bf --- /dev/null +++ b/snakeAndLadder/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=machineCoding +groupId=org.machinecoding +version=1.0-SNAPSHOT diff --git a/snakeAndLadder/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/snakeAndLadder/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 00000000..bb20f7d4 --- /dev/null +++ b/snakeAndLadder/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,13 @@ +org/machinecoding/strategy/TeleporterMovementStrategy.class +org/machinecoding/models/teleports/Ladder.class +org/machinecoding/models/Dice.class +org/machinecoding/models/Board.class +org/machinecoding/strategy/MovementStrategy.class +org/machinecoding/models/BoardEntity.class +org/machinecoding/models/teleports/Teleporter.class +org/machinecoding/models/teleports/TeleporterEntity.class +org/machinecoding/strategy/DiceMovementStrategy.class +org/machinecoding/models/Player.class +org/machinecoding/strategy/GameMovementStrategy.class +org/machinecoding/models/teleports/Snake.class +org/machinecoding/Main.class diff --git a/snakeAndLadder/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/snakeAndLadder/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 00000000..d341e44e --- /dev/null +++ b/snakeAndLadder/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,13 @@ +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/Main.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/models/Board.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/models/BoardEntity.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/models/Dice.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/models/Player.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/models/teleports/Ladder.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/models/teleports/Snake.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/models/teleports/Teleporter.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/models/teleports/TeleporterEntity.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/strategy/DiceMovementStrategy.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/strategy/GameMovementStrategy.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/strategy/MovementStrategy.java +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/main/java/org/machinecoding/strategy/TeleporterMovementStrategy.java diff --git a/snakeAndLadder/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/snakeAndLadder/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 00000000..e69de29b diff --git a/snakeAndLadder/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/snakeAndLadder/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 00000000..9de02e91 --- /dev/null +++ b/snakeAndLadder/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +/Users/sanchitsinha/Desktop/machinecode/machineCoding/src/test/java/org/machinecoding/strategy/GameMovementStrategyTest.java