<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1623386781582871841</id><updated>2025-03-24T02:05:12.383-07:00</updated><title type='text'>Crónicas de Esperantia 2020</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://cronicasdeesperantia2020.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1623386781582871841/posts/default'/><link rel='alternate' type='text/html' href='https://cronicasdeesperantia2020.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Fran J. Saavedra Bauló</name><uri>http://www.blogger.com/profile/14976438267472305647</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGgLq5tJ2wKKqv2ZZ-sHGjivnK0pt-6yU2g4nY__bHcbHexFmWb8uwmn-uMROZSmUHlz0zMLhh8knOAd385gSy-t-hrjWqv46Zj5eZ1uaOV8suQuGRjqj73EdNaWUxHv_sJap7IESB-oZpV53j4CsHu_nOY7OZs1x0D50kgFm9qKx4ETM/s220/319050747_1080360220028403_1411213179004375920_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1623386781582871841.post-7422701972545506571</id><published>2025-03-18T19:35:00.000-07:00</published><updated>2025-03-18T20:20:41.468-07:00</updated><title type='text'>prueba</title><content type='html'>&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;es&quot;&gt;
&lt;head&gt;
    &lt;meta charset=&quot;UTF-8&quot;&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
    &lt;title&gt;Ajedrez con Apuestas&lt;/title&gt;
    &lt;style&gt;
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            background-color: #f0f0f0;
        }
        #game-container {
            margin: 20px auto;
            max-width: 600px;
        }
        #board {
            display: inline-grid;
            grid-template-columns: repeat(8, 50px);
            grid-template-rows: repeat(8, 50px);
            border: 2px solid #333;
            background-color: #fff;
        }
        .square {
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 30px;
            cursor: pointer;
        }
        .light {
            background-color: #f0d9b5;
        }
        .dark {
            background-color: #b58863;
        }
        .selected {
            background-color: #ffff99 !important;
        }
        #betting-section {
            margin-top: 20px;
        }
        #status {
            font-size: 18px;
            margin-top: 10px;
        }
        button {
            padding: 10px 20px;
            font-size: 16px;
            margin: 5px;
            cursor: pointer;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div id=&quot;game-container&quot;&gt;
        &lt;h1&gt;Ajedrez con Apuestas&lt;/h1&gt;
        &lt;div id=&quot;board&quot;&gt;&lt;/div&gt;
        &lt;div id=&quot;betting-section&quot;&gt;
            &lt;h2&gt;Apuestas&lt;/h2&gt;
            &lt;p&gt;Saldo: &lt;span id=&quot;balance&quot;&gt;1000&lt;/span&gt; créditos&lt;/p&gt;
            &lt;input type=&quot;number&quot; id=&quot;bet-amount&quot; min=&quot;1&quot; max=&quot;1000&quot; value=&quot;100&quot; placeholder=&quot;Cantidad a apostar&quot;&gt;
            &lt;button onclick=&quot;placeBet()&quot;&gt;Apostar y Jugar&lt;/button&gt;
            &lt;button onclick=&quot;endGameManually()&quot;&gt;Terminar Partida&lt;/button&gt;
        &lt;/div&gt;
        &lt;div id=&quot;status&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;script&gt;
        // Versión mínima de chess.js embebida (solo lo esencial para este ejemplo)
        function Chess() {
            this.board = [
                [&#39;r&#39;, &#39;n&#39;, &#39;b&#39;, &#39;q&#39;, &#39;k&#39;, &#39;b&#39;, &#39;n&#39;, &#39;r&#39;],
                [&#39;p&#39;, &#39;p&#39;, &#39;p&#39;, &#39;p&#39;, &#39;p&#39;, &#39;p&#39;, &#39;p&#39;, &#39;p&#39;],
                [&#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;],
                [&#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;],
                [&#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;],
                [&#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;],
                [&#39;P&#39;, &#39;P&#39;, &#39;P&#39;, &#39;P&#39;, &#39;P&#39;, &#39;P&#39;, &#39;P&#39;, &#39;P&#39;],
                [&#39;R&#39;, &#39;N&#39;, &#39;B&#39;, &#39;Q&#39;, &#39;K&#39;, &#39;B&#39;, &#39;N&#39;, &#39;R&#39;]
            ];
            this.turn = &#39;w&#39;;
            this.moves = [];

            this.move = function({ from, to, promotion = &#39;q&#39; }) {
                const fromRow = 7 - parseInt(from[1]) + 1;
                const fromCol = from.charCodeAt(0) - 97;
                const toRow = 7 - parseInt(to[1]) + 1;
                const toCol = to.charCodeAt(0) - 97;
                const piece = this.board[fromRow][fromCol];

                if (!piece || (this.turn === &#39;w&#39; &amp;&amp; piece.toLowerCase() === piece) || (this.turn === &#39;b&#39; &amp;&amp; piece.toUpperCase() === piece)) {
                    return null;
                }

                this.board[toRow][toCol] = piece;
                this.board[fromRow][fromCol] = &#39;.&#39;;
                this.turn = this.turn === &#39;w&#39; ? &#39;b&#39; : &#39;w&#39;;
                this.moves.push({ from, to });
                return { from, to };
            };

            this.in_checkmate = function() {
                return this.moves.length &gt; 20 &amp;&amp; Math.random() &gt; 0.95; // Simulación simple
            };

            this.in_draw = function() {
                return this.moves.length &gt; 50 &amp;&amp; Math.random() &gt; 0.9; // Simulación simple
            };

            this.fen = function() {
                return this.board.map(row =&gt; row.join(&#39;&#39;)).join(&#39;/&#39;);
            };

            this.reset = function() {
                this.board = [
                    [&#39;r&#39;, &#39;n&#39;, &#39;b&#39;, &#39;q&#39;, &#39;k&#39;, &#39;b&#39;, &#39;n&#39;, &#39;r&#39;],
                    [&#39;p&#39;, &#39;p&#39;, &#39;p&#39;, &#39;p&#39;, &#39;p&#39;, &#39;p&#39;, &#39;p&#39;, &#39;p&#39;],
                    [&#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;],
                    [&#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;],
                    [&#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;],
                    [&#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;, &#39;.&#39;],
                    [&#39;P&#39;, &#39;P&#39;, &#39;P&#39;, &#39;P&#39;, &#39;P&#39;, &#39;P&#39;, &#39;P&#39;, &#39;P&#39;],
                    [&#39;R&#39;, &#39;N&#39;, &#39;B&#39;, &#39;Q&#39;, &#39;K&#39;, &#39;B&#39;, &#39;N&#39;, &#39;R&#39;]
                ];
                this.turn = &#39;w&#39;;
                this.moves = [];
            };
        }

        // Mapa de piezas a caracteres Unicode
        const pieceToUnicode = {
            &#39;r&#39;: &#39;♜&#39;, &#39;n&#39;: &#39;♞&#39;, &#39;b&#39;: &#39;♝&#39;, &#39;q&#39;: &#39;♛&#39;, &#39;k&#39;: &#39;♚&#39;, &#39;p&#39;: &#39;♟&#39;,
            &#39;R&#39;: &#39;♖&#39;, &#39;N&#39;: &#39;♘&#39;, &#39;B&#39;: &#39;♗&#39;, &#39;Q&#39;: &#39;♕&#39;, &#39;K&#39;: &#39;♔&#39;, &#39;P&#39;: &#39;♙&#39;,
            &#39;.&#39;: &#39;&#39;
        };

        let game = new Chess();
        let balance = 1000;
        let currentBet = 0;
        let gameStarted = false;
        let selectedSquare = null;

        // Dibujar el tablero
        function drawBoard() {
            const boardDiv = document.getElementById(&#39;board&#39;);
            boardDiv.innerHTML = &#39;&#39;;
            for (let i = 0; i &lt; 64; i++) {
                const row = 7 - Math.floor(i / 8);
                const col = i % 8;
                const square = document.createElement(&#39;div&#39;);
                square.className = &#39;square &#39; + ((row + col) % 2 === 0 ? &#39;light&#39; : &#39;dark&#39;);
                square.innerHTML = pieceToUnicode[game.board[row][col]];
                square.dataset.index = i;
                square.onclick = () =&gt; handleClick(i);
                boardDiv.appendChild(square);
            }
            updateStatus();
        }

        // Manejar clics en el tablero
        function handleClick(index) {
            if (!gameStarted) return;
            const squares = document.querySelectorAll(&#39;.square&#39;);
            const row = 7 - Math.floor(index / 8);
            const col = index % 8;
            const from = selectedSquare !== null ? String.fromCharCode(97 + (selectedSquare % 8)) + (8 - Math.floor(selectedSquare / 8)) : null;
            const to = String.fromCharCode(97 + col) + (8 - row);

            if (selectedSquare === null &amp;&amp; game.board[row][col] !== &#39;.&#39;) {
                selectedSquare = index;
                squares[index].classList.add(&#39;selected&#39;);
            } else if (selectedSquare !== null) {
                const move = game.move({ from, to });
                if (move) {
                    squares[selectedSquare].classList.remove(&#39;selected&#39;);
                    selectedSquare = null;
                    drawBoard();
                } else {
                    squares[selectedSquare].classList.remove(&#39;selected&#39;);
                    selectedSquare = null;
                }
            }
        }

        // Actualizar estado del juego
        function updateStatus() {
            let status = &#39;&#39;;
            if (game.in_checkmate()) {
                status = &#39;¡Juego terminado! &#39; + (game.turn === &#39;w&#39; ? &#39;Negras&#39; : &#39;Blancas&#39;) + &#39; ganan.&#39;;
                endGame(game.turn === &#39;w&#39; ? &#39;b&#39; : &#39;w&#39;);
            } else if (game.in_draw()) {
                status = &#39;¡Juego terminado! Empate.&#39;;
                endGame(&#39;draw&#39;);
            } else {
                status = &#39;Turno de &#39; + (game.turn === &#39;w&#39; ? &#39;Blancas&#39; : &#39;Negras&#39;);
            }
            document.getElementById(&#39;status&#39;).textContent = gameStarted ? status : &#39;Ingresa una apuesta para comenzar&#39;;
        }

        // Sistema de apuestas
        function placeBet() {
            if (gameStarted) {
                alert(&#39;Ya hay una partida en curso.&#39;);
                return;
            }
            const bet = parseInt(document.getElementById(&#39;bet-amount&#39;).value);
            if (isNaN(bet) || bet &lt;= 0 || bet &gt; balance) {
                alert(&#39;Ingresa una apuesta válida dentro de tu saldo.&#39;);
                return;
            }
            currentBet = bet;
            balance -= bet;
            document.getElementById(&#39;balance&#39;).textContent = balance;
            gameStarted = true;
            game.reset();
            drawBoard();
            alert(&#39;Apuesta de &#39; + bet + &#39; créditos realizada.&#39;);
        }

        // Terminar partida manualmente
        function endGameManually() {
            if (!gameStarted) {
                alert(&#39;No hay partida en curso.&#39;);
                return;
            }
            const winner = prompt(&#39;¿Quién ganó? (Blancas, Negras o Empate)&#39;);
            if (winner) {
                endGame(winner.charAt(0).toLowerCase() === &#39;b&#39; ? &#39;w&#39; : winner.charAt(0).toLowerCase() === &#39;n&#39; ? &#39;b&#39; : &#39;draw&#39;);
            }
        }

        // Finalizar juego y ajustar saldo
        function endGame(winner) {
            gameStarted = false;
            if (winner === &#39;w&#39;) {
                balance += currentBet * 2;
                alert(&#39;¡Blancas ganan! Recibes &#39; + (currentBet * 2) + &#39; créditos.&#39;);
            } else if (winner === &#39;b&#39;) {
                alert(&#39;¡Negras ganan! Pierdes tu apuesta.&#39;);
            } else {
                balance += currentBet;
                alert(&#39;Empate. Se te devuelven &#39; + currentBet + &#39; créditos.&#39;);
            }
            document.getElementById(&#39;balance&#39;).textContent = balance;
            currentBet = 0;
            drawBoard();
        }

        // Inicializar el tablero
        drawBoard();
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</content><link rel='replies' type='application/atom+xml' href='https://cronicasdeesperantia2020.blogspot.com/feeds/7422701972545506571/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='https://cronicasdeesperantia2020.blogspot.com/2025/03/prueba.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1623386781582871841/posts/default/7422701972545506571'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1623386781582871841/posts/default/7422701972545506571'/><link rel='alternate' type='text/html' href='https://cronicasdeesperantia2020.blogspot.com/2025/03/prueba.html' title='prueba'/><author><name>Fran J. Saavedra Bauló</name><uri>http://www.blogger.com/profile/14976438267472305647</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGgLq5tJ2wKKqv2ZZ-sHGjivnK0pt-6yU2g4nY__bHcbHexFmWb8uwmn-uMROZSmUHlz0zMLhh8knOAd385gSy-t-hrjWqv46Zj5eZ1uaOV8suQuGRjqj73EdNaWUxHv_sJap7IESB-oZpV53j4CsHu_nOY7OZs1x0D50kgFm9qKx4ETM/s220/319050747_1080360220028403_1411213179004375920_n.jpg'/></author><thr:total>0</thr:total></entry></feed>