{
  "information": {
    "Title": "21CC Navigator Gem Matching Game",
    "Author": [
      "lookang",
      "Joseph Ang"
    ],
    "AuthorLogo": [
      "",
      ""
    ],
    "Password": "",
    "Keywords": "",
    "Abstract": "",
    "Copyright": "",
    "Level": "",
    "Language": "",
    "Logo": [
      "./21CCN Gem Matching Game.png"
    ],
    "RunAlways": "true",
    "ModelTab": "",
    "ModelTabTitle": "",
    "ModelName": "",
    "FixedNavigationBar": "false",
    "CSSFile": "",
    "DetectedFiles": [
      "./21CCN Gem Matching Game.png"
    ],
    "AuxiliaryFiles": [
      "./cardMatching/",
      "./Picture1.png",
      "./Picture2.png",
      "./Picture3.png",
      "./Picture4.png",
      "./Picture5.png",
      "./Picture6.png",
      "./Picture7.png",
      "./Picture8.png",
      "./Picture9.png",
      "./xapiwrapper.min.js"
    ],
    "HTMLHead": "<script src=\"xapiwrapper.min.js\"></script>\n\n <script>\n    // Using a namespace to prevent global variable clashes\n    const XAPIUtils = {\n      parameters: null, // Parameters store\n      getParameters: function () {\n        if (!this.parameters) { // Ensure fetch once\n          var urlParams = new URLSearchParams(window.location.search);\n          var endpoint = urlParams.get('endpoint');\n          var auth = urlParams.get('auth');\n          var agent = JSON.parse(urlParams.get('agent'));\n          var stateId = urlParams.get('stateId');\n          var activityId = urlParams.get('activityId');\n\n          ADL.XAPIWrapper.changeConfig({\n            \"endpoint\": endpoint + \"/\",\n            \"auth\": `Basic ${auth}`\n          });\n\n          this.parameters = {\n            agent,\n            stateId,\n            activityId\n          };\n        }\n\n        return this.parameters;\n      }\n    };\n\n    // Immediately invoke getParameters on page load\n    document.addEventListener(\"DOMContentLoaded\", function() {\n      XAPIUtils.getParameters(); // Fetch parameters once on load\n    });\n\n    function sendScore(score) {\n      try {\n        const parameters = XAPIUtils.getParameters(); // Retrieve parameters from store\n        const activityid = parameters.activityId;\n        const stateId = parameters.stateId;\n        const agent = parameters.agent;\n        const registration = null;\n\n        const stateValue = {\n          score: score\n        };\n\n        ADL.XAPIWrapper.sendState(activityid, agent, stateId, registration, stateValue);\n      } catch (err) {\n        console.error(\"An error has occurred!\", err);\n      }\n    }\n</script>\n\n<script \nasync=\"true\" src=\"https://www.googletagmanager.com/gtag/js?id=G-S9EWRY1CPJ\"></script>\n<script>\n  window.dataLayer = window.dataLayer || [];\n  function gtag(){dataLayer.push(arguments);}\n  gtag('js', new Date());\n\n  gtag('config', 'G-S9EWRY1CPJ');\n</script>",
    "SaveInXMLFormat": "false",
    "IncludeSource": "true",
    "UseIndexHtml": "false",
    "IncludeLibrary": "true",
    "UglifyJS": "false",
    "PreviewFullModel": "false",
    "UseInterpreter": "true",
    "UseDeltaForODE": "false"
  },
  "description": {
    "pages": [
      {
        "Name": "Desc Page",
        "Active": "true",
        "Internal": "false",
        "Type": "DESCRIPTION_EDITOR",
        "Locale": "_default_",
        "Title": "Desc Page",
        "External": "false",
        "Code": "<html>\n<head></head>\n<body>\n<p> </p><p style=\"margin-top: 0\">          </p><p> </p><h1>      Card Matching Game    </h1><p> </p><h2>      Introduction    </h2><p>    As part of 21CC Navigator, students are expected to be aware of the Emerging 21st Century Competencies (E21CC). This application     aims to make learning about E21CC more enjoyable and interesting for     students.    </p><h2>      What this game is    </h2><p>    This is a simple memory-match game.    </p><ul><li>        18 cards (9 Gem cards) are faced down randomly         on the play-space      </li><li>        Students click on two cards and if they match, they get a point.      </li><li>        If they don\u2019t match, the student has to try again to pick a correct         pair      </li><li>        They continue doing this until all 9 pairs are successfully matched</li></ul><p> </p>\n</body>\n</html>"
      }
    ]
  },
  "model": {
    "variables": {
      "pages": [
        {
          "Name": "EditableVariable",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "n",
              "Value": "18",
              "Type": "int",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "countdown",
              "Value": "2",
              "Type": "double",
              "Dimension": "",
              "Comment": "amount of time before game starts",
              "Domain": "public"
            },
            {
              "Name": "icon",
              "Value": "[ \"./Picture1.png\", \"./Picture2.png\", \"./Picture3.png\", \"./Picture4.png\", \"./Picture5.png\", \"./Picture6.png\", \"./Picture7.png\", \"./Picture8.png\", \"./Picture9.png\" ];",
              "Type": "String",
              "Dimension": "[n/2]",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "desc",
              "Value": "[ \"./Picture1.png\", \"./Picture2.png\", \"./Picture3.png\", \"./Picture4.png\", \"./Picture5.png\", \"./Picture6.png\", \"./Picture7.png\", \"./Picture8.png\", \"./Picture9.png\" ];",
              "Type": "String",
              "Dimension": "[n/2]",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "mode",
              "Value": "1",
              "Type": "int",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "message",
              "Value": " [ \"I am able to use evidence and adopt different perspectives to explain my reasoning and decisions.\", \"I am able to come up with ideas that may involve adjusting existing ones and explore other ways to solve a problem appropriately.\", \"I am able to understand the similarities and differences between different situations and how this might change how I think or act.\", \"I am able to talk about and understand different perspectives on important issues that affect the culture, social and economic development, governance, future and identity of Singapore.\", \"I am able to share what I know about global issues, explain their impact and talk about how Singapore plays a part in the global community to solve them.\", \"I am able to appreciate the value of different customs, beliefs, and ways of thinking of people from different cultural and religious communities, and their contributions to Singapore and the world.\", \"I am able to share and evaluate relevant information to co-create new ideas and meaning with others.\", \"I am able to manage disagreements with group members and take in other perspectives, while contributing to the completion of a task to meet the shared goals.\", \"I am able to verify the accuracy, credibility and recency of information by checking against different sources.\" ]",
              "Type": "int",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            }
          ]
        },
        {
          "Name": "Var Table",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "card_id",
              "Value": "0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "There are a total of n/2 unique card_ids: each number represents one set of logo/desc ",
              "Domain": "public"
            },
            {
              "Name": "card_type",
              "Value": "0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "there are 2 card_types: 0 is for symbol, 1 is for descriptions",
              "Domain": "public"
            },
            {
              "Name": "card_width",
              "Value": "2",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "card_height",
              "Value": "2",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "x",
              "Value": "0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "y",
              "Value": "0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "margin_x",
              "Value": "0.1",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "margin_y",
              "Value": "0.1",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "prev_id",
              "Value": "-1",
              "Type": "double",
              "Dimension": "",
              "Comment": "represents the card_id of the previous card clicked",
              "Domain": "public"
            },
            {
              "Name": "interact",
              "Value": "-1",
              "Type": "double",
              "Dimension": "",
              "Comment": "tracks which card is currently being clicked",
              "Domain": "public"
            },
            {
              "Name": "prev_interact",
              "Value": "-1",
              "Type": "double",
              "Dimension": "",
              "Comment": "tracks which card was previously being clicked",
              "Domain": "public"
            },
            {
              "Name": "back_display",
              "Value": "1",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "UNUSED",
              "Domain": "public"
            },
            {
              "Name": "score",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "game_over",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "game_start",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            }
          ]
        },
        {
          "Name": "Back Colors",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "select_color",
              "Value": "\"rgba(255,255,0,0.1)\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "correct_color",
              "Value": "\"rgba(0,255,0,0.1)\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "transparent_color",
              "Value": "\"rgba(0, 0, 0, 0)\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "opaque_color",
              "Value": "\"black\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "back_color",
              "Value": "opaque_color",
              "Type": "String",
              "Dimension": "[n]",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "String",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            }
          ]
        },
        {
          "Name": "Timings",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "t",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "dt",
              "Value": "0.05",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "time_display",
              "Value": "\"\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "card_delay",
              "Value": "-1",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "delay_interact1",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "delay_interact2",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            }
          ]
        },
        {
          "Name": "Card Icons",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "card_icon",
              "Value": "\"\"",
              "Type": "String",
              "Dimension": "[n]",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            }
          ]
        },
        {
          "Name": "lookang",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "font",
              "Value": "\"normal normal 2vw \"",
              "Type": "String",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "hint",
              "Value": "\"\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "null",
              "Domain": "public"
            }
          ]
        }
      ]
    },
    "initialization": {
      "pages": [
        {
          "Name": "Init Page",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "// initialising img_url\n// put in variables to allow editing on https://ejss-browser-editor.herokuapp.com/\n// teachers need to replace their own Picture1.png Picture2.png with their own pictures\n// lookang\n/*\nicon = [\n\"./cardMatching/Picture1.png\",\n\"./cardMatching/Picture2.png\",\n\"./cardMatching/Picture3.png\",\n\"./cardMatching/Picture4.png\",\n\"./cardMatching/Picture5.png\",\n\"./cardMatching/Picture6.png\",\n\"./cardMatching/Picture7.png\",\n\"./cardMatching/Picture8.png\",\n\"./cardMatching/Picture9.png\"\n];\n\ndesc = [\n\"./cardMatching/Picture1.png\",\n\"./cardMatching/Picture2.png\",\n\"./cardMatching/Picture3.png\",\n\"./cardMatching/Picture4.png\",\n\"./cardMatching/Picture5.png\",\n\"./cardMatching/Picture6.png\",\n\"./cardMatching/Picture7.png\",\n\"./cardMatching/Picture8.png\",\n\"./cardMatching/Picture9.png\"\n];\n\n*/\n// initialising x and y position\nfor(var i = 0; i < n; i++){\n  x[i] = card_width * (i % 6);\n  if(i % 6)\n    x[i] += margin_x * (i % 6);// margin_x=0.3 spacing between cards\n    \n  y[i] = card_height * Math.floor(i / 6);\n  if(Math.floor(i / 6))\n    y[i] += margin_y * Math.floor(i / 6);\n}\n//console.log(x, y);\n\n// randomise cards\nrandomisePos();\n\n\n"
        },
        {
          "Name": "message",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "if (_isMobile){\n  //do nothing\n  }\n  \n  else{\n    // copy this into the initialization\n// make the font bigger\n\n_view.cardDisplay.getMessageDecoration(\"TL\").getFont().setFontSize(\"1vw\");\n_view.cardDisplay.getMessageDecoration(\"TR\").getFont().setFontSize(\"1vw\");\n_view.cardDisplay.getMessageDecoration(\"BL\").getFont().setFontSize(\"1vw\");\n_view.cardDisplay.getMessageDecoration(\"BR\").getFont().setFontSize(\"1vw\");\n    }"
        },
        {
          "Name": "debug",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "// copy paste into TL message to see the values\n//\"back_color=\"+back_color+\"\\ninteract=\"+interact+\"\\nprev_interact=\"+prev_interact+\"mode=\"+mode\n\n"
        }
      ]
    },
    "evolution": {
      "information": {
        "FPS": "20",
        "SPD": "1",
        "RealTimeVariable": "",
        "Autoplay": "true"
      },
      "pages": [
        {
          "Name": "Evol Page",
          "Active": "true",
          "Internal": "false",
          "Type": "EVOLUTION_EDITOR",
          "Comment": "",
          "Code": "if(game_start && !game_over)\n  t += dt;\n\nif(card_delay != -1 && t - card_delay >= 1){\n  // _tools.showOkDialog(\"Card doesn't match!\");\n  hint= \"Card doesn't match!\"; // lookang change to hint to ease clicking fast\n  _view.audio2.play() // play wrongsound\n  \n  // change the colors of the cards back based on the game mode\n  if(mode == 1){\n    back_color[delay_interact1] = transparent_color;\n    back_color[delay_interact2] = transparent_color;\n  }\n  else if(mode == 2){ // memory game\n    back_color[delay_interact1] = opaque_color;\n    back_color[delay_interact2] = opaque_color;\n  }\n  // deactiate card_delay\n  card_delay = -1;\n}\n"
        }
      ]
    },
    "fixed_relations": {
      "pages": [
        {
          "Name": "FixRel Page",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "if(game_over == true || game_start == false)\n  return; // do ntg\n  \nvar cur_time = t;\nvar min = Math.floor(cur_time / 60), sec = Math.floor(cur_time % 60);\nif(min < 10)\n  min = \"0\" + min;\nif(sec < 10)\n  sec = \"0\" + sec;\n  // dont control css style here\n//time_display = `<h2 style='text-align: center'>Timer: ${min}:${sec}</h2>`;\ntime_display = \"\u231bTimer: \"+min+\":\"+sec;\n"
        }
      ]
    },
    "custom": {
      "pages": [
        {
          "Name": "randomisePos",
          "Active": "true",
          "Internal": "false",
          "Type": "LIBRARY_EDITOR",
          "Comment": "",
          "Code": "function randomisePos() {\n  // card_type : 0 is symbol, 1 is description\n  // card_id : 0 to 8, each number represents one set of symbol / description\n  var id_arr = [];\n  for(var i = 0; i < n; i++){\n    // creates an array that looks like [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1] ...]\n    id_arr.push([Math.floor(i / 2), i % 2]);\n  }\n  for(var i = 0; i < n; i++){\n    // randomly get an idx\n    var idx = Math.floor(Math.random() * id_arr.length);\n    \n    // assign the id and the type\n    card_id[i] = id_arr[idx][0];\n    card_type[i] = id_arr[idx][1];\n    \n    // change the image based on the card type\n    if(card_type[i] == 0){\n      card_icon[i] = icon[card_id[i]];\n    }\n    else{\n      card_icon[i] = desc[card_id[i]];\n    }\n    // remove the element from the array to prevent repetition\n    id_arr.splice(idx, 1);\n  }\n\n}"
        }
      ]
    },
    "elements": {
      "list": []
    }
  },
  "view": {
    "Tree": [
      {
        "Name": "topPanel",
        "Type": "Panel",
        "Expanded": "true",
        "Properties": [
          {
            "name": "Font",
            "value": "%font%"
          },
          {
            "name": "Display",
            "value": "\"inline-block\""
          }
        ],
        "Children": [
          {
            "Name": "title",
            "Type": "Label",
            "Properties": [
              {
                "name": "Background",
                "value": "\"Cyan\""
              },
              {
                "name": "Text",
                "value": "\"<h1>21CCN Gem Matching Game</h1>\""
              },
              {
                "name": "Display",
                "value": "\"none\""
              }
            ]
          },
          {
            "Name": "modeLabel",
            "Type": "Label",
            "Properties": [
              {
                "name": "Background",
                "value": "\"Orange\""
              },
              {
                "name": "Text",
                "value": "\"Mode:\""
              },
              {
                "name": "Font",
                "value": "font"
              }
            ]
          },
          {
            "Name": "modeSelect",
            "Type": "ComboBox",
            "Properties": [
              {
                "name": "Options",
                "value": "[\"1\",\"2\"]"
              },
              {
                "name": "Background",
                "value": "\"Orange\""
              },
              {
                "name": "OnChange",
                "value": "var opts = _view.modeSelect.getProperty(\"SelectedOptions\");  // array of options\nvar option = (opts.length > 0)? opts[0]:\"\"; // selected option \nmode = option\n// changing the color based on the different mode\n//[\"training\", \"memory game\"]\n//change from 1 and 2 for ease of reading\nfor(var i = 0; i < n; i++){\n  if(mode == 1||mode ==\"training\"){ // added 2 ways to reach this if statement\n \n    back_color[i] = opaque_color;  \n  // back_color[i] = transparent_color // set to transparent to see cards turn black after start button is clicked\n  }\n  else if(mode == 2||mode == \"memory game\"){\n    back_color[i] = transparent_color;\n  }\n}\n\n// randomise the cards to prevent cheating\nrandomisePos();\n"
              },
              {
                "name": "Disabled",
                "value": "game_start"
              },
              {
                "name": "Font",
                "value": "font"
              }
            ]
          },
          {
            "Name": "timeDisplay",
            "Type": "Label",
            "Properties": [
              {
                "name": "Background",
                "value": "\"Magenta\""
              },
              {
                "name": "Text",
                "value": "time_display"
              },
              {
                "name": "Display",
                "value": "game_start?\"inline-block\":\"none\""
              }
            ]
          },
          {
            "Name": "startBtn",
            "Type": "Button",
            "Properties": [
              {
                "name": "Text",
                "value": "\"Start!\""
              },
              {
                "name": "Width",
                "value": "\"30vw\""
              },
              {
                "name": "OnClick",
                "value": "game_over = 0;\ngame_start = 1;\n\nfor(var i = 0; i < n; i++){\n  console.log(back_color[i]);\n  if(mode == 1) // assume memory game?\n    back_color[i] = transparent_color;\n   // back_color[i] = opaque_color; //lookang\n  else if(mode == 2) // assume training?\n    back_color[i] = opaque_color;\n  //  back_color[i] = transparent_color; //lookang\n}\nvar msg=\"Start!\"\nhint= msg\n"
              },
              {
                "name": "Display",
                "value": "\"\" + `${game_start ? \"none\" : \"inline_block\"}`"
              }
            ]
          },
          {
            "Name": "resetButton3",
            "Type": "Button",
            "Properties": [
              {
                "name": "Text",
                "value": "\"\u21bbReset\""
              },
              {
                "name": "Width",
                "value": "\"10vw\""
              },
              {
                "name": "OnClick",
                "value": "_reset();\n//speechzh (\"\u4f60\u597d\");\n"
              },
              {
                "name": "Font",
                "value": "\"normal normal 2vw \""
              },
              {
                "name": "Display",
                "value": "\"inline-block\""
              }
            ]
          },
          {
            "Name": "scoreDisplay",
            "Type": "Label",
            "Properties": [
              {
                "name": "Background",
                "value": "\"Yellow\""
              },
              {
                "name": "Text",
                "value": "\"\"+ `<h2>Score: ${score}</h2>`"
              },
              {
                "name": "Width",
                "value": "\"20vw\""
              },
              {
                "name": "Display",
                "value": "\"none\""
              }
            ]
          },
          {
            "Name": "audio",
            "Type": "Audio",
            "Properties": [
              {
                "name": "AudioUrl",
                "value": "\"./cardMatching/Ding Sound Effect.m4a\""
              }
            ]
          },
          {
            "Name": "audio2",
            "Type": "Audio",
            "Properties": [
              {
                "name": "AudioUrl",
                "value": "\"./cardMatching/Wrong-answer-sound-effect.mp3\""
              }
            ]
          },
          {
            "Name": "audio3",
            "Type": "Audio",
            "Properties": [
              {
                "name": "AudioUrl",
                "value": "\"./cardMatching/applause2.mp3\""
              }
            ]
          }
        ]
      },
      {
        "Name": "mainPanel",
        "Type": "Panel",
        "Expanded": "true",
        "Properties": [],
        "Children": [
          {
            "Name": "cardDisplay",
            "Type": "DrawingPanel",
            "Expanded": "true",
            "Properties": [
              {
                "name": "Background",
                "value": "\"LightGray\""
              },
              {
                "name": "Enabled",
                "value": "game_start?true:false"
              },
              {
                "name": "MaximumY",
                "value": "card_height * 3 + margin_y * 2"
              },
              {
                "name": "MaximumX",
                "value": "card_width * 6 + margin_x * 5"
              },
              {
                "name": "TRMessage",
                "value": "\"Gem Matching Game \"+score+\" / \"+n/2"
              },
              {
                "name": "MinimumX",
                "value": "0"
              },
              {
                "name": "MinimumY",
                "value": "0"
              },
              {
                "name": "AutoScaleY",
                "value": "false"
              },
              {
                "name": "AutoScaleX",
                "value": "false"
              },
              {
                "name": "MarginX",
                "value": "5"
              },
              {
                "name": "MarginY",
                "value": "15"
              },
              {
                "name": "CursorTypeForMove",
                "value": "\"pointer\""
              },
              {
                "name": "Height",
                "value": "\"90vh\""
              },
              {
                "name": "LineWidth",
                "value": "0"
              },
              {
                "name": "Width",
                "value": "\"70%\""
              },
              {
                "name": "TLMessage",
                "value": "\"hint=\"+hint"
              }
            ],
            "Children": [
              {
                "Name": "actual_answers_back_display_removed",
                "Type": "Group2D",
                "Expanded": "true",
                "Properties": [],
                "Children": [
                  {
                    "Name": "cardIcon",
                    "Type": "ImageSet2D",
                    "Properties": [
                      {
                        "name": "NumberOfElements",
                        "value": "n"
                      },
                      {
                        "name": "Sensitivity",
                        "value": "0"
                      },
                      {
                        "name": "SizeX",
                        "value": "card_width"
                      },
                      {
                        "name": "RelativePosition",
                        "value": "\"SOUTH_WEST\""
                      },
                      {
                        "name": "X",
                        "value": "x"
                      },
                      {
                        "name": "Y",
                        "value": "y"
                      },
                      {
                        "name": "ImageUrl",
                        "value": "%card_icon%"
                      },
                      {
                        "name": "SizeY",
                        "value": "card_height"
                      }
                    ]
                  }
                ]
              },
              {
                "Name": "backof_cards",
                "Type": "Group2D",
                "Expanded": "true",
                "Properties": [],
                "Children": [
                  {
                    "Name": "cardSet",
                    "Type": "ShapeSet2D",
                    "Properties": [
                      {
                        "name": "FillColor",
                        "value": "%back_color%"
                      },
                      {
                        "name": "RelativePosition",
                        "value": "\"SOUTH_WEST\""
                      },
                      {
                        "name": "ShapeType",
                        "value": "\"ROUND_RECTANGLE\""
                      },
                      {
                        "name": "ElementInteracted",
                        "value": "interact"
                      },
                      {
                        "name": "NumberOfElements",
                        "value": "n"
                      },
                      {
                        "name": "Sensitivity",
                        "value": "0"
                      },
                      {
                        "name": "SizeX",
                        "value": "card_width"
                      },
                      {
                        "name": "X",
                        "value": "x"
                      },
                      {
                        "name": "Y",
                        "value": "y"
                      },
                      {
                        "name": "OnPress",
                        "value": "// if card_delay is activated, don't run the rest of the code\nif(card_delay != -1)\n  return;\n\n// if mode 1, if color is not transparent, don't run the rest of the code\nif(mode == 1 && back_color[interact] != transparent_color)\n  return;\n// if mode 2, if color is not opaque, don't run the rest of the code\nif(mode == 2 && back_color[interact] != opaque_color)\n  return;\n\n// turn colour to yellow\nback_color[interact] = select_color;\n\n// if the current card is the first card\nif(prev_id == -1) {\n  prev_id = card_id[interact];\n  prev_interact = interact;\n  return;\n}\n\n// if the current card is the second card\nelse{\n  var cur_id = card_id[interact];\n\n  // check if the 2 cards matches\n  if(prev_id == cur_id) {\n    score++;\nsendScore(score); // xAPI \n    back_color[interact] = correct_color;\n    back_color[prev_interact] = correct_color;\n    // message\n     _tools.showOkDialog(\"Gem matches! <br>\" + message[card_id[interact]]);\n\n    // check for end of the game\n    if(score == n / 2) {\n      game_over = true;\n      var msg = \"Game completed!\" //lookang\n      _view.audio3.play() // play sound\n      _tools.showOkDialog(msg);\n      hint=msg;\n    }\n  \n    // if game has not ended yet\n    else {\n      //  _tools.showOkDialog(\"Gem matches!\");\n      hint=\"Gem matches!\";\n      _view.audio.play() // play sound\n    }\n  }\n\n  else {\n    card_delay = t;\n    // remember which pair of cards (necessary to prevent bugs)\n    delay_interact1 = interact;\n    delay_interact2 = prev_interact;\n  }\n  // preparing to select a new pair of cards\n  prev_id = -1;\n}"
                      },
                      {
                        "name": "SizeY",
                        "value": "card_height"
                      },
                      {
                        "name": "LineWidth",
                        "value": "0"
                      },
                      {
                        "name": "EnabledPosition",
                        "value": "\"ENABLED_NO_MOVE\""
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "Name": "instructionPanel",
        "Type": "Panel",
        "Properties": [
          {
            "name": "Html",
            "value": "<h1 style=\"font-size: 2em !important; padding-left: 0;\">21CCN Gem Matching Game</h1>\n<h2>Instructions</h2>\n<p>As part of the 21CC Navigator, students are expected to be aware of Emerging 21st Century Competencies (E21CC). This application \naims to make learning about E21CC more enjoyable and interesting for \nstudents.\n<br /><br />\nThis is a simple memory-match game.\n<br />\n<ul style=\"text-align: left;\">\n  <li>\n    18 cards (9 Gem cards) are faced down randomly \n    on the play-space\n  </li>\n  <li>\n    Students click on two cards and if they match, they get a point.\n  </li>\n  <li>\n    If they don\u2019t match, the student has to try again to pick\n    a correct pair\n  </li>\n  <li>\n    They continue doing this until all 9 pairs are successfully match\n  </li>\n</ul>\nThere are also <b>2 different modes</b> students can choose from:\n<ul style=\"text-align: left:\">\n  <li> \n    The first is the easy mode, where the cards are <b>covered initially</b>, \n    but when the game starts, the cards are shown throughout the duration of \n    the game\n  </li>\n  <li>\n    The second is the hard mode, where the cards are <b>shown initially</b>, but \n    when the game starts, the cards are covered throughout the duration the game \n  </li>\n</ul>\nNote that you are <b>not allowed</b> to change the mode during the game.\n</p>"
          }
        ]
      }
    ],
    "RootProperties": []
  },
  "metadata": {
    "APP": "WebEJS",
    "CreatedWith": "WebEJS : The web version of Easy JavaScript Simulations",
    "MoreInfo": "WebEJS 1.1",
    "version": "https://www.um.es/fem/wikis/webejs/"
  }
}