<html>
<head>
<script type="text/javascript"> window.addEventListener('error', function(event) { var message = JSON.parse(JSON.stringify(event.message)); var source = event.filename; var lineno = event.lineno; var colno = event.colno; var error = event.error; window.parent.postMessage({ type: 'iframeError', details: { message: message, source: source, lineno: lineno, colno: colno, error: error ? error.stack : '' } }, '*'); }); window.addEventListener('unhandledrejection', function(event) { window.parent.postMessage({ type: 'iframePromiseRejection', details: { reason: event.reason } }, '*'); }); </script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Maze Pathfinder Game</title>
<meta name="description" content="A maze Pathfinder game with 100 levels of increasing difficulty.">
<meta name="keywords" content="Maze, Pathfinder, Game, Fun, Interactive, Web App">
<style>
/* App CSS Goes Here */
.row {
display: flex;
}
.cell {
border: 1px solid #000;
width: 50px;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
}
</style>
<link rel="canonical" href="https://calculator.tools/app/pathfinder-game-471/">
<meta charset="utf-8">
</head>
<body>
<div id="main-container" class="container">
<!-- Grid will appear here -->
</div>
<script type="text/javascript">
try {
// Game Variables
let playerPosition = {x: 0, y: 0};
let goalPosition = {x: 0, y: 0};
const gridSize = 5;
let currentLevel = 1;
// This will run when the DOM is ready.
document.addEventListener("DOMContentLoaded", function() {
window.addEventListener('keydown', handleKeydown);
generateMaze();
drawGrid();
});
function handleKeydown(e) {
switch(e.keyCode) {
case 37: // left
if (isPath(playerPosition.x - 1, playerPosition.y)) {
playerPosition.x--;
}
break;
case 38: // up
if (isPath(playerPosition.x, playerPosition.y - 1)) {
playerPosition.y--;
}
break;
case 39: // right
if (isPath(playerPosition.x + 1, playerPosition.y)) {
playerPosition.x++;
}
break;
case 40: // down
if (isPath(playerPosition.x, playerPosition.y + 1)) {
playerPosition.y++;
}
break;
}
drawGrid();
if(playerPosition.x === goalPosition.x && playerPosition.y === goalPosition.y) {
setTimeout(function() {
alert("You've reached the goal! π");
nextLevel();
}, 100);
}
}
function generateMaze() {
const obstacles = generateObstacles();
const validPath = generateValidPath(obstacles);
playerPosition = validPath[0];
goalPosition = validPath[validPath.length - 1];
}
function generateObstacles() {
const obstacles = [];
for(let i = 0; i < gridSize; i++) {
obstacles[i] = [];
for(let j = 0; j < gridSize; j++) {
obstacles[i][j] = Math.random() < getObstacleDensity(currentLevel);
}
}
return obstacles;
}
function generateValidPath(obstacles) {
const path = [];
const visited = [];
for(let i = 0; i < gridSize; i++) {
visited[i] = [];
for(let j = 0; j < gridSize; j++) {
visited[i][j] = false;
}
}
dfs(0, 0, visited, path, obstacles);
return path;
}
function dfs(x, y, visited, path, obstacles) {
visited[x][y] = true;
path.push({x, y});
if(x === gridSize - 1 && y === gridSize - 1) {
return true;
}
const dx = [-1, 1, 0, 0];
const dy = [0, 0, -1, 1];
for(let i = 0; i < 4; i++) {
const newX = x + dx[i];
const newY = y + dy[i];
if(isValid(newX, newY, visited, obstacles)) {
if(dfs(newX, newY, visited, path, obstacles)) {
return true;
}
}
}
path.pop();
return false;
}
function isValid(x, y, visited, obstacles) {
return x >= 0 && x < gridSize && y >= 0 && y < gridSize && !visited[x][y] && !obstacles[x][y];
}
function isPath(x, y) {
return x >= 0 && x < gridSize && y >= 0 && y < gridSize && !obstacles[x][y];
}
function getObstacleDensity(level) {
return Math.min(0.2 + level * 0.01, 0.8);
}
function nextLevel() {
currentLevel++;
generateMaze();
drawGrid();
}
function drawGrid() {
const container = document.getElementById('main-container');
container.innerHTML = '';
for(let y = 0; y < gridSize; y++) {
const row = document.createElement('div');
row.classList.add('row');
for(let x = 0; x < gridSize; x++) {
const cell = document.createElement('div');
cell.classList.add('cell');
cell.textContent = getCellContent(x, y);
row.appendChild(cell);
}
container.appendChild(row);
}
}
function getCellContent(x, y) {
if(playerPosition.x === x && playerPosition.y === y) {
return 'πΆββοΈ';
} else if(goalPosition.x === x && goalPosition.y === y) {
return 'π';
} else if(obstacles[x][y]) {
return 'π³';
} else {
return ' ';
}
}
} catch (error) {
throw error;
}
</script>
<script type="text/javascript"> var localStoragePrefix = "ct-471"; var lastSave = 0; function saveLocal(data) { if (Date.now() - lastSave < 1000) { return; } let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict"; cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString(); document.cookie = cookie; lastSave = Date.now(); } function loadLocal() { var cookiePrefix = localStoragePrefix + "="; var cookieStart = document.cookie.indexOf(cookiePrefix); if (cookieStart > -1) { let cookieEnd = document.cookie.indexOf(";", cookieStart); if (cookieEnd == -1) { cookieEnd = document.cookie.length; } var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd); return JSON.parse(cookieData); } } </script>
<script type="text/javascript"> window.addEventListener('load', function() { var observer = new MutationObserver(function() { window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); observer.observe(document.body, {attributes: true, childList: true, subtree: true}); window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); </script>
</body>
</html>
These are apps made by the community!
Calculator Tools allows you to instantly create and generate any simple one page web app for
free and immediately have it online to use and share. This means anything! Mini apps,
calculators, trackers, tools, games, puzzles, screensavers... anything you can think of that the
AI can handle.
The AI uses Javacript, HTML, and CSS programming to code your app up in moments. This currently
uses GPT-4 the latest and most powerful version of the OpenAI GPT language model.
Have you ever just wanted a simple app but didn't want to learn programming or pay someone to
make it for you? Calculator Tools is the solution! Just type in your prompt and the AI will
generate a simple app for you in seconds. You can then customize it to your liking and share it
with your friends.
AI has become so powerful it is that simple these days.
It uses GPT-4 which is the most powerful model for ChatGPT.
Calculator Tools does not remember things from prompt to prompt, each image is a unique image
that does not reference any of the images or prompts previously supplied.