/tg/ Station 13 - Modules - TypesVar Details - Proc Details

minesweeper

Vars

bomb_cellsCells with bombs. Used in reveal_all_bombs
current_3BVCurrent field 3BV (special system of score for minesweeper). Used to calculate 3BV/s (user efficiency)
directionsDirections for adjacent cells
field_bombs_amountCurrent field amount of bombs
field_heightCurrent field amount of rows
field_widthCurrent field amount of columns
first_touchThing, to make first touch safety
flagged_bombsAmount of flagged bombs. Used to check win condition
glob_leaderboardThe global leaderboard list
ignore_touchesDecision to make interface untouchable in the momemnt of regenerating
leaderboardThe current round leaderboard list
loose_explosion_range_heavyEmagged bomb stats
minesweeper_matrixHere we have all the minesweeper info
opened_cellsAmount of opened cells. Used to check win condition
set_flagsAmount of set flags. Used to check win condition
start_timeThe world.time the game was started. Used to calculate 3BV/s (user efficiency)

Procs

add_into_leadersAdd player result to local, global leaderboards and DB
add_result_to_dbInsert new player result into database
change_field_paramsRequests user the new field params and updates the field
count_3BVCount value of field for scoring
generate_fieldFill matrix with bombs, ignores 3x3 square around first touch place
handle_square_clickHandles a click on a square on the field.
init_leaderboardGet stored in database player results and fill glob_leaderboard with them
is_cell_in_boundsChecks if cell by passed coordinates is in field bounds
make_empty_matrixReturn the minesweeper matrix to initial state
mark_adjacent_zerospart of proc/count_3BV, used to ignore adjacent "zeroes"
on_looseCalled when player lost the game
open_cellMakes cell by passed coordinates open. Increases opened_cells if cell was successfully opened and removes flag from it.
reveal_all_bombsMakes all cells with bombs open. Used in on_loose proc
update_zerosOpen all "zeroes" around the click place

Var Details

bomb_cells

Cells with bombs. Used in reveal_all_bombs

current_3BV

Current field 3BV (special system of score for minesweeper). Used to calculate 3BV/s (user efficiency)

directions

Directions for adjacent cells

field_bombs_amount

Current field amount of bombs

field_height

Current field amount of rows

field_width

Current field amount of columns

first_touch

Thing, to make first touch safety

flagged_bombs

Amount of flagged bombs. Used to check win condition

glob_leaderboard

The global leaderboard list

ignore_touches

Decision to make interface untouchable in the momemnt of regenerating

leaderboard

The current round leaderboard list

loose_explosion_range_heavy

Emagged bomb stats

minesweeper_matrix

Here we have all the minesweeper info

opened_cells

Amount of opened cells. Used to check win condition

set_flags

Amount of set flags. Used to check win condition

start_time

The world.time the game was started. Used to calculate 3BV/s (user efficiency)

Proc Details

add_into_leaders

Add player result to local, global leaderboards and DB

add_result_to_db

Insert new player result into database

change_field_params

Requests user the new field params and updates the field

count_3BV

Count value of field for scoring

generate_field

Fill matrix with bombs, ignores 3x3 square around first touch place

handle_square_click

Handles a click on a square on the field.

@param {number} x - Row of the square @param {number} y - Column of the square @param {string} mode - The mode of the click. Can be "bomb" or "flag" @param {mob} user - Mob that made the click

@return {boolean} - TRUE if the click was handled successfully, FALSE otherwise

init_leaderboard

Get stored in database player results and fill glob_leaderboard with them

is_cell_in_bounds

Checks if cell by passed coordinates is in field bounds

make_empty_matrix

Return the minesweeper matrix to initial state

mark_adjacent_zeros

part of proc/count_3BV, used to ignore adjacent "zeroes"

on_loose

Called when player lost the game

open_cell

Makes cell by passed coordinates open. Increases opened_cells if cell was successfully opened and removes flag from it.

@param {number] x - The row of the cell @param {number] y - The column of the cell

@return {boolean} - TRUE if cell should cause recursive opening, FALSE otherwise

reveal_all_bombs

Makes all cells with bombs open. Used in on_loose proc

update_zeros

Open all "zeroes" around the click place