Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please, Draw a Sequence Diagrams and describe it in short. Start Game Introducti

ID: 3606893 • Letter: P

Question

Please, Draw a Sequence Diagrams and describe it in short.

Start Game

Introduction:
The is the function which tells the system to start a game in the chosen mode with the chosen threshold, and it connects to the server if necessary.

Inputs:
The input to begin this function will likely be a keyboard input on the GUI menu.

Processing:
The function will create a virtual board and call the AI to participate, as an opponent to either the user or another team’s AI.

Outputs:
The function will be a virtual board on the GUI so the user can play his first move, or the first move of the AI sent to the server.

Explanation / Answer

Hi
Please create html file and put below code :

<html>
<head>
<title>title</title>


</head>
<body>
<script src="jquery-1.11.0.min.js"></script>

<input type="button" value="Start Game" id="start" />
<input type="button" value="Stop Game" id="stop" />

<div id="startSelect" >Choose number 0 to 9 <select id="chosedno">
<option value="" selected="selected">Select Number</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>

</select></div>

<div id="stopedDiv">
Your chosen number is : <label id="green"></label><br>
Your score so far :<label id="red"></label><br>
</div>

<div id="randomdiv">
<label class="label0" id="label0"></label>
<label class="label1" id="label1"></label>
<label class="label2" id="label2"></label>


</div>
<script type="text/javascript">
$(function(){
var score = 0;
var selectedno;
var clickedno;
var cleartime;
$('#start').click(function(){
   $('#startSelect').show();

});

$('#stop').click(function(){
   $('#startSelect').hide();
        $('#stopedDiv').show();
        $('#green').text(selectedno);
        $('#red').text(score);
        clearTimeout(cleartime);
});

$('#startSelect').change(function(){
   selectedno = $('#chosedno').val();
      randomno();
});
function randomno(){

   for(var i=0; i < 3; i++){
   var randomnumber = Math.floor(Math.random() * (9 - 0 + 1)) + 0;
   $('#label'+i).text(randomnumber);   
  
   }
     cleartime = setTimeout(function(){randomno();}, 1000);
}
$(document).on('click','.label0',function(){
   var clickedv= $('.label0').text();
        
   if(selectedno == clickedv ){
       score = score+1;
   }else{
       score = score -1;
   }
});
$(document).on('click','.label1',function(){
   var clickedv= $('.label1').text();
       
   if(selectedno == clickedv ){
       score = score+1;
   }else{
       score = score -1;
   }
});
$(document).on('click','.label2',function(){
   var clickedv= $('.label2').text();
        
   if(selectedno == clickedv ){
       score = score+1;
   }else{
       score = score -1;
   }
});
});
</script>

</body>
</html>

We have used click, change function and setTimeout function in javascript.

Please download jquery-1.11.0.min.js from internet and put with this html file.

Please rate me.

Thank you.