<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://www.intra-mart.jp/im_bpm" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <bpmn:collaboration id="Collaboration">
    <bpmn:participant id="pool_1" name="パラレルゲートウェイを使用する" processRef="gateway_parallel_gateway_process"/>
  </bpmn:collaboration>
  <bpmn:process id="gateway_parallel_gateway_process" name="パラレルゲートウェイを使用する" activiti:notUseBusinessKey="false" activiti:candidateStarterUsers="aoyagi" isExecutable="true">
    <bpmn:laneSet id="laneSet_gateway_parallel_gateway_process">
      <bpmn:lane id="swimlane_1" name="レーン">
        <bpmn:flowNodeRef>start-event_1</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>parallel-gateway_1</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>script-task_1</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>script-task_2</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>parallel-gateway_2</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>script-task_3</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>end-event_1</bpmn:flowNodeRef>
      </bpmn:lane>
    </bpmn:laneSet>
    <bpmn:startEvent id="start-event_1" name="開始"/>
    <bpmn:parallelGateway id="parallel-gateway_1"/>
    <bpmn:scriptTask id="script-task_1" name="ユーザAのじゃんけんの手を決める" activiti:color="fff9c4" activiti:autoStoreVariables="false" scriptFormat="im_javascript">    <bpmn:script><![CDATA[function run(variables, execution, entity) {
  var random = new java.util.Random();
  var hand = random.nextInt(3);

  entity.setVariable('userA', hand);
}]]></bpmn:script>
</bpmn:scriptTask>
    <bpmn:scriptTask id="script-task_2" name="ユーザBのじゃんけんの手を決める" activiti:color="fff9c4" activiti:autoStoreVariables="false" scriptFormat="im_javascript">    <bpmn:script><![CDATA[function run(variables, execution, entity) {
  var random = new java.util.Random();
  var hand = random.nextInt(3);

  entity.setVariable('userB', hand);
}]]></bpmn:script>
</bpmn:scriptTask>
    <bpmn:parallelGateway id="parallel-gateway_2"/>
    <bpmn:scriptTask id="script-task_3" name="結果を表示する" activiti:color="fff9c4" activiti:autoStoreVariables="false" scriptFormat="im_javascript">    <bpmn:script><![CDATA[function run(variables, execution, entity) {
  var userAhand = entity.getVariable('userA');
  var userBhand = entity.getVariable('userB');

  if (userAhand == userBhand) {
    Debug.console('The game was drawn.');
    entity.setVariable('winner', 'The game was drawn.');
  } else if (userAhand == 0) {
    if (userBhand == 1) {
      Debug.console('USER_A WINS');
      entity.setVariable('winner', 'USER_A');
    } else {
      Debug.console('USER_B WINS');
      entity.setVariable('winner', 'USER_B');
    }
  } else if (userAhand == 1) {
    if (userBhand == 2) {
      Debug.console('USER_A WINS');
      entity.setVariable('winner', 'USER_A');
    } else {
      Debug.console('USER_B WINS');
      entity.setVariable('winner', 'USER_B');
    }
  } else if (userAhand == 2) {
    if (userBhand == 0) {
      Debug.console('USER_A WINS');
      entity.setVariable('winner', 'USER_A');
    } else {
      Debug.console('USER_B WINS');
      entity.setVariable('winner', 'USER_B');
    }
  }
}
]]></bpmn:script>
</bpmn:scriptTask>
    <bpmn:endEvent id="end-event_1" name="終了"/>
    <bpmn:sequenceFlow id="sequence-flow_1" sourceRef="start-event_1" targetRef="parallel-gateway_1"/>
    <bpmn:sequenceFlow id="sequence-flow_2" sourceRef="parallel-gateway_1" targetRef="script-task_1"/>
    <bpmn:sequenceFlow id="sequence-flow_3" sourceRef="parallel-gateway_1" targetRef="script-task_2"/>
    <bpmn:sequenceFlow id="sequence-flow_4" sourceRef="script-task_1" targetRef="parallel-gateway_2"/>
    <bpmn:sequenceFlow id="sequence-flow_5" sourceRef="script-task_2" targetRef="parallel-gateway_2"/>
    <bpmn:sequenceFlow id="sequence-flow_6" sourceRef="parallel-gateway_2" targetRef="script-task_3"/>
    <bpmn:sequenceFlow id="sequence-flow_7" sourceRef="script-task_3" targetRef="end-event_1"/>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_Collaboration">
    <bpmndi:BPMNPlane id="BPMNPlane_Collaboration" bpmnElement="Collaboration">
      <bpmndi:BPMNShape id="BPMNShape_pool_1" bpmnElement="pool_1">
        <dc:Bounds x="260" y="50" width="850" height="287"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_swimlane_1" bpmnElement="swimlane_1">
        <dc:Bounds x="290" y="50" width="820" height="287"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_start-event_1" bpmnElement="start-event_1">
        <dc:Bounds x="370" y="161" width="35" height="35"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_parallel-gateway_1" bpmnElement="parallel-gateway_1">
        <dc:Bounds x="480" y="158.5" width="40" height="40"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_script-task_1" bpmnElement="script-task_1">
        <dc:Bounds x="585" y="60" width="102" height="80"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_script-task_2" bpmnElement="script-task_2">
        <dc:Bounds x="585" y="240" width="106" height="80"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_parallel-gateway_2" bpmnElement="parallel-gateway_2">
        <dc:Bounds x="760" y="161" width="40" height="40"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_script-task_3" bpmnElement="script-task_3">
        <dc:Bounds x="860" y="141" width="100" height="80"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_end-event_1" bpmnElement="end-event_1">
        <dc:Bounds x="1030" y="161" width="35" height="35"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_sequence-flow_1" bpmnElement="sequence-flow_1">
        <di:waypoint xsi:type="dc:Point" x="405" y="178.5"/>
        <di:waypoint xsi:type="dc:Point" x="480" y="178.5"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_sequence-flow_2" bpmnElement="sequence-flow_2">
        <di:waypoint xsi:type="dc:Point" x="520" y="166.9558823529412"/>
        <di:waypoint xsi:type="dc:Point" x="585" y="129.4375"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_sequence-flow_3" bpmnElement="sequence-flow_3">
        <di:waypoint xsi:type="dc:Point" x="520" y="193.21014492753622"/>
        <di:waypoint xsi:type="dc:Point" x="585" y="241.01811594202897"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_sequence-flow_4" bpmnElement="sequence-flow_4">
        <di:waypoint xsi:type="dc:Point" x="687" y="128.6875"/>
        <di:waypoint xsi:type="dc:Point" x="760" y="169.75"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_sequence-flow_5" bpmnElement="sequence-flow_5">
        <di:waypoint xsi:type="dc:Point" x="691" y="243.04929577464787"/>
        <di:waypoint xsi:type="dc:Point" x="760" y="194.94366197183098"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_sequence-flow_6" bpmnElement="sequence-flow_6">
        <di:waypoint xsi:type="dc:Point" x="800" y="181"/>
        <di:waypoint xsi:type="dc:Point" x="860" y="181"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_sequence-flow_7" bpmnElement="sequence-flow_7">
        <di:waypoint xsi:type="dc:Point" x="960" y="180.0909090909091"/>
        <di:waypoint xsi:type="dc:Point" x="1030" y="178.8181818181818"/>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>