Skip to content

Instantly share code, notes, and snippets.

View Jorger's full-sized avatar
🏠
Working from home

Jorge Rubiano Jorger

🏠
Working from home
View GitHub Profile
@Jorger
Jorger / readQR.js
Last active February 3, 2021 22:43
import "./styles.css";
import { decodeUrlLevel, validURL } from "../../utils/helpers";
import { useState } from "react";
import QrcodeDecoder from "qrcode-decoder";
import swal from "sweetalert";
const qr = new QrcodeDecoder();
const randomString = () => Math.random().toString(36);
<div className="game-grid-wrapper-character">
{characters.map((character, index) => {
const left =
character[character.isRunning ? "destinationLeft" : "left"];
const top =
character[character.isRunning ? "destinationTop" : "top"];
const spring = useSpring({
config: {
duration: 500,
},
"use strict";
const availableUsers = [];
const rooms = [];
/**
* Socket.IO on connect event
* @param {Socket} socket
*/
module.exports = {
io: socket => {
/**
* Inferir un ataque teniendo posiciones conocidas.
* @param {*} board
*/
const inferAttack = board => {
const boardSize = DIMENSION_BOARD - 1;
let newRow = 0;
let newCol = 0;
let inferredAttack = false;
/**
* Crea un nuevo board, estableciendo la posición de las figuras en la misma
* @param {*} showFigure
*/
const createBoard = (showFigure = 1) => {
const board = [...new Array(DIMENSION_BOARD)].map(() =>
new Array(DIMENSION_BOARD).fill(0)
);
const figures = [];
/**
* Establece una posición aleatoria de una figura en el escenario
* @param {*} size
* @param {*} board
*/
const locateFigure = (size, board) => {
const boardSize = DIMENSION_BOARD - 1;
let position = [];
do {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
const readDataLevels = data => {
const dataWord = [];
const splitdata = data.split(";");
for (let value of splitdata) {
const splitWorld = value.split("#");
const splitDimensionColors = splitWorld[0].split(",");
const pipesValue = splitWorld[1];
//Partir los valores que se necesitan...
//Guardar los valores de inicio...
const limitPoints = { s: [], e: [] };
//Saber si todos están conectados...
if (globalPipes.length === actualWorld[1].length) {
const pipesFinish = numFinalElements.reduce(
(a, s) => a + (s[1] !== 0),
0
);
if (pipesFinish === actualWorld[2].length) {
finishLevel = true;
modalText(true, "Next Level");
}
let finalElements = 0;
for (let connected of connectedPipes) {
if (
actualWorld[1][connected][2] !== 1 &&
actualWorld[1][connected][2] !== 2
) {
//Se establece el color...
actualWorld[1][connected][4] = initialColor;
} else {
if (actualWorld[1][connected][2] === 2) {