"Quenched AR" is a unique and innovative match-3 game that combines augmented reality technology with the classic game mechanics.
Creating the Board
// Pseudo Code for Creating the Board
function createBoard(width, height) {
let board = new Array(height);
for (let i = 0; i < height; i++) {
board[i] = new Array(width);
}
return board;
}
Randomizing the Board
// Pseudo Code for Randomizing the Board
function randomizeBoard(board) {
for each tile in board
tile.type = getRandomDrinkType()
}
Preventing Repeating Tiles
// Pseudo Code for Preventing Repeating Tiles
function checkAndPreventRepeats(board) {
for each tile in board
while hasRepeatingNeighbours(tile)
tile.type = getRandomDrinkType()
}
Swapping Tiles
// Pseudo Code for Swapping Tiles
function swapTiles(tile1, tile2) {
temporary = tile1.type
tile1.type = tile2.type
tile2.type = temporary
}
Finding Adjacent Tiles
// Pseudo Code for Finding Adjacent Tiles
function findAdjacentTiles(tile) {
// Return list of adjacent tiles
}
Shifting and Refilling Tiles
Combos
// Pseudo Code for Calculating Combos
function calculateCombos(board) {
// Initialize a list to keep track of tiles that are part of combos
var comboTiles = []
// Iterate over each tile in the board
for each tile in board {
if (isPartOfCombo(tile)) {
// If the tile is part of a combo, add it to the list
comboTiles.add(tile)
}
}
// For each tile that is part of a combo
for each tile in comboTiles {
// Remove the tile from the board
removeTile(tile)
// Increment the player's score based on the combo length
updateScore(comboTiles.length)
}
// Check if there are empty spaces in the board after removing tiles
if (boardHasEmptySpaces()) {
// Shift tiles to fill the empty spaces
shiftAndRefillTiles(board)
}
// Recursively check for new combos after the board has been updated
if (newCombosFormed()) {
calculateCombos(board)
}
}
// Helper function to determine if a tile is part of a combo
function isPartOfCombo(tile) {
// Logic to check adjacent tiles for matching types
// Return true if tile is part of a horizontal or vertical match of 3 or more
}
// Helper function to remove a tile from the board
function removeTile(tile) {
// Logic to remove the specified tile from the board
}
// Helper function to update the player's score
function updateScore(comboLength) {
// Logic to update the player's score based on the length of the combo
}
// Helper function to check if the board has empty spaces
function boardHasEmptySpaces() {
// Logic to check for empty spaces on the board
// Return true if there are empty spaces
}
// Helper function to shift tiles and refill the board
function shiftAndRefillTiles(board) {
// Logic for shifting tiles down to fill empty spaces
// Logic for refilling the board with new tiles
}
// Helper function to check for new combos after updating the board
function newCombosFormed() {
// Logic to check if new combos are formed after shifting and refilling tiles
// Return true if new combos are formed
}