Examples of ActorMove


Examples of cz.matfyz.aai.fantom.message.MessageMoveBase.ActorMove

    ArrayList<ActorMove> moves = new ArrayList<ActorMove>();
    if(isCaptured())
      return moves;
    if(currentPosition == null) {
      for(Node n : graph.getNodes().values())
        moves.add(new ActorMove(this, n, null));
    }
    else {
      for(Edge e : currentPosition.getOutgoingEdges()) {
        if(hasTicket(e.getTransportType())) {
          moves.add(new ActorMove(this, e.getTarget(), e.getTransportType()));
        }
      }
    }
    return moves;
  }
View Full Code Here

Examples of cz.matfyz.aai.fantom.message.MessageMoveBase.ActorMove

    assertNotNull(n2);
    Node n3 = g.getNode("3");
    assertNotNull(n3);
   
    ActorMove[] moves = new ActorMove[] {
      new ActorMove(fantomas, n1, null),
      new ActorMove(joker, n2, null)
    };
    MessageMove msg = new MessageMove(moves);
   
    // First try to verify it as a message from the phantom client.
    // This should succeed, as the message contains a correct placement
View Full Code Here

Examples of cz.matfyz.aai.fantom.message.MessageMoveBase.ActorMove

    Node n3 = g.getNode("3");
    assertNotNull(n3);
   
    // Try a message, where a phantom actor is missing
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(fantomas, n1, null)
    };
    MessageMove msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, phantomClient);
      fail("Message validation failed - not all actors were placed");
    }
    catch(ProtocolException e) {
    }
   
    // Try a message, where one actor is placed multiple times
    moves = new ActorMove[] {
        new ActorMove(fantomas, n1, null),
        new ActorMove(joker, n2, null),
        new ActorMove(fantomas, n3, null)
    };
    msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, phantomClient);
      fail("Message validation failed - an actor was placed multiple times");
    }
    catch(ProtocolException e) {
    }
   
    // Try a message, where the transport type is specified for some
    // of the actors
    moves = new ActorMove[] {
        new ActorMove(fantomas, n1, tram),
        new ActorMove(joker, n2, null)
    };
    msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, phantomClient);
      fail("Message validation failed - transport type was specified for an actor");
    }
    catch(ProtocolException e) {
    }
   
    // Try a message, where the target node is missing for some of
    // the actors.
    moves = new ActorMove[] {
        new ActorMove(fantomas, null, tram),
        new ActorMove(joker, n2, null),
    };
    msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, phantomClient);
      fail("Message validation failed - target node was not specified for an actor");
    }
    catch(ProtocolException e) {
    }
   
    // Try a message, where a detective actor is placed
    moves = new ActorMove[] {
        new ActorMove(fantomas, n1, null),
        new ActorMove(joker, n2, null),
        new ActorMove(batman, n3, null)
    };
    msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, phantomClient);
      fail("Message validation failed - an actor of the other player was placed");
    }
    catch(ProtocolException e) {
    }
   
    // Try a message, where two actors are placed at the same node
    moves = new ActorMove[] {
        new ActorMove(fantomas, n1, null),
        new ActorMove(joker, n1, null)
    };
    msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, phantomClient);
      fail("Message validation failed - two actors were placed at the same position");
View Full Code Here

Examples of cz.matfyz.aai.fantom.message.MessageMoveBase.ActorMove

    assertNotNull(n2);
    Node n3 = g.getNode("3");
    assertNotNull(n3);
   
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(poirot, n1, null),
        new ActorMove(batman, n2, null)
    };
    MessageMove msg = new MessageMove(moves);
   
    // First try to verify it as a message from the detective client.
    // This should succeed, as the message contains a correct placement
View Full Code Here

