Pages

Monday, June 3, 2019

Tutorial 2: SLS Hackathon 3-4 Jun 2019 INN x CSC, 9 Jurong Town Hall Road

SLS Hackathon 3-4 Jun 2019 INN x CSC, 9 Jurong Town Hall Road

Event:

 poster

go.gov.sg/slshack2019

SLS Hackathon 3-4 Jun 2019

Venue:

INN x CSC, 9 Jurong Town Hall Road

 

Venue and Date:

  1. SLS Hackathon 2019 HQ Training Session #1 Date: Thurs 25 April 2019 Time: 3 – 5pm Venue: MOE HQ Buona Vista, Tower Block, Level 17, MR@T17-01 
    photo from Damian
  2. SLS Hackathon 2019 HQ Training Session #2 Date: 23 May time 2.30-5.00pm (planning) Pre Hands-On workshop at MOEHQ Bouna Vista Level 24 Function Room




  3. SLS Hackathon 2019 Day 1: 3-4 Jun 2019 0900-1700 Hackathon INN x CSC, 9 Jurong Town Hall Road
  4. SLS Hackathon 2019 Day 2: 3-4 Jun 2019 0900-1700 Hackathon INN x CSC, 9 Jurong Town Hall Road



Email

ETD is organising a SLS Hackathon on 3 & 4 June to engage early SLS adopters by teaching them how to use Easy JavaScript (EJSS) to create simple interactives which they can use to make their SLS lessons more engaging.

Goal

Teachers form teams to create SLS HTML5 resources, which could be simulations or games, to do their own coding, to learn, to be uploaded into SLS in at least 1 lesson

Pre-qualification
Preferably one person in the team of three can do the tutorial below.
The other 2 team members could be providing game testing, feedback and content knowledge to link back to learning in subjects.

Problem Statement

“How might we design a good SLS lesson by tapping on the affordance of EJSS simulations?”

Trainers

Lawrence WEE
Tan Seng Kwang
Leong Tze Kwang
Darren Tan

Tools required

  1. EJSS authoring tool Direct Download recommended https://gitlab.com/ejsS/tool/tree/master/Release such as  https://gitlab.com/ejsS/tool/blob/master/Release/EjsS_5.3_190422-beta.zip or any latest official version for the ability to create both Java and Javascript. 
  2. EjsS 5.X Requires Java Runtime Environment (JRE) https://www.java.com/en/download/ 1.7 or 1.8.  Latest is 8v201 


    It is NOT fully Java 9 compatible. Depending on your computer, your computer may need a different file.
  3. Chrome Browser.

Participants

30 Participants will be from schools or HQ and will be competing in groups of 3. Roughly 10 groups.





Tutorial 2:

