コード例 #1
0
  public void performedIntervention(Participant p) {

    mgc = (MazeGameController2WAY) this.getC().getTaskController();
    htLastTraversalCount.put(p, mgc.getSwitchTraversalCount(p.getUsername()));
    int idx = this.getC().getParticipants().getAllParticipants().indexOf(p);
    if (idx == 0) {
      participant1mazeInterventions[mgc.getMazeNo()]++;
      Conversation.printWSln(
          "Main",
          "Updating score for (1) "
              + p.getUsername()
              + " to "
              + participant2mazeInterventions[mgc.getMazeNo()]);
      return;
    } else if (idx == 1) {
      participant2mazeInterventions[mgc.getMazeNo()]++;
      Conversation.printWSln(
          "Main",
          "Updating score for (2) "
              + p.getUsername()
              + " to "
              + participant2mazeInterventions[mgc.getMazeNo()]);
      return;
    }
    Conversation.printWSln("Main", "serious error...can't find" + p.getUsername());
  }
コード例 #2
0
  public String showSummary() {
    if (c.getParticipants().getAllParticipants().size() < 2) return "";
    mgc = (MazeGameController2WAY) this.getC().getTaskController();
    String summary = "";
    Vector vParticipants = c.getParticipants().getAllParticipants();
    for (int i = 0; i < vParticipants.size(); i++) {
      Participant p = (Participant) vParticipants.elementAt(i);

      Integer oldTRAVS = (Integer) this.htLastTraversalCount.get(p);
      if (oldTRAVS == null) oldTRAVS = 0;

      summary =
          summary
              + p.getUsername()
              + ": (Trigger: "
              + oldTRAVS
              + " switch traversal count must be less than: "
              + mgc.getSwitchTraversalCount(p.getUsername())
              + mgc.getMazeNo()
              + ")";
      int idx = this.getC().getParticipants().getAllParticipants().indexOf(p);
      if (idx == 0) {
        summary =
            summary
                + "..has received: "
                + participant1mazeInterventions[mgc.getMazeNo()]
                + "..interventions in maze no."
                + mgc.getMazeNo()
                + " --Max:"
                + this.maxInterventionsPerMaze.getValue();
      } else if (idx == 1) {
        summary =
            summary
                + "..has received: "
                + participant2mazeInterventions[mgc.getMazeNo()]
                + "..interventions in maze No."
                + mgc.getMazeNo()
                + " --Max:"
                + this.maxInterventionsPerMaze.getValue();
      } else {
        summary = summary + "BAD ERROR...CAN'T FIND PARTICIPANT " + p.getUsername();
      }
      summary =
          summary + "\n-------------------------------------------------------------------------\n";
    }

    return summary;
  }
コード例 #3
0
  public boolean isCR_OK(Participant p) {
    mgc = (MazeGameController2WAY) this.getC().getTaskController();
    if (this.interventionEARLY && mgc.getMazeNo() > 5) { // //////
      Conversation.printWSln("Main3", "ISCROKABORTED(0)");
      return false;
    } else if (!this.interventionEARLY && mgc.getMazeNo() < 6) { // //////
      Conversation.printWSln("Main3", "ISCROKABORTED(0)");
      return false;
    }

    possCR = pf.getAClarificationFastest(this.mostRecentTextCONTIG); // ////////mostRecentText
    Conversation.printWSln("Main3", this.mostRecentTextCONTIG);

    Conversation.printWSln("Main3", possCR);
    Conversation.printWSln("Main3", "---------------");

    if (possCR == null) {
      Conversation.printWSln("Main3", "ISCROKABORTED(1)");
      return false;
    }
    if (possCR.length() == 0) {
      Conversation.printWSln("Main3", "ISCROKABORTED(2)");
      return false;
    }
    if (this.blockALLCR) {
      Conversation.printWSln("Main3", "ISCROKABORTED(3)");
      return false;
    }

    Conversation.printWSln("Main", showSummary());

    int currentTraversalCount =
        mgc.getSwitchTraversalCount(p.getUsername())
            + mgc.getMazeNo(); // To be able to generate intervention at beginning of each game
    Integer oldTraversalCount = (Integer) this.htLastTraversalCount.get(p);
    if (oldTraversalCount == null) {
      return true;
    }
    if (oldTraversalCount >= currentTraversalCount) return false;

    int idx = this.getC().getParticipants().getAllParticipants().indexOf(p);
    if (idx == 0) {
      if (this.participant1mazeInterventions[mgc.getMazeNo()]
          >= maxInterventionsPerMaze.getValue()) {
        Conversation.printWSln(
            "Main",
            "ISCROKABORTED(5A) "
                + participant1mazeInterventions[mgc.getMazeNo()]
                + "..."
                + maxInterventionsPerMaze.getValue());
        return false;
      }
      // Conversation.printWSln("Main","Can perform intervention participant 1: "+
      // participant1mazeInterventions[mgc.getMazeNo()]+"--"+maxInterventionsPerMaze.getValue());
      return true;
    } else if (idx == 1) {
      if (this.participant2mazeInterventions[mgc.getMazeNo()]
          >= maxInterventionsPerMaze.getValue()) {
        Conversation.printWSln(
            "Main",
            "ISCROKABORTED(5B) "
                + participant2mazeInterventions[mgc.getMazeNo()]
                + "..."
                + maxInterventionsPerMaze.getValue());
        return false;
      }
      // Conversation.printWSln("Main","Can perform intervention participant 2: "+
      // participant2mazeInterventions[mgc.getMazeNo()]+"--"+maxInterventionsPerMaze.getValue());
      return true;
    }
    Conversation.printWSln("Main", "QUITE A BAD ERROR...." + p.getUsername());
    return true;
  }