Examples of cz.matfyz.aai.fantom.message.MessageMoveBase.ActorMove

    Node n3 = g.getNode("3");
    assertNotNull(n3);
   
    // Try a message, where a phantom actor is missing
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(batman, n1, null)
    };
    MessageMove msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, detectiveClient);
      fail("Message validation failed - not all actors were placed");
    }
    catch(ProtocolException e) {
    }
   
    // Try a message, where one actor is placed multiple times
    moves = new ActorMove[] {
        new ActorMove(batman, n1, null),
        new ActorMove(poirot, n2, null),
        new ActorMove(batman, n3, null)
    };
    msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, detectiveClient);
      fail("Message validation failed - an actor was placed multiple times");
    }
    catch(ProtocolException e) {
    }
   
    // Try a message, where the transport type is specified for some
    // of the actors
    moves = new ActorMove[] {
        new ActorMove(batman, n1, tram),
        new ActorMove(poirot, n2, null)
    };
    msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, detectiveClient);
      fail("Message validation failed - transport type was specified for an actor");
    }
    catch(ProtocolException e) {
    }
   
    // Try a message, where the target node is missing for some of
    // the actors.
    moves = new ActorMove[] {
        new ActorMove(batman, null, tram),
        new ActorMove(poirot, n2, null),
    };
    msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, detectiveClient);
      fail("Message validation failed - target node was not specified for an actor");
    }
    catch(ProtocolException e) {
    }
   
    // Try a message, where a detective actor is placed
    moves = new ActorMove[] {
        new ActorMove(poirot, n1, null),
        new ActorMove(joker, n2, null),
        new ActorMove(batman, n3, null)
    };
    msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, detectiveClient);
      fail("Message validation failed - an actor of the other player was placed");
    }
    catch(ProtocolException e) {
    }
   
    // Try a message, where two actors are placed at the same node
    moves = new ActorMove[] {
        new ActorMove(batman, n1, null),
        new ActorMove(poirot, n1, null)
    };
    msg = new MessageMove(moves);
    try {
      g.verifyActorPlacement(msg, detectiveClient);
      fail("Message validation failed - two actors were placed at the same position");
View Full Code Here

Examples of cz.matfyz.aai.fantom.message.MessageMoveBase.ActorMove

    assertNotNull(n5);
    Node n6 = g.getNode("6");
    assertNotNull(n6);
   
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(fantomas, n1, null),
        new ActorMove(joker, n3, null)
    };
    g.placeActors(new MessageMove(moves));
    moves = new ActorMove[] {
        new ActorMove(poirot, n2, null),
        new ActorMove(batman, n4, null)
    };
    g.placeActors(new MessageMove(moves));
   
    assertSame(n1, fantomas.getCurrentPosition());
    assertSame(n3, joker.getCurrentPosition());
    assertSame(n2, poirot.getCurrentPosition());
    assertSame(n4, batman.getCurrentPosition());
   
    assertEquals(1, fantomas.getNumberOfTickets(tram));
    assertEquals(1, fantomas.getNumberOfTickets(bus));
    assertEquals(0, fantomas.getNumberOfTickets(universal));
   
    assertEquals(1, joker.getNumberOfTickets(tram));
    assertEquals(1, joker.getNumberOfTickets(bus));
    assertEquals(0, fantomas.getNumberOfTickets(universal));
   
    // Try to move the actors to different places
    moves = new ActorMove[] {
        new ActorMove(fantomas, n6, bus),
        new ActorMove(joker, n4, tram)
    };
    g.moveActors(g.getActors(ClientType.PHANTOM), new MessageMove(moves));
   
    assertSame(n6, fantomas.getCurrentPosition());
    assertSame(n4, joker.getCurrentPosition());
   
    assertEquals(1, fantomas.getNumberOfTickets(tram));
    assertEquals(0, fantomas.getNumberOfTickets(bus));
    assertEquals(0, fantomas.getNumberOfTickets(universal));
   
    assertEquals(0, joker.getNumberOfTickets(tram));
    assertEquals(1, joker.getNumberOfTickets(bus));
    assertEquals(0, joker.getNumberOfTickets(universal));
   
    // Try to move back to the previous position. This should fail,
    // as the phantoms do not have enough tickets
    moves = new ActorMove[] {
        new ActorMove(fantomas, n1, bus),
        new ActorMove(joker, n3, tram)
    };
    try {
      g.moveActors(g.getActors(ClientType.PHANTOM), new MessageMove(moves));
      fail("Movement validation failed - the actors do not have enough tickets");
    }
View Full Code Here

Examples of cz.matfyz.aai.fantom.message.MessageMoveBase.ActorMove

    assertNotNull(n5);
    Node n6 = g.getNode("6");
    assertNotNull(n6);
   
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(fantomas, n1, null),
        new ActorMove(joker, n2, null)
    };
    g.placeActors(new MessageMove(moves));
    moves = new ActorMove[] {
        new ActorMove(poirot, n3, null),
        new ActorMove(batman, n4, null)
    };
    g.placeActors(new MessageMove(moves));
   
    assertSame(n1, fantomas.getCurrentPosition());
    assertSame(n2, joker.getCurrentPosition());
    assertSame(n3, poirot.getCurrentPosition());
    assertSame(n4, batman.getCurrentPosition());
   
    assertEquals(1, fantomas.getNumberOfTickets(tram));
    assertEquals(1, fantomas.getNumberOfTickets(bus));
    assertEquals(0, fantomas.getNumberOfTickets(universal));
   
    assertEquals(1, joker.getNumberOfTickets(tram));
    assertEquals(1, joker.getNumberOfTickets(bus));
    assertEquals(0, fantomas.getNumberOfTickets(universal));
   
    moves = new ActorMove[] {
        new ActorMove(fantomas, n6, bus),
        new ActorMove(joker, n1, tram)
    };
    g.moveActors(g.getActors(ClientType.PHANTOM), new MessageMove(moves));
   
    assertEquals(1, fantomas.getNumberOfTickets(tram));
    assertEquals(0, fantomas.getNumberOfTickets(bus));
    assertEquals(0, fantomas.getNumberOfTickets(universal));
   
    assertEquals(0, joker.getNumberOfTickets(tram));
    assertEquals(1, joker.getNumberOfTickets(bus));
    assertEquals(0, joker.getNumberOfTickets(universal));
   
    moves = new ActorMove[] {
        new ActorMove(fantomas, n5, tram),
        new ActorMove(joker, n6, bus)
    };
    g.moveActors(g.getActors(ClientType.PHANTOM), new MessageMove(moves));
   
    assertEquals(0, fantomas.getNumberOfTickets(tram));
    assertEquals(0, fantomas.getNumberOfTickets(bus));
