{
  "information": {
    "Title": "Letsavoidseapollution",
    "Author": [
      "Ai Hua/ MOE/ Social Studies Primary Unit"
    ],
    "AuthorLogo": [
      ""
    ],
    "Password": "unused",
    "Keywords": "",
    "Abstract": "",
    "Copyright": "",
    "Level": "",
    "Language": "",
    "Logo": [
      "./logo.png"
    ],
    "RunAlways": "true",
    "ModelTab": "",
    "ModelTabTitle": "",
    "ModelName": "",
    "FixedNavigationBar": "false",
    "CSSFile": "",
    "DetectedFiles": [
      "./logo.png"
    ],
    "AuxiliaryFiles": [
      "./logo.png",
      "./fish.png"
    ],
    "HTMLHead": "",
    "SaveInXMLFormat": "false",
    "IncludeSource": "true",
    "UseIndexHtml": "false",
    "IncludeLibrary": "true",
    "UglifyJS": "false",
    "PreviewFullModel": "false",
    "UseInterpreter": "true",
    "UseDeltaForODE": "false"
  },
  "description": {
    "pages": [
      {
        "Name": "Wind Direction and Speed of Ship",
        "Active": "true",
        "Internal": "false",
        "Type": "DESCRIPTION_EDITOR",
        "Locale": "_default_",
        "Title": "Let's avoid sea pollution!",
        "External": "false",
        "Code": "<html>\n<head></head>\n<body>\n<h1>Let's Avoid Sea Pollution!</h1><p><span style=\"font-weight: var(--bs-body-font-weight); text-align: var(--bs-body-text-align);\">The main goal of this game is to educate users about the importance of avoiding pollution in the ocean. By maneuvering the fish without touching the pollutants, users can learn about the challenges marine life faces due to pollution.</span><br></p><h1>Game Elements</h1><ol><li><strong>Fish</strong>: The fish is positioned on the left side of the screen and can be dragged by the user.&nbsp;</li><li><strong>Coral Reef</strong>: Located on the right side of the screen, it serves as the target destination for the fish.</li><li><strong>Pollutants</strong>: Several types of pollutants are present in the water, including:<ul><li>a fish net</li><li>a plastic bottle&nbsp;</li><li>a plastic bag&nbsp;<br></li></ul></li><li><strong>Turtle &amp; octopus</strong>: These animals co-exist in the marine environment.</li></ol><h1>How to play the game</h1><ol><li>A dialog box in the center of the screen provides instructions: \"Drag the fish to reach the coral reef on the right without colliding into any floating pollutants.\" Click \"Ok\" button to start the game.<br></li><li>Drag the fish to avoid collision with the pollutants and marine life in order to reach the coral reef located on the right of the screen.<br></li></ol><p><br></p><p><span style=\"font-weight: var(--bs-body-font-weight); text-align: var(--bs-body-text-align);\"><br></span></p>\n</body>\n</html>"
      }
    ]
  },
  "model": {
    "variables": {
      "pages": [
        {
          "Name": "Var Table 1",
          "Active": "true",
          "Internal": "false",
          "Type": "undefined",
          "PageComment": "",
          "Variables": [
            {
              "Name": "maxSpeed",
              "Value": "10",
              "Type": "double",
              "Dimension": "",
              "Comment": "The ship's maximum speed in optimal conditions.",
              "Domain": ""
            },
            {
              "Name": "distance",
              "Value": "1000",
              "Type": "double",
              "Dimension": "",
              "Comment": "The total distance the ship needs to travel.",
              "Domain": ""
            },
            {
              "Name": "windDirection",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "The direction of the wind relative to the ship's heading.",
              "Domain": ""
            },
            {
              "Name": "shipPositionX",
              "Value": "-4.0",
              "Type": "double",
              "Dimension": "",
              "Comment": "The current position of the ship along its path.",
              "Domain": ""
            },
            {
              "Name": "shipPositionY",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "time",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "The elapsed time since the start of the simulation",
              "Domain": ""
            },
            {
              "Name": "effectiveSpeed",
              "Value": "3",
              "Type": "double",
              "Dimension": "",
              "Comment": "The actual speed of the ship, which will vary based on wind direction.",
              "Domain": ""
            },
            {
              "Name": "eta",
              "Value": "5",
              "Type": "double",
              "Dimension": "",
              "Comment": "Estimated time of arrival, initially set assuming maximum speed",
              "Domain": ""
            },
            {
              "Name": "t",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "dt",
              "Value": "0.05",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "windSpeedX",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "windSpeedY",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "shipSpeedX",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "shipSpeedY",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "shipRadius",
              "Value": "1",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "coralReefX",
              "Value": "4.8",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "coralReefY",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            }
          ]
        },
        {
          "Name": "Var Table 2",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "shipPositionXnew",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "shipPositionYnew",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "tnew",
              "Value": "t",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            }
          ]
        },
        {
          "Name": "Var Table 3",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "objectX",
              "Value": "3",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "objectY",
              "Value": "4",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "objectSizeX",
              "Value": "1",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "objectSizeY",
              "Value": "1.2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "objectVY",
              "Value": "-1",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "reefX",
              "Value": "5",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "reefY",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "bottleX",
              "Value": "0.8",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "bottleY",
              "Value": "-2.5",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "bottleSizeX",
              "Value": "0.8",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "bottleSizeY",
              "Value": "1",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "bottleVY",
              "Value": "-0.5",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "netX",
              "Value": "-2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "netY",
              "Value": "4.5",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "netVY",
              "Value": "0.5",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "netSizeX",
              "Value": "1.2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "netSizeY",
              "Value": "1",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "turtleX",
              "Value": "-0.5",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "turtleY",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "turtleVY",
              "Value": "-0.02",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "turtleSizeX",
              "Value": "1.2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "turtleSizeY",
              "Value": "1.2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "octX",
              "Value": "-2.8",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "octY",
              "Value": "-2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "octVY",
              "Value": "0.5",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "octSizeX",
              "Value": "1.2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "octSizeY",
              "Value": "1.2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": ""
            }
          ]
        }
      ]
    },
    "initialization": {
      "pages": [
        {
          "Name": "Init Page 1",
          "Active": "true",
          "Internal": "false",
          "Type": "undefined",
          "Comment": "",
          "Code": "// Init Page 1\n_tools.showOkDialog(\"<b> Drag the fish to reach the coral reef on the right without colliding into any floating pollutants or marine animals.<br/> </b>\");"
        }
      ]
    },
    "evolution": {
      "information": {
        "FPS": "20",
        "SPD": "1",
        "RealTimeVariable": "",
        "Autoplay": "true"
      },
      "pages": [
        {
          "Name": "Evol Page 1",
          "Active": "false",
          "Internal": "false",
          "Type": "EVOLUTION_EDITOR",
          "Comment": "",
          "Code": "// Evol Page 1\n// Update effective speed based on wind direction\neffectiveSpeed = maxSpeed * (1 + Math.cos(Math.toRadians(windDirection))) / 2;\n\n// Update ship position\nshipPosition += effectiveSpeed * _dt;\n\n// Update elapsed time\ntime += _dt;\n\n// Update estimated time of arrival (ETA)\neta = time + (distance - shipPosition) / effectiveSpeed;\n\n// Check if ship has reached the destination\nif (shipPosition >= distance) {\n  _pause();\n}"
        },
        {
          "Name": "Evol Page 2",
          "Active": "true",
          "Internal": "false",
          "Type": "ODE_EDITOR",
          "Comment": "",
          "IndependentVariable": "t",
          "Increment": "dt",
          "Equations": [
            {
              "state": "shipPositionX",
              "rate": "shipSpeedX"
            },
            {
              "state": "shipPositionY",
              "rate": "shipSpeedY"
            },
            {
              "state": "objectX",
              "rate": "(Math.random()-0.5)"
            },
            {
              "state": "objectY",
              "rate": "(Math.random()-0.5)+objectVY"
            },
            {
              "state": "",
              "rate": ""
            },
            {
              "state": "bottleX",
              "rate": "(Math.random()-0.5)"
            },
            {
              "state": "bottleY",
              "rate": "(Math.random()-0.5)+bottleVY"
            },
            {
              "state": "",
              "rate": ""
            },
            {
              "state": "netX",
              "rate": "(Math.random()-0.5)"
            },
            {
              "state": "netY",
              "rate": "(Math.random()-0.5)+netVY"
            },
            {
              "state": "",
              "rate": ""
            },
            {
              "state": "octX",
              "rate": "(Math.random()-0.5)"
            },
            {
              "state": "octY",
              "rate": "(Math.random()-0.5)+octVY"
            },
            {
              "state": "",
              "rate": ""
            }
          ],
          "Method": "RungeKutta",
          "AbsoluteTolerance": "",
          "PreliminaryCode": {
            "Code": "// Preliminary code for ODE : Evol Page 2",
            "Comment": ""
          },
          "EventMaximumStep": "",
          "Events": {
            "pages": [
              {
                "Name": "Event 1",
                "Active": "true",
                "Internal": "false",
                "Type": "undefined",
                "Action": "// Action for Event 1",
                "Comment": "",
                "EventType": "CROSSING_EVENT",
                "Iterations": "100",
                "Method": "BISECTION",
                "StopAtEvent": "true",
                "Tolerance": "1.0e-5",
                "ZeroCondition": "return 1.0; // Condition for Event 1"
              }
            ]
          },
          "ZenoEffect": {
            "Code": "",
            "Comment": "",
            "StopAfterEffect": "true"
          },
          "AccelerationIndependentOfVelocity": "false",
          "ForceSynchronization": "false",
          "UseBestInterpolation": "false",
          "EstimateFirstStep": "false",
          "MemoryLength": "",
          "InternalStep": "",
          "MaximumStep": "",
          "MaximumNumberOfSteps": "10000",
          "RelativeTolerance": "",
          "Tolerance": "",
          "DelayList": "",
          "DelayMaximum": "",
          "DelayAddDiscont": "",
          "DelayInitialCondition": {
            "Comment": "",
            "Code": ""
          },
          "DirectIncidenceMatrix": "",
          "Discontinuities": {
            "pages": []
          },
          "ErrorHandling": {
            "pages": []
          }
        }
      ]
    },
    "fixed_relations": {
      "pages": [
        {
          "Name": "FixRel Page 1",
          "Active": "false",
          "Internal": "false",
          "Type": "undefined",
          "Comment": "",
          "Code": "// FixRel Page 1\ncheckCollision = ( shipPositionX,shipPositionY,objectX,objectX,objectSizeX,objectSizeY) ;"
        },
        {
          "Name": "plastic collision",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "// FixRel Page 2\n// Prevent overlap of the ship and object (i.e. plastic bag)\nvar dx = shipPositionX - objectX;\nvar dy = shipPositionY - objectY;\nvar distance = Math.sqrt(dx * dx + dy * dy);\nvar tol = 0.4;\nvar tol2 = tol * 1.0001;\n\nvar objectRadius = objectSizeX\nif (distance < shipRadius * tol + objectSizeX * tol) {\n     _pause()\n    alert(\"Game Over!\")\n  //  var angle = Math.atan2(dy, dx);\n   // console.log(angle);\n   // var targetX = objectX + Math.cos(angle) * (shipRadius + objectRadius) * tol2;\n   // var targetY = objectY + Math.sin(angle) * (shipRadius + objectRadius) * tol2;\n   // shipPositionX = targetX;\n   // shipPositionY = targetY;\n   \n   \n}\n"
        },
        {
          "Name": "bottle collision",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "// FixRel Page 5\n// FixRel Page 2\n// Prevent overlap of the ship and bottle\nvar dx = shipPositionX - bottleX;\nvar dy = shipPositionY - bottleY;\nvar distance = Math.sqrt(dx * dx + dy * dy);\nvar tol = 0.35;\nvar tol2 = tol * 1.0001;\n\nvar objectRadius = bottleSizeX\nif (distance < shipRadius * tol + bottleSizeX * tol) {\n     _pause()\n    alert(\"Game Over!\")\n  //  var angle = Math.atan2(dy, dx);\n   // console.log(angle);\n   // var targetX = objectX + Math.cos(angle) * (shipRadius + objectRadius) * tol2;\n   // var targetY = objectY + Math.sin(angle) * (shipRadius + objectRadius) * tol2;\n   // shipPositionX = targetX;\n   // shipPositionY = targetY;\n   \n   \n   \n}\n"
        },
        {
          "Name": "net collision",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "// net collision\n// Prevent overlap of the ship and net\nvar dx = shipPositionX - netX;\nvar dy = shipPositionY - netY;\nvar distance = Math.sqrt(dx * dx + dy * dy);\nvar tol = 0.35;\nvar tol2 = tol * 1.0001;\n\nvar objectRadius = netSizeX\nif (distance < shipRadius * tol + netSizeX * tol) {\n     _pause()\n    alert(\"Game Over!\")\n  //  var angle = Math.atan2(dy, dx);\n   // console.log(angle);\n   // var targetX = objectX + Math.cos(angle) * (shipRadius + objectRadius) * tol2;\n   // var targetY = objectY + Math.sin(angle) * (shipRadius + objectRadius) * tol2;\n   // shipPositionX = targetX;\n   // shipPositionY = targetY;\n   \n   \n}\n"
        },
        {
          "Name": "turtle collision",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "// turtle collision\n// Prevent overlap of the ship and turtle\nvar dx = shipPositionX - turtleX;\nvar dy = shipPositionY - turtleY;\nvar distance = Math.sqrt(dx * dx + dy * dy);\nvar tol = 0.35;\nvar tol2 = tol * 1.0001;\n\nvar objectRadius = turtleSizeX\nif (distance < shipRadius * tol + turtleSizeX * tol) {\n     _pause()\n    alert(\"Game Over!\")\n  //  var angle = Math.atan2(dy, dx);\n   // console.log(angle);\n   // var targetX = objectX + Math.cos(angle) * (shipRadius + objectRadius) * tol2;\n   // var targetY = objectY + Math.sin(angle) * (shipRadius + objectRadius) * tol2;\n   // shipPositionX = targetX;\n   // shipPositionY = targetY;\n   \n   \n}"
        },
        {
          "Name": "octopus collision",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "// octopus collision\n// Prevent overlap of the ship and octopus\nvar dx = shipPositionX - octX;\nvar dy = shipPositionY - octY;\nvar distance = Math.sqrt(dx * dx + dy * dy);\nvar tol = 0.35;\nvar tol2 = tol * 1.0001;\n\nvar objectRadius = octSizeX\nif (distance < shipRadius * tol + octSizeX * tol) {\n     _pause()\n    alert(\"Game Over!\")\n  //  var angle = Math.atan2(dy, dx);\n   // console.log(angle);\n   // var targetX = objectX + Math.cos(angle) * (shipRadius + objectRadius) * tol2;\n   // var targetY = objectY + Math.sin(angle) * (shipRadius + objectRadius) * tol2;\n   // shipPositionX = targetX;\n   // shipPositionY = targetY;\n   \n   \n}"
        },
        {
          "Name": "winning",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "// winning when ship reaches reef\n// FixRel Page 2\n\nvar dx = shipPositionX - reefX;\nvar dy = shipPositionY - reefY;\nvar distance = Math.sqrt(dx * dx + dy * dy);\nvar tol = 0.85;\nvar tol2 = tol * 1.0001;\n\nvar reefRadius = objectSizeX\nif (distance < shipRadius * tol + objectSizeX * tol) {\n     _pause()\n    alert(\"You win!\")\n  //  var angle = Math.atan2(dy, dx);\n   // console.log(angle);\n   // var targetX = reefX + Math.cos(angle) * (shipRadius + reefRadius) * tol2;\n   // var targetY = reefY + Math.sin(angle) * (shipRadius + reefRadius) * tol2;\n   // shipPositionX = targetX;\n   // shipPositionY = targetY;\n   \n}\n"
        },
        {
          "Name": "floating effect",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "// Boundary limits\r\nvar minX = -5;\r\nvar maxX = 5;\r\nvar minY = -5;\r\nvar maxY = 5;\r\n\r\n// Example position and velocity\r\n\r\n\r\n// Ensure objectX is within the horizontal boundaries\r\nif (objectX < minX) objectX = minX;\r\nif (objectX > maxX) objectX = maxX;\r\n\r\n// Ensure objectY is within the vertical boundaries\r\nif (objectY < minY) {\r\n  //  objectY = minY;\r\n    objectVY = 5; // Adjust the velocity if the object hits the lower boundary\r\n}\r\nif (objectY > maxY) {\r\n    //objectY = maxY;\r\n    objectVY = -5; // Adjust the velocity if the object hits the upper boundary\r\n}\r\n\r\n//console.log(`Confined Position: x=${objectX}, y=${objectY}`);\r\n//console.log(`Velocity Y: ${objectVY}`);\r\n\r\n// Ensure bottleX is within the horizontal boundaries\r\nif (bottleX < minX) bottleX = minX;\r\nif (bottleX > maxX) bottleX = maxX;\r\n\r\n// Ensure bottleY is within the vertical boundaries\r\nif (bottleY < minY) {\r\n  //  objectY = minY;\r\n    bottleVY = 5; // Adjust the velocity if the bottle hits the lower boundary\r\n}\r\nif (bottleY > maxY) {\r\n    //objectY = maxY;\r\n    bottleVY = -5; // Adjust the velocity if the bottle hits the upper boundary\r\n}\r\n\r\n//console.log(`Confined Position: x=${objectX}, y=${objectY}`);\r\n//console.log(`Velocity Y: ${objectVY}`);\r\n\r\n// Ensure netX is within the horizontal boundaries\r\nif (netX < minX) netX = minX;\r\nif (netX > maxX) netX = maxX;\r\n\r\n// Ensure netY is within the vertical boundaries\r\nif (netY < minY) {\r\n  //  objectY = minY;\r\n    netVY = 5; // Adjust the velocity if the net hits the lower boundary\r\n}\r\nif (netY > maxY) {\r\n    //netY = maxY;\r\n    netVY = -5; // Adjust the velocity if the net hits the upper boundary\r\n}\r\n\r\n\r\n//console.log(`Confined Position: x=${objectX}, y=${objectY}`);\r\n//console.log(`Velocity Y: ${objectVY}`);\r\n\r\n// Ensure octX is within the horizontal boundaries\r\nif (octX < minX) octX = minX;\r\nif (octX > maxX) octX = maxX;\r\n\r\n// Ensure octY is within the vertical boundaries\r\nif (octY < minY) {\r\n  //  octY = minY;\r\n    octVY = 5; // Adjust the velocity if the octopus hits the lower boundary\r\n}\r\nif (octY > maxY) {\r\n    //octY = maxY;\r\n    octVY = -5; // Adjust the velocity if the oct hits the upper boundary\r\n}\r\n\r\n//console.log(`Confined Position: x=${objectX}, y=${objectY}`);\r\n//console.log(`Velocity Y: ${objectVY}`);"
        }
      ]
    },
    "custom": {
      "pages": [
        {
          "Name": "Custom Page 1",
          "Active": "false",
          "Internal": "false",
          "Type": "undefined",
          "Comment": "",
          "Code": "// Custom Page 1\nfunction checkCollision  (x1, y1, x2, y2, w2, h2)  {\n   const point = document.getElementById('image2DFish');\n   const w1 = point.offsetWidth;\n    const h1 = point.offsetHeight;\n    return !(x1 + w1 / 2 < x2 || x1 - w1 / 2 > x2 + w2 || y1 + h1 / 2 < y2 || y1 - h1 / 2 > y2 + h2);\n}\n"
        }
      ]
    },
    "elements": {
      "list": []
    }
  },
  "view": {
    "Tree": [
      {
        "Name": "panel",
        "Type": "Panel",
        "Expanded": "true",
        "Properties": [
          {
            "name": "Background",
            "value": "\"Cyan\""
          }
        ],
        "Children": [
          {
            "Name": "controlPanel",
            "Type": "Panel",
            "Expanded": "true",
            "Properties": [
              {
                "name": "CSS",
                "value": "{\"display\":\"block\"}"
              },
              {
                "name": "BorderStyle",
                "value": "\"solid\""
              },
              {
                "name": "BorderColor",
                "value": "\"Gray\""
              },
              {
                "name": "BorderWidth",
                "value": "1"
              },
              {
                "name": "Width",
                "value": "398"
              }
            ],
            "Children": [
              {
                "Name": "firstRowPanel",
                "Type": "Panel",
                "Expanded": "true",
                "Properties": [],
                "Children": [
                  {
                    "Name": "executionPanel",
                    "Type": "Panel",
                    "Expanded": "true",
                    "Properties": [],
                    "Children": [
                      {
                        "Name": "runPauseButton",
                        "Type": "TwoStateButton",
                        "Properties": [
                          {
                            "name": "OffClick",
                            "value": "%_pause%"
                          },
                          {
                            "name": "State",
                            "value": "_isPaused"
                          },
                          {
                            "name": "Tooltip",
                            "value": "\"Play/Pause\""
                          },
                          {
                            "name": "ImageOnUrl",
                            "value": "\"/org/opensourcephysics/resources/controls/images/play.gif\""
                          },
                          {
                            "name": "OnClick",
                            "value": "%_play%"
                          },
                          {
                            "name": "ImageOffUrl",
                            "value": "\"/org/opensourcephysics/resources/controls/images/pause.gif\""
                          }
                        ]
                      },
                      {
                        "Name": "stepButton",
                        "Type": "Button",
                        "Properties": [
                          {
                            "name": "Tooltip",
                            "value": "\"Step\""
                          },
                          {
                            "name": "ImageUrl",
                            "value": "\"/org/opensourcephysics/resources/controls/images/stepforward.gif\""
                          },
                          {
                            "name": "OnClick",
                            "value": "%_step%"
                          }
                        ]
                      },
                      {
                        "Name": "initButton",
                        "Type": "Button",
                        "Properties": [
                          {
                            "name": "Tooltip",
                            "value": "\"Initialize\""
                          },
                          {
                            "name": "ImageUrl",
                            "value": "\"/org/opensourcephysics/resources/controls/images/reset1.gif\""
                          },
                          {
                            "name": "OnClick",
                            "value": "%_initialize%"
                          }
                        ]
                      },
                      {
                        "Name": "resetButton",
                        "Type": "Button",
                        "Properties": [
                          {
                            "name": "Tooltip",
                            "value": "\"Reset\""
                          },
                          {
                            "name": "ImageUrl",
                            "value": "\"/org/opensourcephysics/resources/controls/images/reset.gif\""
                          },
                          {
                            "name": "OnClick",
                            "value": "%_reset%"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "Name": "plottingPanel",
            "Type": "PlottingPanel",
            "Expanded": "true",
            "Properties": [
              {
                "name": "AutoScaleX",
                "value": "false"
              },
              {
                "name": "AutoScaleY",
                "value": "false"
              },
              {
                "name": "MinimumX",
                "value": "-5"
              },
              {
                "name": "MaximumX",
                "value": "5"
              },
              {
                "name": "MinimumY",
                "value": "-5"
              },
              {
                "name": "MaximumY",
                "value": "5"
              },
              {
                "name": "Enabled",
                "value": "true"
              },
              {
                "name": "Gutters",
                "value": "[0,0,0,0]"
              },
              {
                "name": "Width",
                "value": "\"100%\""
              },
              {
                "name": "Height",
                "value": "\"90vh\""
              },
              {
                "name": "TLMessage",
                "value": "\"Drag the fish to reach the coral reef on the right without colliding into any floating pollutants or marine animals\""
              }
            ],
            "Children": [
              {
                "Name": "sea",
                "Type": "Image2D",
                "Properties": [
                  {
                    "name": "ImageUrl",
                    "value": "\"./waterbody.png\""
                  },
                  {
                    "name": "Visibility",
                    "value": "true"
                  },
                  {
                    "name": "X",
                    "value": "0"
                  },
                  {
                    "name": "Y",
                    "value": "4"
                  },
                  {
                    "name": "SizeX",
                    "value": "10"
                  },
                  {
                    "name": "SizeY",
                    "value": "20"
                  }
                ]
              },
              {
                "Name": "shape2Dship",
                "Type": "Shape2D",
                "Properties": [
                  {
                    "name": "ShapeType",
                    "value": "\"NONE\""
                  },
                  {
                    "name": "X",
                    "value": "shipPositionX"
                  },
                  {
                    "name": "Y",
                    "value": "shipPositionY"
                  },
                  {
                    "name": "SizeX",
                    "value": "3"
                  },
                  {
                    "name": "SizeY",
                    "value": "3"
                  }
                ]
              },
              {
                "Name": "image2DFish",
                "Type": "Image2D",
                "Properties": [
                  {
                    "name": "X",
                    "value": "shipPositionX"
                  },
                  {
                    "name": "Y",
                    "value": "shipPositionY"
                  },
                  {
                    "name": "SizeX",
                    "value": "shipRadius*2"
                  },
                  {
                    "name": "SizeY",
                    "value": "shipRadius*2"
                  },
                  {
                    "name": "ImageUrl",
                    "value": "\"./fish.png\""
                  },
                  {
                    "name": "OnPress",
                    "value": "//shipPositionXnew=shipPositionX\n//shipPositionYnew=shipPositionY\n//tnew=t;"
                  },
                  {
                    "name": "EnabledPosition",
                    "value": "\"ENABLED_ANY\""
                  },
                  {
                    "name": "OnDrag",
                    "value": "/*\n\n// Define the initial offset object\nvar offset = {\n  x: 0,\n  y: 0\n};\n\n// Update the offset values based on new and old ship positions\noffset.x = shipPositionXnew - shipPositionX;\noffset.y = shipPositionYnew - shipPositionY;\n\n// Calculate the time difference\nvar dt = tnew - t;\n\n if (dt !== 0) {\n                    shipSpeedX = offset.x / dt;\n                  shipSpeedY = offset.y / dt;\n\n                    console.log(`shipSpeedX: ${shipSpeedX}, shipSpeedY: ${shipSpeedY}`);\n                }\n\n\n*/"
                  }
                ]
              },
              {
                "Name": "shape2DDrag",
                "Type": "Shape2D",
                "Properties": [
                  {
                    "name": "X",
                    "value": "shipSpeedX"
                  },
                  {
                    "name": "Y",
                    "value": "shipSpeedY"
                  },
                  {
                    "name": "EnabledPosition",
                    "value": "\"ENABLED_ANY\""
                  },
                  {
                    "name": "Sensitivity",
                    "value": "20"
                  },
                  {
                    "name": "SizeX",
                    "value": "1"
                  },
                  {
                    "name": "SizeY",
                    "value": "1"
                  },
                  {
                    "name": "FillColor",
                    "value": "\"rgba(0,0,0,0)\""
                  },
                  {
                    "name": "OnDrag",
                    "value": "Arrowxo = Arrowx\n\nArrowyo = Arrowy"
                  },
                  {
                    "name": "Visibility",
                    "value": "false"
                  }
                ]
              },
              {
                "Name": "arrow2D",
                "Type": "Arrow2D",
                "Properties": [
                  {
                    "name": "X",
                    "value": "0"
                  },
                  {
                    "name": "Y",
                    "value": "0"
                  },
                  {
                    "name": "SizeX",
                    "value": "windSpeedX"
                  },
                  {
                    "name": "SizeY",
                    "value": "windSpeedY"
                  },
                  {
                    "name": "LineWidth",
                    "value": "5"
                  },
                  {
                    "name": "LineColor",
                    "value": "\"Red\""
                  }
                ]
              },
              {
                "Name": "imagePlasticbag",
                "Type": "Image2D",
                "Properties": [
                  {
                    "name": "ImageUrl",
                    "value": "\"./plastic bag.png\""
                  },
                  {
                    "name": "X",
                    "value": "objectX"
                  },
                  {
                    "name": "Y",
                    "value": "objectY"
                  },
                  {
                    "name": "SizeX",
                    "value": "objectSizeX"
                  },
                  {
                    "name": "SizeY",
                    "value": "objectSizeY"
                  },
                  {
                    "name": "EnabledPosition",
                    "value": "\"ENABLED_ANY\""
                  }
                ]
              },
              {
                "Name": "imageBottle",
                "Type": "Image2D",
                "Properties": [
                  {
                    "name": "ImageUrl",
                    "value": "\"./plasticbottle.png\""
                  },
                  {
                    "name": "X",
                    "value": "bottleX"
                  },
                  {
                    "name": "Y",
                    "value": "bottleY"
                  },
                  {
                    "name": "SizeX",
                    "value": "bottleSizeX"
                  },
                  {
                    "name": "SizeY",
                    "value": "bottleSizeY"
                  },
                  {
                    "name": "EnabledPosition",
                    "value": "\"ENABLED_ANY\""
                  }
                ]
              },
              {
                "Name": "imageNet",
                "Type": "Image2D",
                "Properties": [
                  {
                    "name": "ImageUrl",
                    "value": "\"./neatnet.png\""
                  },
                  {
                    "name": "Y",
                    "value": "netY"
                  },
                  {
                    "name": "X",
                    "value": "netX"
                  },
                  {
                    "name": "SizeX",
                    "value": "netSizeX"
                  },
                  {
                    "name": "SizeY",
                    "value": "netSizeY"
                  },
                  {
                    "name": "EnabledPosition",
                    "value": "\"ENABLED_ANY\""
                  }
                ]
              },
              {
                "Name": "imageReef",
                "Type": "Image2D",
                "Properties": [
                  {
                    "name": "ImageUrl",
                    "value": "\"./neatcoralreef.png\""
                  },
                  {
                    "name": "Y",
                    "value": "reefY"
                  },
                  {
                    "name": "X",
                    "value": "reefX"
                  },
                  {
                    "name": "SizeX",
                    "value": "2"
                  },
                  {
                    "name": "SizeY",
                    "value": "3"
                  }
                ]
              },
              {
                "Name": "imageTurtle",
                "Type": "Image2D",
                "Properties": [
                  {
                    "name": "ImageUrl",
                    "value": "\"./neatturtle.png\""
                  },
                  {
                    "name": "SizeX",
                    "value": "turtleSizeX"
                  },
                  {
                    "name": "SizeY",
                    "value": "turtleSizeY"
                  },
                  {
                    "name": "X",
                    "value": "turtleX"
                  },
                  {
                    "name": "Y",
                    "value": "turtleY"
                  },
                  {
                    "name": "EnabledPosition",
                    "value": "\"ENABLED_ANY\""
                  }
                ]
              },
              {
                "Name": "imageOctopus",
                "Type": "Image2D",
                "Properties": [
                  {
                    "name": "ImageUrl",
                    "value": "\"./neatoctopus.png\""
                  },
                  {
                    "name": "SizeX",
                    "value": "octSizeX"
                  },
                  {
                    "name": "SizeY",
                    "value": "octSizeY"
                  },
                  {
                    "name": "X",
                    "value": "octX"
                  },
                  {
                    "name": "Y",
                    "value": "octY"
                  },
                  {
                    "name": "EnabledPosition",
                    "value": "\"ENABLED_ANY\""
                  }
                ]
              }
            ]
          }
        ]
      }
    ],
    "RootProperties": []
  },
  "metadata": {
    "APP": "WebEJS",
    "CreatedWith": "WebEJS : the web version of Easy JavaScript Simulations",
    "MoreInfo": "1.0",
    "version": "https://t.um.es/webejs"
  }
}