Create a brand new Game Step-by-step EJSS tutorial




  1. unzip the downloaded EjsS_5.3_190422-beta.zip  file into any location easy to find eg. Desktop or D Drive.
    updated instructions, old screenshots
    use EjsS_5.3_190422-beta.zip if possible
  2. navigate to the folder eg it is called EjsS_5.3 and double click the EjsConsole.jar to launch the Ejss program
  3.  if you are asked to trust it, please do that, for example in Mac, right click and select the Java runtime to open the trusted file.
  4. a pop up appears, select Open
  5. Initialization to JavaScript
  6. select Ok on the Error on the Ejss server not available for updates, the Spanish professors Paco and Felix are working on it, or you can set it to never check for updates. 
  7. the first time Ejss editor runs, like all java program, it needs a workspace, just accept the default suggested workspace inside EJSS5.3. 
  8. a window screenshot, EJSS has be defaulted to JavaScript since 20190422, so you can skip this step
  9. on the Ejss console 5.3 select Basic options and select Programming language as JavaScript as we are only interested in making interactives that run in SLS, mobile phones, etc
    EJSS has be defaulted to JavaScript since 20190422, so you can skip this step
  10. close the java flavor of the editor by clicking on the RED x on the top left corner of the editor
  11. relaunch EjssConsole.jar by double-clicking the file
  12. again, the editor and the console will be open and look something like this
  13. Now, we are starting to make a Catch Falling Apple Game
  14. roughly we know game needs a time, t and an increment dt to run the simulation.
  15. Select the radio button Model and click on the Variables to create a page of variables and click OK 
  16. in this page, click on the Name and Initial value and the Dimension as shown, for example, t is time, initial value =0, dt is time step, initial value =0.05
  17. go to Evolution, click on a page for ODE's ordinary differential equations and click OK
  18. key in Independent Variable as t and Increment as dt 
  19. Run the sim
  20. to test whether the simulation/game is working, to generate it click on the green right arrow
  21. Setting the Chrome as your browser
  22. sometimes, you default browser is non functional like it doesn't support JavaScript ....., to change to Chrome on Windows go to Start - Default Programs 
  23. Click and choose Set your Default programs
  24. Select Chrome and give it all defaults
  25. Set this program as default
  26. so Chrome should be launching now from EJSS editor instead
  27. Save the name with no space bar, for example, catchapplegametemplate.ejss and click Save. The files will be in the source folder of your workspace 
  28. click Ok on the warning of no HTML view
  29. select HtmlView radio button and click on the panel to create a simulation view as suggested by ejss editor and click OK
  30. the view should look like this
  31. Ejss editor comes with Interface, 2D Drawables, and 3D Drawables, select a simple template of SinglePlot
     and drop it exactly on the simulation view position
     
  32. again, click the green left arrow to generate the simulation 
  33. roughly we know we want to have 4 apples fall down and a basket to catch it so to make the 4 apples fall, understanding array will be useful. Apples will have the position x and y and the speed to control the motion down is vy.  The game may have 8 rounds and 4 options to chose from. n is just a container variable because I usually use n for dimension.
  34. go to Model- Variables and create the missing variables mentioned above and their initial values.
  35. regularly save your work and generate the simulation to see the effects of new changes.
  36. the simulation should still run, that means the codes are generated correctly but with not much to show for.
  37. select HtmlView radio button and double click on the
    plottingPanel, a Properties for plottingPanel will pop up 
  38. input Width as 100% and Height as ""+window.innerHeight*0.8 
  39. generate the simulation it should look like this
  40. This is a bit like graph plotting and defining the 4 boundaries of the graph paper or plottingPanel, we key in the MinimumX as -0.5, MaximumX as 3.5 and MinimumY as 0 and MaximumY as 6 as the size of the plottingPanel
  41. generate the simulation 
  42. in the game requires students to click on the plottingPanel so select Interaction-Enabled true
  43. generate the simulation and you can click on the plottingPanel and there are values shown on the bottom left corner now.
  44. for the 4 apples, to show them on the plottingPanel click on the 2D drawables, ImageSet
    and drop it on the plottingPanel
  45. double click on the ImageSet and add the numberofElements, X and Y and SizeX and SizeY and pixelSize true
  46. for file manager, create a folder in the source folder with your file catchapplegametemplate.ejss let call the folder catchapplegametemplate. Since my workspace is /Users/lookang/Google Drive/PublicLawrence/workspace/I will create the folder there to be with the *.ejss.
  47. a possible folder location in workspace source /Users/lookang/Google Drive/PublicLawrence/workspace/source/catchapplegametemplate 
  48. now go to Chrome browser and search and apple image, make sure to use Tools, Label for reuse with modification and download your apple picture and save it in the folder. Note that EJSS editor only supports png format for transparent background, jpg or jpeg works but there will be this white background color that will show up in the simulation, svg is not supported. 
  49. or you can also use this apple, right click it and save it to your computer.
  50. copy this apple file into the folder created, for me, it is /Users/lookang/Google Drive/PublicLawrence/workspace/source/catchapplegametemplate, it may be inside this path /Users/lookang/Google Drive/PublicLawrence/workspace/source/catchapplegametemplate/apple.png 
  51. go back to Ejss editor, remember we were working on the imageSet, double click on the imageSet to pop up the properties, look for ImageUrl and add it 


  52. the path looks something like this "./catchapplegametemplate/apple.png"
  53. generate the simulation, the output will look like this 
  54. to make the apple fall down, go to Model - Evolution - double click on the State and add y and the Rate is -1
  55. generate the simulation, the output will look like this 
  56. notice the apples all fall at the speed of -1
  57. to make the apples fall at random speed, call the Rate -vy[i],
    if you try to generate the simulation it will fail, do you know why?

  58. in programming, it is useful to know what went wrong, Chrome has a useful feature called Developer Tools, to start it, click on the three dots and goto More Tools - DeveloperTools
  59. the output show this
  60. so do you know what to do next? hint variables?
  61. you probably realized you need to declare the variable vy introduced in evolution page so remove the error of vy not defined
  62. try to run the simulation again by clicking the green run button and again, chrome warns of another error, this time on i
  63.  so if you want to use [i], need to make an array of n dimension
  64. and also another mistake is the variable y also need to be of [i] in the evolution page 
  65. generate the sim and notice the apples are moving upwards now 
  66. can you think of a way to way the apples go down?
  67. the easiest way will be to make variable vy =1 in the Model - Variable page
  68. generating the simulation will produce something that looks like this
  69. can you think of a way to make the apples fall at a different speed?
  70. the hint is to introduce javascript such as Math.random() that introduce a random  (inclusive of 0, but not 1) number, which you can google https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random 
  71. the generated simulation or output will look like this
  72. while we can feel the excitement (first time can control JavaScript simulation) but did you notice any potential problem?
  73. yes, Math.random() may result in a random number that has a small chance to be 0
  74. can you think of a way to make the number greater than a minimum speed?
  75. yes, google can help and the code is Math.max() https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max so Math.max(vy, 0.5) will return a number larger. so if the variable vy is 0,   Math.max(vy, 0.5) returns 0.5, if vy is 0.8, Math.max(vy, 0.5) returns 0.8. copy this code into the vy in the variable page if you have difficulties 
    • Math.max(Math.random(),0.5) 
  76. the output will look like 
  77. sometimes, we want to know exactly what are the exact values inside vy, we can use this method to display the value. add this into the HtmlView - plottingPanel - (double click it) - Decoration - TRMessage 
    • "vy="+vy
  78. generate the output, notice the Top Right Message is displaying vy[0], vy[1], v[2], and vy[3] values in yellow box
  79. how to create a basket with position (xc,yc) to catch the apple? 
  80. go to variable and right click to create a new page 
  81. and create xc and yc with 0 and 0.5 initial values
  82. ejss has a cool feature called group for organizing all the drawables in a plottingPanel
  83. click and drop it on the plottingPanel
  84. click Ok to agree to put a group on the plottingPanel for organizing on the catcher assets
  85. the group should appear just below the imageSet
  86. can you figure out how to insert a picture of an image? it is similar to the earlier example of apples
  87.  look for the HtmlView - 2D Drawables - Image
    and drop it on the plottingPanel and agree to the default name (you can change it if you like)
  88. the image should be netted in the group
  89. key in these values inside the respective Fields. (xc, yc) controls the actual position of the image, SizeX =200 ad SizeY=200 and PixelSize = true controls the appearance of the image, enabledPosition = "ENABLED_X" because I only want the catcher basket to be drag in X direction only for ease of gameplay and ImageURL = "./CatchingGame/basket3.png" so you need to copy a picture of a basket and copied it to the location in source folder previously used as /Users/lookang/Google Drive/PublicLawrence/workspace/source/catchapplegametemplate for me.
  90. again exercising good internet practices look for an image licensed for reuse like in step 40 
  91. or you can use this image of a basket, right click on it and save it to the location on your hard disk in the where your workspace is defined, for me it is /Users/lookang/Google Drive/PublicLawrence/workspace/source/catchapplegametemplate 
  92. the location of the source should look like this 
  93. click the folder catchapplegametemplate and copy the basket inside 

  94. generate the simulation and the chrome browser should show this, and drag the basket should allow you to move it LEFT and RIGHT only.
  95.  make the first apple go back to the top return y[0] = 6 , in code y[0]-6 = zero crossing when they reach the bottom, y[0]=0,  to do this, goto Model - Evolution - Events 
  96. click Events and a pop up will appear, click it to create a page
  97. click OK to accept the name 
  98. and the Event for ODE Evolution Page will show this by default
  99. type in the Zero condition and Action
  100. generate the output to see this effect 
  101. repeat the steps for second, third and fourth apple bearing in mind the same idea of creating another Event page for y[1], y[2], y[3] respectively
  102. EJSS editor has a nice feature called 'Copy this page', right click and selects the option
  103. change the number 0 to 1 because we are trying to reference the second element in the array of the apples 
  104. check the output, you should see the apple y[0] and y[1] are able to restart the variable y position when they reach y[0] = 0 and y[1] =0 
  105. repeat the steps above for y[2] 
  106. and y[3]
  107. check the output by clicking on the green run button 
  108. create a new ODE Evolution Page and 
  109. name new page collisioncorrect 
  110. to detect basket (xc, yc) with apple 1 (x[0],y[0]) , use Pythagoras theorem, in code
    • Math.sqrt((x[0]-xc)*(x[0]-xc)+(y[0]-yc)*(y[0]-yc)) 
  111. to calculate the separation check if the separation is equal to 0.5, putting it in code
    • return Math.sqrt((x[0]-xc)*(x[0]-xc)+(y[0]-yc)*(y[0]-yc)) -0.5;
  112. the action will be to increase a score by 2 and place the 4 apples back to the starting top position
    • //alert();
    • score=score+2;
    • y[0]=6;
    • y[1]=6;
    • y[2]=6;
    • y[3]=6;
  113. // is comment line, anything after // is not interpreted by the browser and serve as useful comments for human to read
  114. the command alert() is useful for debugging the setup breakpoints to see the effects of that code
  115. did you notice any problem with the code? yes! the variable score is just introduced and needs to to be declared in the Model- Variables page - say Var Table 2
  116. to make sure that the score indeed increases by 2, we add in the HtmlView - plottingPanel - Decoration - TLMessage code is
    • "score="+score
  117. the output looks like this, notice the Top Left corner show score
  118. similarly, create for events for which the basket collide with the other apples
  119. copy the collsioncorrect page
  120. change the x[0] to x[1] and y[0] to y[1], -0.5 change to -0.25 as it should be harder to get the wrong apples and the score=score-1
  121. test your simulation by generating the output and drag your basket to catch the second apple at position (x[1],y[1]). you should notice the score decrease by 1
  122. copy for the third apple (x[2],y[2]) by right click and copy page
  123. copy for the fourth apple (x[3],y[3])
  124. the output looks like this, drag your basket and catch them. Did the score change accord to your code?
  125. so for clarity of the apples, let's add numbers to the apple using an array, goto Model-Variables -Var Table and add text [1,2,3,4] 
  126. go to HtmlView - plottingPanel 2D drawables - sets of 2D drawables - TextSets and add it to the plottingPanel below the imageSet, so that the numbers will appear on top of the image apples. 
  127. double click on the textSet and in the pop-up dialogue box, add these fields with the respective variables, n is the number of elements to display, Position x and y and the text which was defined as [1,2,3,4]
  128. run the output to test
  129. to shuffle the apples,  create a new page on Model - Custom  
  130.  google shuffle javascript function and look the function, or you can just go to my GitHub https://github.com/lookang/codesforejss/blob/master/function%20shuffleArray(array) and copy this code in the Model - Custom - Page. You may rename the page name to reflect shuffleArray(array) but it is not critical, just for ease of finding your codes.
  131. to use this function, type shuffleArray(x) but where should this be done?
  132. since we may want this shuffleArray(x) to run at the beginning of the simulation, go to Model - Initialization - create a new page and call it shuffleArray(array)
  133. it should look like this
  134. test your simulation by clicking on the green run button. Notice the shuffleArray(x) shuffles the position x[0],x[1],x[2],x[3], so the correct answer is still 1 which in my screenshot is now x[2]. This code helps us to simplify our correct solution to always the apple with the number 1.
  135. let's add sound when the basket catches the apple 1, to do that, find a sound file and copy it the workspace folder, for me, it was at /Users/lookang/Google Drive/PublicLawrence/workspace/source/catchapplegametemplate 
  136. or you can use this file called Ding Sound Effect.m4a  
  137. even though the file is in the directory folder, EJSS editor needs a way to know how to call the sound file out, so go to HtmView - Interface - Audio, and click and drop it on the wrappedPanel, do not change this name audio as we will be referencing it.

  138. double click on the audio and a pop-up properties panel will appear for which the audioUrl is the location of the file "./catchapplegametemplate/Ding Sound Effect.m4a". You can click on
    and select via the pop-up prompts and click Ok
  139. the property pop-in looks like this
  140. as I have decided to use this sound file when the user collides apple 1 with the basket, go to Model - Evolution - Events - collisioncorrect Page and add this code in the Action
    • _view.audio.play(); // the name audio refers to this name on the wrappedPanel 
  141. the Events collisioncorrect Page looks like this 
  142. the order of the _view.audio.play(); after score=score+2 decides how the browser will sequentially execute top to bottom, but in this case, it is not critical
  143. run the simulation to test the simulation, the sound from the file Ding Sound Effect.m4a will be executed when the basket catches the apple 1 (correct answer by my design). There should be no sound for basket catches apple 2, 3 and 4 but feel free to add yourself other wrong answer sounds onto the respective positions of the other Events for basket meets apple 2, 3, and 4 respectively 
  144. to make the game really interesting, let's design a game with 8 number of rounds with 4 apples as options (mentioned earlier before).
  145. create a new page of variable 
  146. and name it for teachers to change
  147. and use answerstringarray to store the words on the apples and catchanswerarray stores to words on the basket.  Copy these values into  answerstringarray and catchanswerarray and declare the Dimension as [numberofoption][numberofrounds+1]
    • [["感到","及时","前来","各式"],["苦苦","草草","大开","人才"],["支持","各式","感到","苦苦"],["及时","前来","大开","人才"],["前来","各式","感到","苦苦"],["大开","人才","及时","支持"],["人才","感到","苦苦","各式"],["各式","及时","前来","人才"],["","","",""]]
    • ["气愤","哀求","鼓励","阻止","探望","眼界","培养","各样","","","",""]
  148. answerstringarray is where the 4 possible answers are stored in an array the "" keep the string format, [] defines each array and , comma separates each array from each other and the final first and last [] is the format for array
  149. it is not important if you don't understand Chinese as we will keep the numbers on the apples so just drag the basket horizontally and catch the apple 1 for correct. In addition, this tutorial demonstrates the flexibility of the EJSS editor as a tool for almost any interactive simple game created by ordinary teachers like us.
  150. the Model-Variables - for teachers to change looks like this 
  151. whenever we introduce a big change to the simulation, run to test that it still runs correctly, usually, it is better to save a new name (lower save icon)
    to the filename and revert to older versions and restart adding new codes than to debug (which usually is more painful than revert to earlier working file). So save this before continuing. Let's name it catchapplegametemplatev01.ejss 
  152. run your simulation and check this code didn't break your game 
  153. let's create a placeholder for showing some textanswer to overlay on the apples for Teaching and Learning purposes. Go to HtmlView - plottingPanel - textSet and right click to copy it 
  154. and paste it in the same position, note that EJSS editor automatically rename the paste as textSet2
  155. double click on textSet2 the properties pop up already has the earlier values, change the Text to textanswer 
  156. note that EJSS editor doesn't know you want it to be a variable as it is not defined and automatically add the string "" to it. 
  157. if you want EJSS to understand textanswer is a variable, you can use %textanswer% 
  158. it now appears with a pink background suggesting EJSS editor doesn't understand what it is. Do you know how to fix this?
  159. go to Model - Variables - Var Table tab and add it as shown
    • ["感到","及时","前来","各式"]
  160. run the simulation to check 
  161. I will introduce a comboBox to allow users to change different levels of difficulties, go to HtmlView - Interface - ComboBox 


  162. click the combobox and drop it on the executionPanel above the runPauseButton, agree to create it 
  163. double click on the Options Properties for comboBox and add the options 
    • ["sec 1","sec 2","sec 3","sec 4"]
  164. this will create an option but it needs to know what to do so go to https://github.com/lookang/codesforejss/blob/master/comboBox and copy the code and paste inside OnChange and edit accordingly to fit your options 
  165. the codes should look like this
    • var opts = _view.comboBox.getProperty("SelectedOptions");  // array of options
    •     var option = (opts.length > 0)? opts[0]:""; // selected option 
    • if ( option=="sec 1"){
    •   
    •   }
    • else if ( option=="sec 2"){
    •  
    •   }
    •   else if ( option=="sec 3"){
    •  
    •   }
    •   else if ( option=="sec 4"){
    •  
    •   }
  166. run and simulation to check
  167. since the Chinese words and the number overlay as they share the same position (x[],y[]) but yet I do not want to move it too much, I can use Relative Position. 
  168. go to HtmlView - plottingPanel - textSet and double click to start the property, 
    look for  Relative Position and add "NORTH" via the button  and click on the bottom icon which says "NORTH"


  169. do the same for textSet2 but this time is "SOUTH" 
  170. run the output to check 
  171. now that the apple is done with words and number, do the same of the basket go to Model - Variables - Var Table 2 tab and add the variable name as textcatch and "气愤" as an initial value so that when the simulation first run, it has this value.
    20190422 note error: do not include [] as it may cause bug in iOS deployment, just pure string "气愤"
  172. to assign textcatch to a placeholder for the variable textcatch,  go to HtmlView -2D drawables - textand add it to the plottingPanel - group
    which is for the basket, click ok
    and it looks like this.
  173.  to edit the properties of text, double click on it and add position X as xc position Y as yc and the text as %textcatch% and RelativePosition as "SOUTH"
  174.  the output looks like this 
  175. let the simulation run for a few rounds, did you something amiss? the apples did not shuffle! Where should you add codes to make the apples shuffle?
  176. yes! add shuffle anywhere that makes sense. for example right after the event of a correct collision of basket and apple [0] hint: go to Models - Evolution - Event  Page collisioncorrect and add shuffleArray(x); 
  177. run the output and notice the first apple actually changes position after the correct collision is detected and actions executed.
  178. in addition to adding sound via actual mp3 files, in step 128, it is possible to harness the power of web API from text to speech synthesis. go to https://github.com/lookang/codesforejss/blob/master/function%20speech%20() and copy this code in a new custom page in Model - Custom - right-click to create a new page for ease of management of codes 
  179. and name it as speech 
  180. copy and paste the codes and replace all the existing default to become it 
  181. to use this code speech(), we need to replace the inside with the words needs for text to speech synthesis. for example, if we wanted the simulation to say 感到 when the simulation gets a correct response basket collide with apple 1, where should the code be added to?
    • speech(感到) ;
  182. yes, add to Models - Evolution - Events - collisioncorrect - Action  
  183. run the simulation to test and speech should be added when basket collide with apple 1, for this API to work on Windows, Mac, Linux and Android Chrome browser.
  184. to get this API on work on iOS, it is necessary to add this speech code to any button on the simulation as required by Apple, so let just use the play button, go to HtmlView - runPauseButton - OnClick 
    • _play();
    • speech("玩"); // needed for iOS
  185. run the simulation and use a iOS device to test, which will be difficult without a web server that you can FTP the file up https://iwant2study.org/lookangejss/chinese/ejss_model_catchapplegametemplatev01/catchapplegametemplatev01_Simulation.xhtml, you just have to believe me and watch this https://www.youtube.com/watch?v=CtPRZRnNksE YouTube
  186. to dynamically speech the correct answer, use this code, recall that textanswer[0] refers to the zeroth element in the array textanswer and textcatch is the basket text.
    • speech(textanswer[0]+textcatch);
  187. run the simulation to test the dynamic speech
  188. adding a scoring mechanism to correct
  189. I use an counter variable called correct, which will increase by 1 every time the user gets the correct answer. Please declare your variables in the appropriate page, see screenshot for the hint
  190. go to Models - Evolution - Events - collisioncorrect to add the line
    • correct = correct +1; // game mechanism counter to increase correct by one
  191. run to test your new additional code works before progressing on
  192. the idea is if correct is equal to 8, the simulation will pause and show a Dialog Box to congratulate the user and show the score and the maximum possible score, else we replace textanswer and textcatch will increment to the next set in the array in a increasing by 1  
    • if (correct==8){ // game mechanism counter
    •   _pause();
    •   _tools.showOkDialog("游戏结束,恭喜你得到"+score+"/"+2*numberofrounds+" !");
    •   }
    •   else{
    • textanswer=answerstringarray[correct]; //since correct is increase by 1, use this to change 4 options
    • textcatch=catchanswerarray[correct]; // change basket text as well
    • } // game mechanism counter
  193. check the output and run the game until correct==8 
  194. adding a negative scoring mechanism to incorrect
  195. to push the boundary of gaming, let say if the user got the answer wrong, a penalty is impose. To do that, can you think of a way to add using these codes and where should it be added to detect the incorrect collisions?
    • score=score-1;
  196. yes, go to Model - Evolution - Event - collisioncorrect 2 and rename it collisionwrong2 for ease of human reading and add the score=score-1 to the Action field
  197. test the effects of the new code on the apple 2 , notice the score will decrease by 1
  198. do the same of the apple 3 
  199. and 4
  200. test your apple 3 and 4 by click on the green right arrow
    , does it decrease the score by 1? 
  201. adding data analytics?
  202. in my interactions with teachers who use my simulations, they have suggested that it would be nice if as they walk around to facilitate learning with the simulations that there be a log of the various things the user got correct or wrong. the following is a data log mechanism and displaying it on the simulation top right corner.
  203. add variable log and make sure the initial value is left blank because i am using the fact that it is undefined in the beginning
  204. add this code to the Model - Evolution - Events - Collisioncorrect0 , wht it does is to add to itself and next line and add textanswer[0] ( apple 1 text) and basket textcatch and add a unicode for correct tick. 
    • log = log+"\n"+textanswer[0]+textcatch+"✅"; // even though the unicode is not showing up correctly in EJSS editor, it work perfectly in Chrome
  205. to make it appear at the top right corner text, go to HtmlView - plottingPanel - double click on it and a pop up properties - select Decoration - TRMessage and add this line of code
    • "分数="+score+"/"+2*numberofrounds+"\n"+log 
  206. what it does is to display a string called "分数=" and concatenate with variable score and concatenate with 2 multiply by numberofrounds which has an initial value of 8 and next line and concatenate with the log, run the simulation to check 
  207. unsatisfied with the undefined at first, we will assign a value if it is undefined initially by going to https://github.com/lookang/codesforejss/blob/master/undefined copy the code and paste it on the Model - Initialization - create a new page


    and name it undefined
  208. alternately you can use the code here
    • if (log==undefined){
    •   log="";
    •   }
  209. the run simulation should have this log without the initial undefined
  210. similarly, can you figure out a way to show even the incorrect answers? to strength the learning analytics ?
  211. go to Model - Evolution - Events - collisionwrong2 and add this code that the log and add to itself and next line and concatenate textanswer[1] and concatenate textcatch and concatenate the unicode ❌. 
    • log = log+"\n"+textanswer[1]+textcatch+"❌";
  212.  test your run simulation
     
  213. repeat the steps for apple 3 using the code
    • log = log+"\n"+textanswer[2]+textcatch+"❌";
  214. and apple 4 
    • log = log+"\n"+textanswer[3]+textcatch+"❌";
  215. run the simulation to test the codes
  216. the final analytics cum gamification, is even if the user does not choose the apples, we can minus 0.5 marks to the score and also display to the teacher, what are some of the inactions by the user.
  217. go to Model - Evolution - Event and add a logic that count 4 times for each apple to be reposition back to 6, score minus 0.5 and add to the log. my code is 
    •  notrynumber = notrynumber+1;
    • if (notrynumber%4==0) {
    • score=score-0.5;
    • log = log+"\n"+"口口"+textcatch+"❓";
    • }
  218. remember that notrynumber is a newly introduced variable, how should you make EJSS understand it?
  219. yes, go to Model - Variables - Var Table 2 and add it
  220. do you still recall how to make EJSS display the value of any variable?
  221. yes, use any empty BRMessage for example add 
    • "notrynumber = "+notrynumber
  222. the run simulation should be able to show notrynumber becoming 1 if the user did not catch apple 2 
  223. add the same code into Event 2 
  224. Event 2 2
  225. Event 2 2 2
  226. run the simulation, notice the score does -0.5 when all 4 apples are reposition back to y =6 but the notrynumber is stuck and for the game to be fair, we need to reset this number notrynumber back to 0 when the correct collision is detected.
  227. go to Model - Evoltuion - Events - collisioncorrect and add 
    • notrynumber=0;
  228. Buggy apple disappearing?
  229. some times, the apple has go down to below 0 without triggering the Action for Event, Event 2 Event 2 2 and Event 2 2 2 which control the apple reposition with they reach y = 0. The Type Zero crossing sometimes cannot detect this Zero Condition so to ensure Zero condition is met, try Type as State, which means y = 0 is sure to be detected.
  230. change the Type to State event for Event 2 
  231. Event 2 2
  232. Event 2 2 2 
  233. missing apple should happen anymore when Event State Type is selected
  234. comboBox menu for user to change the levels of difficulties
  235. navigate to HtmlView - comboxBox - double click for the pop up properties. click on the the Onchange to edit
  236. the Code for comboBox Onchange looks like this for earlier parts 
  237. using this template code, we can control what the combo Box does when the respective option are selected. we have designed a simple way for teachers to key in their own questions here by adding new option, for example sec 5 or TPSS sec 1 etc. the following is for sec 1 and we assign answerstringarray and catchanswerarray. this is to ensure when the user change from unknown option to sec 1 and option is understanding and assign correctly 
    20190422 error on iOS deployment: for catchanswerarray just use pure string, do not need to add []
    • answerstringarray=[["感到","及时","前来","各式"],["苦苦","草草","大开","人才"],["支持","各式","感到","苦苦"],["及时","前来","大开","人才"],["前来","各式","感到","苦苦"],["大开","人才","及时","支持"],["人才","感到","苦苦","各式"],["各式","及时","前来","人才"],["","","",""]]; // last option round for blank
    • catchanswerarray=["气愤","哀求","鼓励","阻止","探望","眼界","培养","各样",""]; // last option round for blank
  238. do the same for sec 2 using their own respectively answerstringarray and catchanswerarray
    20190422 error on iOS deployment: for catchanswerarray just use pure string, do not need to add [] on each array
      •  answerstringarray=[["礼品","眼睛","苦干","读书"],["眼睛","内容","提供","享用"],["苦干","内容","预先","享用"],["读书","礼品","埋头","享用"],["提供","埋头","内容","预先"],["丰富","礼品","注视","享用"],["定位","提供","礼品","技巧"],["美食","技巧","注视","提供"],["","","",""]]; // last option round for blank
        • catchanswerarray=["精美","注视","埋头","技巧","住宿","内容","预先","享用",""]; // last option round for blank
      1. do the same for sec 3 using their own respectively answerstringarray and catchanswerarray
        20190422 error on iOS deployment: for catchanswerarray just use pure string, do not need to add [] on each array
        • answerstringarray= [["草原","造型","画作","竹子"],["大地","风景","活动","画作"],["动物","草原","竹子","大地"],["造型","大地","草原","竹子"],["风景","活动","动物","画作"],["活动","画作","大地","动物"],["画作","草原","竹子","大地"],["竹子","大地","风景","活动"]];
        •  catchanswerarray=["宽阔","照耀","罕见","独特","宜人","休闲","欣赏","青翠"]; 
      2. do the same for sec 4 using their own respectively answerstringarray and catchanswerarray
        20190422 error on iOS deployment: for catchanswerarray just use pure string, do not need to add [] on each array
        • answerstringarray=[["时间","紧张","树木","性格"],["紧张","讨回","身体","树木"],["优惠","女佣","性格","讨回"],["树木","时间","身体","紧张"],["女佣","性格","时间","身体"],["性格","讨回","紧张","树木"],["身体","时间","女佣","优惠"],["讨回","紧张","性格","身体"]];
        • catchanswerarray=["计划","关系","折扣","枯萎","依赖","坚强","锻炼","公道"];
      3. test the simulation notice it does not do the assignment to %textanswer% and %textcatch% on the plottingPanel texts so we need to add the assignment 
        20190422 error on iOS deployment: for catchanswerarray just use pure string, do not need to add [] on each array
        • textanswer=answerstringarray[correct]; //change 4 options
        • textcatch=catchanswerarray[correct];
      4. test the simulation again and this time notice the combo Box does change the options now
      5.  sometimes we want the simulation to start only after the user click play, to do that, go to Model - Evolution - AutoPlay check box off it  
      6. test your simulation is should not auto start anymore
      7. you may have notice the vy does not change anymore during the running of the simulation, do you know how to change it (code) and where to add the new code?
      8. yes, you could create a new custom function let call it vyspeedchange () 
      9. right click on the function where you want to add 
      10. select Open Code Wizard and select 'for' loop and click Ok
      11. write a code that reassigns new random values into the array of vy such as this 
        • function vyspeedchange () {
        •   for (var counter=0; counter<n  ; counter++) {
        •   vy[counter] = Math.max(Math.random(),0.5);
        • }
        • }
      12. to make this function run in any part of the simulation, just add vyspeedchange () , for example in Model - Evolution - Events - collisioncorrect 
      13.  test your new simulation, the vy should be reassigned new random values so that the user cannot use the speed of falling to guess the answers.
      14. Moving on the adding target speech in an array, there is a way in EJSS editor to assign a variable name to the interacted element and thus do something like speech the word for learning.
      15. let name the variable vocabaudio in the Model - Variables - Var Table as it is on the apples
      16. go to HtmlView - plottingPanel - textset2
        and add ElementInteracted as vocabaudio, EnabledPosition as "ENABLED_NO_MOVE" , Sensitivity as 0 for the whole text to be interactable and OnPress as speech(textanswer[vocabaudio]); 
      17. run the simulation and try to press on the apples text for speech
      18. beautifying
      19. on a small handphone, every inch of the screen is used for productive inquiry and game play, to remove the border or Gutters use 
        • [0,0,0,0]
      20. the simulation run will look like this
      21. go to HtmlView and remove the labelPanel by right click and remove
      22. the run simulation look like this now 

      23. to control the lines on the plottingPanel go to HtmlView - plottingPanel - Axes and set these values XFixedTick as 0 and YFixedTicK AS 0 will force the  (0,0) to be the reference point for the axes. XAutoTicks and YAutoTicks must be set to false in order for user input to work, else EJSS will allows try to autoticks. XTicks and YTicks are the numbers of ticks to draw for the plottingPanel. But XTickStep = 1 and YTickStep = 6 is better in controlling the actual spacing. so XTickStep =1 means there will be a space of 1 for every 1 unit in x direction so , x = 0, 1, 2,3,4,5 etc. YTickStep =6 means Y =0, 6, 12 etc will have a line 
      24. run the simulation 
      25. Ejss editor allows for drag and drop, drag and drop until you get executionPanel plottingPanel and audio together 


      26. run the simulation
      27. so now the simulation is compactly layout, remove the unnecessary wrappedPanel and narrativePanel
      28. so you roughly end up with this
      29. run the simulation
      30. packaging the simulation for sharing
      31. click on the top right corner
        of the EJSS editor to show the properties on information about and add in the metadata to help people find your simulation more easily

      32. add the information 
      33. to prepare the thumbnail simulation logo, do a screenshot and copy the file into the source folder for me is /Users/lookang/Google Drive/PublicLawrence/workspace/source/catchapplegametemplate
      34. use a image editor to resize the logo to 320 px width x 180px height
      35. go to the Run options and add the User files folder 
        320x180
      36. zipped model
      37. to zip the model choose this icon
        and right click to package current simulation
      38. the model will be in the export folder of the workspace. 
        https://vle.learning.moe.edu.sg/my-library/lesson/edit/8a20faf5-6a5c-4d7d-a9af-cf2dc9f87804

      39. the model can now be uploaded to SLS https://vle.learning.moe.edu.sg/login. Enjoy!
      40. the actual model is downloadable here https://iwant2study.org/ospsg/index.php/856 and the source  as well licensed https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode Attribution-NonCommercial-ShareAlike.
      41. the embed code should work in SLS by June 2019 and the code can be copied at the Digital Library 
      • <iframe width="100%" height="100%" src="https://iwant2study.org/lookangejss/chinese/ejss_model_catchapplegametemplatev01/catchapplegametemplatev01_Simulation.xhtml" frameborder="0"></iframe>


      1. check back for the rest of the exciting stuff and leave a comment and I will try to add to the tutorial ( updating on to fly)


      Email to successful 30



      Dear colleague

      Congratulations! You/your team has been selected to participate in SLS Hackathon 2019, held on 3 – 4 June from 8.30 am – 5.30 pm at INN x CSC, 9 Jurong Town Hall Road, #03-19, S(609431).
      Please take note of the following:
      1. Please attend at least one of the two pre-event training sessions on using Easy Javascript Simulations (EJSS) to create interactives for SLS lessons held on 25 April and 23 May from 2.30 – 5pm @ Level 24 Function Room, MOE HQ Buona Vista. Pls rsvp to me by 23 April to indicate which session/s you will be attending.
      2. Please go through the following online tutorials as part of your pre-Hackathon training. Hackathon teams are required to submit Tutorial 2 source code (upload the source for example ejss_src_team1_2019_v2.zip to your google drive and share the shareable link to download)  to our trainer: Lawrence_WEE@moe.gov.sg by 27 May 2019. Tutorials 1 & 3 are optional.
      · SLS Hackathon TUTORIAL 1 soccer game JavaScript HTML5 Applet Simulation Model
      · SLS Hackathon TUTORIAL 2 Catch Correct Chinese Phrase Sec 1 to 4 Game HTML5
      · SLS Hackathon TUTORIAL 3 matching card game HTML5
      · SLS Hackathon template 1 HTML5

      3. Teams are encouraged to refine their ideas in line with the SLS Hackathon 2019 Problem Statement: “How might we enhance the interactivity of an SLS lesson by developing simulations using EJSS?”
      4. Please take note that throughout the duration of the hackathon, photography and video recordings will be taken and used in various media platforms. Should you wish to opt out of inclusion in photographs/video recordings, please indicate in the attached Excel spreadsheet, together with T-shirt size and food allergies, to me by 26 April. Please also enter the name you would like to appear in your participant certificate.



      Thank you.


      Assignment by participants

      20190229 Team HQ  https://iwant2study.org/lookangejss/00workshop/2019SLSHackathon/day0/ejss_model_catchapplegametemplatev01hq1GeokLengOng/catchapplegametemplatev01_Simulation.xhtml

      No comments:

      Post a Comment