View Full Code Here

Examples of cz.matfyz.aai.fantom.message.MessageMoveBase.ActorMove

    assertNotNull(n5);
    Node n6 = g.getNode("6");
    assertNotNull(n6);
   
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(fantomas, n2, null),
        new ActorMove(joker, n1, null)
    };
    g.placeActors(new MessageMove(moves));
    moves = new ActorMove[] {
        new ActorMove(poirot, n3, null),
        new ActorMove(batman, n4, null)
    };
    g.placeActors(new MessageMove(moves));
   
    assertSame(n2, fantomas.getCurrentPosition());
    assertSame(n1, joker.getCurrentPosition());
    assertSame(n3, poirot.getCurrentPosition());
    assertSame(n4, batman.getCurrentPosition());
   
    assertEquals(1, fantomas.getNumberOfTickets(tram));
    assertEquals(1, fantomas.getNumberOfTickets(bus));
    assertEquals(0, fantomas.getNumberOfTickets(universal));
   
    assertEquals(1, joker.getNumberOfTickets(tram));
    assertEquals(1, joker.getNumberOfTickets(bus));
    assertEquals(0, fantomas.getNumberOfTickets(universal));
   
    moves = new ActorMove[] {
        new ActorMove(fantomas, n1, tram),
        new ActorMove(joker, n6, bus)
    };
    try {
      g.moveActors(g.getActors(ClientType.PHANTOM), new MessageMove(moves));
      fail("Movement message verification failed - phantoms moved in wrong order");
    }
View Full Code Here

Examples of cz.matfyz.aai.fantom.message.MessageMoveBase.ActorMove

    assertNotNull(n5);
    Node n6 = g.getNode("6");
    assertNotNull(n6);
   
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(fantomas, n2, null),
        new ActorMove(joker, n1, null)
    };
    g.placeActors(new MessageMove(moves));
    moves = new ActorMove[] {
        new ActorMove(poirot, n4, null),
        new ActorMove(batman, n3, null),
        new ActorMove(japp, n5, null),
    };
    g.placeActors(new MessageMove(moves));
   
    assertSame(n2, fantomas.getCurrentPosition());
    assertSame(n1, joker.getCurrentPosition());
    assertSame(n4, poirot.getCurrentPosition());
    assertSame(n3, batman.getCurrentPosition());
    assertSame(n5, japp.getCurrentPosition());
   
    moves = new ActorMove[] {
        new ActorMove(batman, n2, bus),
        new ActorMove(japp, n6, tram),
    };
    g.moveActors(g.getActors(ClientType.DETECTIVE), new MessageMove(moves));
   
    assertSame(n4, poirot.getCurrentPosition());
    assertSame(n2, batman.getCurrentPosition());
    assertSame(n6, japp.getCurrentPosition());
   
    moves = new ActorMove[] {
        new ActorMove(batman, n3, bus),
        new ActorMove(japp, n5, tram),
    };
    try {
      g.moveActors(g.getActors(ClientType.DETECTIVE), new MessageMove(moves));
      fail("Mesage verification failed - one of the detectives did not move");
    }
View Full Code Here

Examples of cz.matfyz.aai.fantom.message.MessageMoveBase.ActorMove

    assertNotNull(n5);
    Node n6 = g.getNode("6");
    assertNotNull(n6);
   
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(fantomas, n2, null),
        new ActorMove(joker, n1, null)
    };
    g.placeActors(new MessageMove(moves));
    moves = new ActorMove[] {
        new ActorMove(poirot, n4, null),
        new ActorMove(batman, n3, null),
        new ActorMove(japp, n5, null),
    };
    g.placeActors(new MessageMove(moves));
   
    assertSame(n2, fantomas.getCurrentPosition());
    assertSame(n1, joker.getCurrentPosition());
    assertSame(n4, poirot.getCurrentPosition());
    assertSame(n3, batman.getCurrentPosition());
    assertSame(n5, japp.getCurrentPosition());
   
    moves = new ActorMove[] {
        new ActorMove(poirot, n3, tram),
        new ActorMove(batman, n2, bus),
        new ActorMove(japp, n6, tram),
    };
    try {
      g.moveActors(g.getActors(ClientType.DETECTIVE), new MessageMove(moves));
      fail("Message validation failed - immobile detective did move");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.