{"id":88,"date":"2026-05-19T08:05:17","date_gmt":"2026-05-19T04:35:17","guid":{"rendered":"https:\/\/ttfasa.ir\/?page_id=88"},"modified":"2026-05-19T08:05:21","modified_gmt":"2026-05-19T04:35:21","slug":"%d8%b3%d8%a7%d8%ae%d8%aa-%d8%ac%d8%af%d9%88%d9%84-%d9%85%d8%b3%d8%a7%d8%a8%d9%82%d9%87","status":"publish","type":"page","link":"https:\/\/ttfasa.ir\/?page_id=88","title":{"rendered":"\u0633\u0627\u062e\u062a \u062c\u062f\u0648\u0644 \u0645\u0633\u0627\u0628\u0642\u0647"},"content":{"rendered":"<p><!DOCTYPE html><br \/>\n<html lang=\"fa\" dir=\"rtl\"><br \/>\n<head><br \/>\n    <meta charset=\"UTF-8\"><br \/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><br \/>\n    <title>\u0633\u0627\u062e\u062a \u062c\u062f\u0648\u0644 \u0645\u0633\u0627\u0628\u0642\u0647 &#8211; \u0633\u06cc\u062f\u0628\u0646\u062f\u06cc \u0647\u0648\u0634\u0645\u0646\u062f<\/title><\/p>\n<style>\n        body { font-family: Tahoma, 'Segoe UI', sans-serif; background: #f0f4f8; direction: rtl; padding: 20px; }\n        .container { max-width: 1100px; margin: auto; background: white; border-radius: 28px; padding: 30px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }\n        textarea { width: 100%; height: 220px; padding: 12px; font-size: 16px; border-radius: 16px; border: 1px solid #ccc; font-family: inherit; }\n        button { background: #1e73be; color: white; border: none; padding: 12px 28px; border-radius: 40px; font-size: 16px; cursor: pointer; margin-top: 20px; }\n        button:hover { background: #0f5a9c; }\n        .result { margin-top: 35px; overflow-x: auto; }\n        table { width: 100%; border-collapse: collapse; background: white; border-radius: 20px; overflow: hidden; }\n        th, td { border: 1px solid #ddd; padding: 10px 12px; text-align: center; vertical-align: middle; }\n        th { background: #1e73be; color: white; }\n        .seed-col { font-weight: bold; background: #eef2fa; width: 80px; }\n        .bye-row { background: #fff3cd; color: #856404; }\n        .note { background: #e9f0f9; padding: 16px; border-radius: 20px; margin-bottom: 25px; font-size: 14px; }\n        h3 { color: #1e73be; }\n    <\/style>\n<p><\/head><br \/>\n<body><\/p>\n<div class=\"container\">\n<h2>\ud83c\udfd3 \u062a\u0648\u0644\u06cc\u062f \u062e\u0648\u062f\u06a9\u0627\u0631 \u062c\u062f\u0648\u0644 \u0645\u0633\u0627\u0628\u0642\u0627\u062a (\u062a\u06a9 \u062d\u0630\u0641\u06cc \u0628\u0627 \u0633\u06cc\u062f\u0628\u0646\u062f\u06cc)<\/h2>\n<div class=\"note\">\n        <strong>\ud83d\udccc \u0631\u0648\u0634 \u06a9\u0627\u0631:<\/strong><br \/>\n        1. \u0627\u0633\u0627\u0645\u06cc \u0646\u0641\u0631\u0627\u062a \u0631\u0627 \u0628\u0647 \u062a\u0631\u062a\u06cc\u0628 \u0631\u062a\u0628\u0647 \u0647\u0641\u062a\u0647 \u0642\u0628\u0644 (\u0627\u0632 \u0642\u0647\u0631\u0645\u0627\u0646 \u0628\u0647 \u0622\u062e\u0631) \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f\u060c \u0647\u0631 \u0646\u0627\u0645 \u062f\u0631 \u06cc\u06a9 \u062e\u0637.<br \/>\n        2. \u0631\u0648\u06cc \u062f\u06a9\u0645\u0647 \u00ab\u062a\u0648\u0644\u06cc\u062f \u062c\u062f\u0648\u0644\u00bb \u06a9\u0644\u06cc\u06a9 \u06a9\u0646\u06cc\u062f.<br \/>\n        3. \u0633\u06cc\u0633\u062a\u0645 \u0628\u0631 \u0627\u0633\u0627\u0633 \u0642\u0648\u0627\u0646\u06cc\u0646 \u0634\u0645\u0627 (\u0646\u0641\u0631 \u0627\u0648\u0644 \u062c\u0627\u06cc\u06af\u0627\u0647 \u06f1\u060c \u062f\u0648\u0645 \u0622\u062e\u0631\u060c \u0633\u0648\u0645 \u0648 \u0686\u0647\u0627\u0631\u0645 \u0648\u0633\u0637\u060c &#8230;) \u0648 \u062a\u0639\u062f\u0627\u062f \u0646\u0641\u0631\u0627\u062a\u060c \u062c\u062f\u0648\u0644 \u0628\u0627 \u0633\u0627\u06cc\u0632 \u0645\u0646\u0627\u0633\u0628 (\u06f1\u06f6\u060c \u06f3\u06f2\u060c \u06f6\u06f4\u060c &#8230;) \u0633\u0627\u062e\u062a\u0647 \u0648 \u062c\u0627\u06cc\u06af\u0627\u0647 \u0627\u0633\u062a\u0631\u0627\u062d\u062a (\u0628\u0627\u06cc) \u0631\u0627 \u0645\u0634\u062e\u0635 \u0645\u06cc\u200c\u06a9\u0646\u062f.\n    <\/div>\n<p>    <label>\ud83d\udccb \u0644\u06cc\u0633\u062a \u0646\u0641\u0631\u0627\u062a (\u0627\u0632 \u0627\u0648\u0644 \u062a\u0627 \u0622\u062e\u0631 \u0631\u062a\u0628\u0647 \u0647\u0641\u062a\u0647 \u0642\u0628\u0644):<\/label><br \/>\n    <textarea id=\"playersList\" placeholder=\"\u0639\u0644\u06cc \u0628\u0633\u062a\u0627\u0646\u06cc\n\u067e\u0648\u06cc\u0627\u0646 \u062e\u0627\u0646\u0644\u0631\u06cc\n\u0645\u062d\u0645\u062f \u062d\u0633\u0646\u200c\u0632\u0627\u062f\u0647\n\u0645\u062d\u0645\u062f\u0645\u0628\u06cc\u0646 \u06af\u0646\u062c\u06cc\n...\"><\/textarea><\/p>\n<div>\n        <button id=\"generateBtn\">\u2728 \u062a\u0648\u0644\u06cc\u062f \u062c\u062f\u0648\u0644 \u0645\u0633\u0627\u0628\u0642\u0647<\/button>\n    <\/div>\n<div id=\"output\" class=\"result\"><\/div>\n<\/div>\n<p><script>\n    \/\/ ----- \u062a\u0648\u0627\u0628\u0639 \u06a9\u0645\u06a9\u06cc -----\n    function getBracketSize(n) {\n        let size = 2;\n        while (size < n) size *= 2;\n        return size;\n    }\n\n    \/\/ \u0627\u0644\u06af\u0648\u06cc \u062c\u0627\u06cc\u06af\u0627\u0647\u200c\u0647\u0627 \u0628\u0631 \u0627\u0633\u0627\u0633 \u0631\u062a\u0628\u0647 \u062f\u0631 \u062c\u062f\u0648\u0644 32 \u062a\u0627\u06cc\u06cc\n    function assignSeeds(rankedPlayers, bracketSize) {\n        const n = rankedPlayers.length;\n        const scale = bracketSize \/ 32;\n        \n        \/\/ \u062c\u0627\u06cc\u06af\u0627\u0647\u200c\u0647\u0627\u06cc \u06a9\u0644\u06cc\u062f\u06cc \u062f\u0631 32 \u062a\u0627\u06cc\u06cc\n        const slots32 = {\n            top1: [1],\n            top2: [32],\n            top3_4: [16, 17],\n            top5_8: [8, 9, 24, 25],\n            top9_16: [4, 5, 12, 13, 20, 21, 28, 29]\n        };\n        \n        let assignedPositions = [];\n        let remainingPlayers = [...rankedPlayers];\n        \n        \/\/ \u062a\u0627\u0628\u0639 \u0627\u0636\u0627\u0641\u0647 \u06a9\u0631\u062f\u0646 \u0628\u0627 \u0645\u0642\u06cc\u0627\u0633\n        function addPositions(posArray, count) {\n            let scaled = posArray.map(p => Math.round((p - 1) * scale + 1));\n            scaled = [...new Set(scaled)].sort((a,b)=>a-b);\n            for(let i = 0; i < count &#038;&#038; i < scaled.length; i++) {\n                if (remainingPlayers.length) {\n                    assignedPositions.push({ player: remainingPlayers.shift(), position: scaled[i] });\n                }\n            }\n        }\n        \n        \/\/ \u0627\u0639\u0645\u0627\u0644 \u0642\u0627\u0646\u0648\u0646 \u0633\u06cc\u062f\u0628\u0646\u062f\u06cc\n        if (remainingPlayers.length) addPositions(slots32.top1, 1);\n        if (remainingPlayers.length) addPositions(slots32.top2, 1);\n        if (remainingPlayers.length >= 2) addPositions(slots32.top3_4, 2);\n        if (remainingPlayers.length >= 4) addPositions(slots32.top5_8, 4);\n        if (remainingPlayers.length >= 8) addPositions(slots32.top9_16, 8);<\/p>\n<p>        \/\/ \u0628\u0642\u06cc\u0647 \u062c\u0627\u06cc\u06af\u0627\u0647\u200c\u0647\u0627\u06cc \u0628\u0627\u0642\u06cc\u0645\u0627\u0646\u062f\u0647\n        let allPositions = Array.from({length: bracketSize}, (_,i) => i+1);\n        let usedPositions = assignedPositions.map(item => item.position);\n        let freePositions = allPositions.filter(p => !usedPositions.includes(p));\n        \/\/ \u062a\u0635\u0627\u062f\u0641\u06cc \u0628\u0631\u0627\u06cc \u0628\u0642\u06cc\u0647 \u0646\u0641\u0631\u0627\u062a\n        for (let player of remainingPlayers) {\n            if (freePositions.length === 0) break;\n            let randIndex = Math.floor(Math.random() * freePositions.length);\n            let pos = freePositions[randIndex];\n            assignedPositions.push({ player, position: pos });\n            freePositions.splice(randIndex, 1);\n        }<\/p>\n<p>        \/\/ \u0633\u0627\u062e\u062a \u0622\u0631\u0627\u06cc\u0647 \u0646\u0647\u0627\u06cc\u06cc \u0628\u0647 \u062a\u0631\u062a\u06cc\u0628 \u062c\u0627\u06cc\u06af\u0627\u0647 (1 \u062a\u0627 bracketSize)\n        let finalSlots = Array(bracketSize).fill(null);\n        for (let item of assignedPositions) {\n            finalSlots[item.position - 1] = item.player;\n        }\n        \/\/ \u067e\u0631 \u06a9\u0631\u062f\u0646 \u062e\u0627\u0644\u06cc\u200c\u0647\u0627 \u0628\u0627 \"\u0628\u0627\u06cc\"\n        for (let i = 0; i < bracketSize; i++) {\n            if (!finalSlots[i]) finalSlots[i] = \"\ud83d\udfe2 \u0627\u0633\u062a\u0631\u0627\u062d\u062a (\u0628\u0627\u06cc)\";\n        }\n        return finalSlots;\n    }\n    \n    \/\/ \u0646\u0645\u0627\u06cc\u0634 \u062c\u062f\u0648\u0644 \u0628\u0647 \u0635\u0648\u0631\u062a HTML\n    function renderTable(seededArray) {\n        const size = seededArray.length;\n        let html = `\n\n<h3>\ud83c\udfc6 \u062c\u062f\u0648\u0644 ${size} \u062a\u0627\u06cc\u06cc (\u062a\u06a9 \u062d\u0630\u0641\u06cc \u0628\u0627 \u0633\u06cc\u062f\u0628\u0646\u062f\u06cc)<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u062c\u0627\u06cc\u06af\u0627\u0647<\/th>\n<th>\u0628\u0627\u0632\u06cc\u06a9\u0646 \/ \u0628\u0627\u06cc<\/th>\n<\/tr>\n<\/thead>\n<tbody>`;\n        for (let i = 0; i < size; i++) {\n            let isBye = seededArray[i] === \"\ud83d\udfe2 \u0627\u0633\u062a\u0631\u0627\u062d\u062a (\u0628\u0627\u06cc)\";\n            html += `\n\n<tr class=\"${isBye ? 'bye-row' : ''}\">\n<td class=\"seed-col\">${i+1}<\/td>\n<td>${seededArray[i]}<\/td>\n<\/tr>\n<p>`;\n        }\n        html += `<\/tbody>\n<\/table>\n<p style=\"margin-top:15px; font-size:14px; color:#555;\">\ud83d\udccc <strong>\u0646\u062d\u0648\u0647 \u0645\u0633\u0627\u0628\u0642\u0647:<\/strong> \u062c\u0627\u06cc\u06af\u0627\u0647 1 \u0628\u0627 2\u060c 3 \u0628\u0627 4\u060c ... \u0628\u0631\u0646\u062f\u0647\u200c\u0647\u0627 \u062f\u0631 \u062f\u0648\u0631 \u0628\u0639\u062f \u0628\u0647 \u062a\u0631\u062a\u06cc\u0628 \u0628\u0627 \u0647\u0645 \u0628\u0627\u0632\u06cc \u0645\u06cc\u200c\u06a9\u0646\u0646\u062f. \u0628\u0627\u06cc\u200c\u0647\u0627 \u0628\u062f\u0648\u0646 \u0628\u0627\u0632\u06cc \u0628\u0647 \u062f\u0648\u0631 \u0628\u0639\u062f \u0635\u0639\u0648\u062f \u0645\u06cc\u200c\u06a9\u0646\u0646\u062f.<\/p>\n<p>`;\n        return html;\n    }<\/p>\n<p>    \/\/ \u062a\u0627\u0628\u0639 \u0627\u0635\u0644\u06cc\n    function generateTournament(playersList) {\n        if (!playersList.length) return \"<\/p>\n<p style='color:red'>\u26a0\ufe0f \u062d\u062f\u0627\u0642\u0644 \u06cc\u06a9 \u0646\u0627\u0645 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f.<\/p>\n<p>\";\n        const bracketSize = getBracketSize(playersList.length);\n        const seeded = assignSeeds(playersList, bracketSize);\n        return renderTable(seeded);\n    }<\/p>\n<p>    \/\/ \u0627\u062a\u0635\u0627\u0644 \u0628\u0647 \u062f\u06a9\u0645\u0647\n    document.getElementById('generateBtn').addEventListener('click', function() {\n        const raw = document.getElementById('playersList').value;\n        const lines = raw.split(\/\\r?\\n\/);\n        const players = lines.filter(line => line.trim().length > 0);\n        if (players.length === 0) {\n            document.getElementById('output').innerHTML = \"<\/p>\n<p style='color:red'>\u26a0\ufe0f \u0644\u0637\u0641\u0627\u064b \u062d\u062f\u0627\u0642\u0644 \u06cc\u06a9 \u0646\u0627\u0645 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f.<\/p>\n<p>\";\n            return;\n        }\n        const resultHtml = generateTournament(players);\n        document.getElementById('output').innerHTML = resultHtml;\n    });\n<\/script><br \/>\n<\/body><br \/>\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0633\u0627\u062e\u062a \u062c\u062f\u0648\u0644 \u0645\u0633\u0627\u0628\u0642\u0647 &#8211; \u0633\u06cc\u062f\u0628\u0646\u062f\u06cc \u0647\u0648\u0634\u0645\u0646\u062f \ud83c\udfd3 \u062a\u0648\u0644\u06cc\u062f \u062e\u0648\u062f\u06a9\u0627\u0631 \u062c\u062f\u0648\u0644 \u0645\u0633\u0627\u0628\u0642\u0627\u062a (\u062a\u06a9 \u062d\u0630\u0641\u06cc \u0628\u0627 \u0633\u06cc\u062f\u0628\u0646\u062f\u06cc) \ud83d\udccc \u0631\u0648\u0634 \u06a9\u0627\u0631: 1. \u0627\u0633\u0627\u0645\u06cc \u0646\u0641\u0631\u0627\u062a \u0631\u0627 \u0628\u0647 \u062a\u0631\u062a\u06cc\u0628 \u0631\u062a\u0628\u0647 \u0647\u0641\u062a\u0647 \u0642\u0628\u0644 (\u0627\u0632 \u0642\u0647\u0631\u0645\u0627\u0646 \u0628\u0647 \u0622\u062e\u0631) \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f\u060c \u0647\u0631 \u0646\u0627\u0645 \u062f\u0631 \u06cc\u06a9 \u062e\u0637. 2. \u0631\u0648\u06cc \u062f\u06a9\u0645\u0647 \u00ab\u062a\u0648\u0644\u06cc\u062f \u062c\u062f\u0648\u0644\u00bb \u06a9\u0644\u06cc\u06a9 \u06a9\u0646\u06cc\u062f. 3. \u0633\u06cc\u0633\u062a\u0645 \u0628\u0631 \u0627\u0633\u0627\u0633 \u0642\u0648\u0627\u0646\u06cc\u0646 \u0634\u0645\u0627 (\u0646\u0641\u0631 \u0627\u0648\u0644 \u062c\u0627\u06cc\u06af\u0627\u0647 \u06f1\u060c&hellip;&nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"class_list":["post-88","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ttfasa.ir\/index.php?rest_route=\/wp\/v2\/pages\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ttfasa.ir\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ttfasa.ir\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ttfasa.ir\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ttfasa.ir\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=88"}],"version-history":[{"count":1,"href":"https:\/\/ttfasa.ir\/index.php?rest_route=\/wp\/v2\/pages\/88\/revisions"}],"predecessor-version":[{"id":89,"href":"https:\/\/ttfasa.ir\/index.php?rest_route=\/wp\/v2\/pages\/88\/revisions\/89"}],"wp:attachment":[{"href":"https:\/\/ttfasa.ir\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}