Futbol Açık Arttırma
by DriftBuilder151115 lines50.8 KB
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Futbol Açık Arttırma</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, 'Segoe UI', Arial, sans-serif; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: #0f2027; color: #fff; display: flex; justify-content: center; align-items: center; }
.phone {
width: 375px; height: 667px;
background: linear-gradient(160deg, #1a2a3a, #0f2027);
border-radius: 20px; overflow: hidden; position: relative;
display: flex; flex-direction: column;
box-shadow: 0 0 30px rgba(0,0,0,0.6);
}
@media (max-width: 380px), (max-height: 670px) { .phone { width: 100vw; height: 100vh; border-radius: 0; } }
.topbar {
height: 32px; background: rgba(0,0,0,0.4);
display: flex; align-items: center; padding: 0 8px;
font-size: 11px; gap: 6px; flex-shrink: 0;
}
.topbar .title { flex: 1; text-align: center; font-weight: bold; color: #ffd700; }
.content { flex: 1; overflow: hidden; position: relative; }
.page { position: absolute; inset: 0; padding: 8px; overflow-y: auto; display: none; flex-direction: column; }
.page.active { display: flex; }
.page::-webkit-scrollbar { width: 0; }
.status-row { display: flex; gap: 6px; margin-bottom: 6px; flex-shrink: 0; }
.team-mini {
flex: 1; background: rgba(0,0,0,0.35); border-radius: 8px;
padding: 5px; text-align: center;
border: 2px solid transparent; transition: 0.25s;
}
.team-mini.active { border-color: #ffd700; box-shadow: 0 0 10px #ffd70066; }
.team-mini.interested { border-color: #e74c3c; box-shadow: 0 0 12px #e74c3c88; }
.team-mini .name { font-size: 10px; opacity: 0.85; }
.team-mini .money { font-size: 15px; font-weight: bold; color: #7CFC00; }
.team-mini .cnt { font-size: 9px; opacity: 0.7; }
.interest-tag { font-size: 8px; color: #ff6b6b; font-weight: bold; }
.quiz-screen {
position: absolute; inset: 0; z-index: 6;
background: linear-gradient(160deg, #1a2a3a, #0f2027);
display: flex; flex-direction: column;
padding: 16px; text-align: center;
}
.quiz-title { font-size: 14px; color: #ffd700; margin-bottom: 6px; font-weight: bold; }
.quiz-sub { font-size: 11px; opacity: 0.7; margin-bottom: 14px; }
.quiz-question {
background: rgba(0,0,0,0.4); border-radius: 12px;
padding: 16px 12px; font-size: 14px; font-weight: bold;
line-height: 1.4; margin-bottom: 14px;
border: 1px solid #4a90e2; flex-shrink: 0;
}
.quiz-options { display: flex; flex-direction: column; gap: 8px; flex: 1; justify-content: center; }
.quiz-opt {
padding: 14px; font-size: 13px; font-weight: bold;
background: rgba(74,144,226,0.25);
border: 2px solid #4a90e2; border-radius: 10px;
color: #fff; cursor: pointer; transition: 0.15s;
}
.quiz-opt:active { transform: scale(0.97); }
.quiz-opt.correct { background: #27ae60; border-color: #27ae60; }
.quiz-opt.wrong { background: #c0392b; border-color: #c0392b; }
.quiz-opt:disabled { opacity: 0.6; cursor: default; }
.quiz-feedback { font-size: 14px; font-weight: bold; margin-top: 12px; min-height: 22px; color: #ffd700; }
.player-card {
background: linear-gradient(145deg, #1e3c72, #2a5298);
border-radius: 12px; padding: 10px; text-align: center;
margin-bottom: 6px; border: 1px solid #4a90e2; flex-shrink: 0;
display: flex; align-items: center; gap: 10px; min-height: 110px;
transition: 0.3s;
}
.avatar {
width: 74px; height: 74px; border-radius: 50%;
flex-shrink: 0; display: flex; align-items: center; justify-content: center;
font-size: 26px; font-weight: bold; color: #fff;
border: 3px solid #ffd700; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.card-info { flex: 1; text-align: left; }
.card-info .label { font-size: 9px; letter-spacing: 1px; opacity: 0.7; text-transform: uppercase; }
.card-info .pname { font-size: 17px; font-weight: bold; margin: 2px 0; line-height: 1.1; }
.card-info .pmeta { font-size: 11px; color: #ffd700; }
.card-info .pos-badge {
display: inline-block; padding: 2px 8px; border-radius: 10px;
font-weight: bold; font-size: 10px; margin-top: 4px;
}
.card-info .stat { font-size: 11px; margin-top: 4px; line-height: 1.2; color: #ffe066; font-style: italic; }
.card-info .ai-signal {
font-size: 10px; margin-top: 5px; font-weight: bold;
padding: 2px 6px; border-radius: 6px; display: inline-block;
}
.ai-signal.hot { background: rgba(231,76,60,0.3); color: #ff6b6b; border: 1px solid #e74c3c; }
.ai-signal.warm { background: rgba(241,196,15,0.25); color: #f1c40f; border: 1px solid #f1c40f; }
.ai-signal.cold { background: rgba(127,140,141,0.25); color: #95a5a6; border: 1px solid #7f8c8d; }
.msg { text-align: center; font-size: 12px; font-weight: bold; color: #ffd700; min-height: 16px; margin: 2px 0; }
.countdown-screen {
position: absolute; inset: 0; z-index: 5;
background: rgba(0,0,0,0.92);
display: flex; flex-direction: column;
justify-content: center; align-items: center;
}
.countdown-screen .hint { font-size: 14px; opacity: 0.7; margin-bottom: 12px; }
.countdown-screen .num { font-size: 110px; font-weight: bold; color: #ffd700; text-shadow: 0 0 30px #ffd700; }
.timer-bar { height: 5px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; margin: 4px 0 6px; flex-shrink: 0; }
.timer-fill { height: 100%; background: linear-gradient(90deg, #27ae60, #ffd700, #c0392b); width: 100%; transition: width 0.1s linear; }
.timer-fill.urgent { background: #c0392b; }
.tabs { display: flex; background: rgba(0,0,0,0.35); border-radius: 10px; flex-shrink: 0; margin-bottom: 8px; padding: 4px; gap: 4px; }
.tab {
flex: 1; padding: 14px 8px; text-align: center; font-size: 14px;
font-weight: bold; cursor: pointer; color: #8ab;
border-radius: 8px; transition: 0.2s;
background: rgba(255,255,255,0.05); user-select: none;
}
.tab.active { color: #000; background: #ffd700; box-shadow: 0 2px 10px rgba(255,215,0,0.4); }
.actions { display: flex; gap: 8px; flex-shrink: 0; }
.actions button {
flex: 1; padding: 14px; font-size: 14px; font-weight: bold;
border: none; border-radius: 10px; cursor: pointer; color: #fff;
transition: 0.15s;
}
.actions button:active:not(:disabled) { transform: scale(0.96); }
.actions button:disabled { opacity: 0.35; }
.btn-bid { background: #27ae60; }
.btn-pass { background: #c0392b; }
.actions button.thinking { background: #f39c12 !important; color: #000 !important; }
.team-section { background: rgba(0,0,0,0.3); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.team-section h3 { font-size: 13px; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.team-section h3 .money { color: #7CFC00; font-size: 13px; }
.ai-tag { font-size: 9px; background: #9b59b6; padding: 1px 6px; border-radius: 8px; margin-left: 4px; }
/* 5 kişilik saha: 1 GK, 1 DF, 2 MF, 1 FW */
.pitch {
position: relative; width: 100%; height: 140px;
background: repeating-linear-gradient(90deg, #1a6b3a 0px, #1a6b3a 14px, #17602f 14px, #17602f 28px);
border-radius: 8px; border: 2px solid #0d4a26;
display: grid;
grid-template-columns: 22% 22% 34% 22%;
grid-template-rows: 50% 50%;
gap: 3px; padding: 5px; overflow: hidden;
}
.pitch::before { content: ''; position: absolute; left: 3px; top: 50%; width: 10px; height: 36px; transform: translateY(-50%); border: 2px solid rgba(255,255,255,0.5); border-left: none; border-radius: 0 4px 4px 0; }
.pitch::after { content: ''; position: absolute; right: 3px; top: 50%; width: 10px; height: 36px; transform: translateY(-50%); border: 2px solid rgba(255,255,255,0.5); border-right: none; border-radius: 4px 0 0 4px; }
.pos-slot {
display: flex; align-items: center; justify-content: center;
font-size: 10px; font-weight: bold; border-radius: 6px;
text-align: center; padding: 3px; line-height: 1.05;
color: #fff; overflow: hidden; word-break: break-word;
}
.pos-slot.empty { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.4); border: 1px dashed rgba(255,255,255,0.25); font-weight: normal; }
.pos-slot.filled { box-shadow: 0 2px 8px rgba(0,0,0,0.5); border: 2px solid #ffd700; }
.pos-slot[data-pos="GK"] { background: rgba(241,196,15,0.9); color:#000; }
.pos-slot[data-pos="DF"] { background: rgba(52,152,219,0.9); }
.pos-slot[data-pos="MF"] { background: rgba(46,204,113,0.9); }
.pos-slot[data-pos="FW"] { background: rgba(231,76,60,0.9); }
/* 5 slot pozisyonları */
.slot-gk { grid-column: 1; grid-row: 1 / 3; }
.slot-df { grid-column: 2; grid-row: 1 / 3; }
.slot-mf1 { grid-column: 3; grid-row: 1; }
.slot-mf2 { grid-column: 3; grid-row: 2; }
.slot-fw { grid-column: 4; grid-row: 1 / 3; }
.result-box { text-align: center; padding: 10px; background: rgba(0,0,0,0.4); border-radius: 12px; margin: auto 0; }
.result-box h2 { font-size: 17px; color: #ffd700; margin-bottom: 6px; }
.result-box .row { font-size: 10px; margin: 4px 0; padding: 5px; background: rgba(255,255,255,0.06); border-radius: 6px; text-align: left; }
.result-box .winner { font-size: 16px; color: #ffd700; font-weight: bold; margin: 8px 0; }
.result-box button { padding: 11px 22px; font-size: 14px; font-weight: bold; border: none; border-radius: 10px; background: #f39c12; color: #000; cursor: pointer; margin-top: 6px; }
/* MAÇ SİMÜLASYONU */
.match-score {
background: linear-gradient(145deg, #1e3c72, #2a5298);
border-radius: 12px; padding: 12px; margin: 8px 0;
border: 2px solid #ffd700;
}
.match-score .team-names {
display: flex; justify-content: space-between; align-items: center;
font-size: 12px; font-weight: bold; margin-bottom: 6px;
}
.match-score .score-line {
display: flex; justify-content: space-between; align-items: center;
font-size: 34px; font-weight: bold; color: #ffd700;
font-family: 'Courier New', monospace;
text-shadow: 0 0 12px #ffd70088;
}
.match-score .score-line .vs { font-size: 14px; color: #fff; opacity: 0.5; }
.match-score .event {
font-size: 10px; opacity: 0.85; margin: 2px 0; text-align: left;
padding: 2px 4px; background: rgba(0,0,0,0.2); border-radius: 4px;
}
.match-score .event .min { color: #ffd700; font-weight: bold; }
.match-score .event.right { text-align: right; }
.start-screen {
position: absolute; inset: 0;
background: linear-gradient(160deg, #0f2027, #203a43);
display: flex; flex-direction: column; justify-content: center;
align-items: center; padding: 18px; text-align: center; z-index: 10;
overflow-y: auto;
}
.start-screen h1 { font-size: 20px; color: #ffd700; margin-bottom: 8px; }
.start-screen p { font-size: 11px; opacity: 0.85; line-height: 1.5; margin-bottom: 8px; }
.start-screen .ai-badge { background: rgba(155,89,182,0.3); border: 1px solid #9b59b6; padding: 6px 10px; border-radius: 10px; font-size: 10px; margin-bottom: 8px; line-height: 1.5; }
.start-screen .rules { background: rgba(255,255,255,0.08); border-radius: 8px; padding: 8px 10px; font-size: 11px; margin-bottom: 10px; line-height: 1.6; }
.start-screen button { padding: 14px 32px; font-size: 16px; font-weight: bold; border: none; border-radius: 12px; background: #27ae60; color: #fff; cursor: pointer; }
.hidden { display: none !important; }
</style>
</head>
<body>
<div class="phone">
<div class="start-screen" id="startScreen">
<h1>⚽ Futbol Açık Arttırma</h1>
<p>Sen <b>Takım 1</b>'sin. Rakibin <b>🤖 AI (Takım 2)</b>.</p>
<div class="ai-badge">
🤖 <b>AI Özellikleri</b><br>
• Sadece "inandığı" oyuncuya teklif verir<br>
• Bütçe yönetimi + mevki ihtiyacı<br>
• Quiz bilgisi (65% doğru)
</div>
<div class="rules">
🧠 Her oyuncudan önce <b>futbol quiz</b> sorusu!<br>
⚡ İlk doğru cevap veren <b>önce teklif</b> hakkı kazanır.<br>
💰 Her takımın <b>25 parası</b> var.<br>
👥 <b>5'er oyuncu</b>: 1 Kaleci + 1 Defans + 2 Orta + 1 Forvet.<br>
🏟️ Sonuçta <b>maç simülasyonu</b> — skoru gör!<br>
⏱️ Oyuncu başına <b>10 sn</b> karar süresi.
</div>
<button onclick="startGame()">BAŞLAT</button>
</div>
<div class="topbar">
<span id="tb1">T1: 25💰</span>
<span class="title">⚽ Açık Arttırma</span>
<span id="tb2">🤖 25💰</span>
</div>
<div class="content">
<div class="page active" id="page-bid" style="position:relative;">
<div class="status-row">
<div class="team-mini" id="tm1">
<div class="name">Sen</div>
<div class="money" id="m1">25💰</div>
<div class="cnt" id="c1">0/5</div>
<div class="interest-tag" id="it1"></div>
</div>
<div class="team-mini" id="tm2">
<div class="name">🤖 AI</div>
<div class="money" id="m2">25💰</div>
<div class="cnt" id="c2">0/5</div>
<div class="interest-tag" id="it2"></div>
</div>
</div>
<div class="player-card" id="playerCard">
<div class="avatar" id="pAvatar" style="background:#4a90e2;">?</div>
<div class="card-info">
<div class="label">Sıradaki Oyuncu</div>
<div class="pname" id="pName">-</div>
<div class="pmeta" id="pMeta">-</div>
<div class="pos-badge" id="pPos">-</div>
<div class="stat" id="pStat">-</div>
<div class="ai-signal cold" id="aiSignal">-</div>
</div>
</div>
<div class="msg" id="message">-</div>
<div class="timer-bar"><div class="timer-fill" id="timerFill"></div></div>
<div class="tabs">
<div class="tab active" data-tab="bid" onclick="switchTab('bid')">Teklif</div>
<div class="tab" data-tab="squad" onclick="switchTab('squad')">Kadro</div>
<div class="tab" data-tab="result" onclick="switchTab('result')">Sonuç</div>
</div>
<div class="actions">
<button class="btn-bid" id="bidBtn" onclick="placeBid()">Teklif (+1)</button>
<button class="btn-pass" id="passBtn" onclick="passBid()">Pas Geç</button>
</div>
<div class="countdown-screen hidden" id="countdownScreen">
<div class="hint">Sıradaki oyuncu geliyor...</div>
<div class="num" id="countdownNum">3</div>
</div>
</div>
<div class="page" id="page-squad">
<div class="tabs">
<div class="tab" data-tab="bid" onclick="switchTab('bid')">Teklif</div>
<div class="tab active" data-tab="squad" onclick="switchTab('squad')">Kadro</div>
<div class="tab" data-tab="result" onclick="switchTab('result')">Sonuç</div>
</div>
<div class="team-section">
<h3>Sen (Takım 1) <span class="money" id="sm1">25💰</span></h3>
<div class="pitch" id="pitch1"></div>
</div>
<div class="team-section">
<h3>🤖 AI (Takım 2) <span class="ai-tag">AI</span> <span class="money" id="sm2">25💰</span></h3>
<div class="pitch" id="pitch2"></div>
</div>
</div>
<div class="page" id="page-result">
<div class="tabs">
<div class="tab" data-tab="bid" onclick="switchTab('bid')">Teklif</div>
<div class="tab" data-tab="squad" onclick="switchTab('squad')">Kadro</div>
<div class="tab active" data-tab="result" onclick="switchTab('result')">Sonuç</div>
</div>
<div class="result-box" id="resultBox">
<h2>🏆 Sonuç</h2>
<p style="font-size:12px; opacity:0.7;">Oyun bitince sonuç burada görünecek.</p>
</div>
</div>
<div class="quiz-screen hidden" id="quizScreen">
<div class="quiz-title">🧠 FUTBOL QUIZ</div>
<div class="quiz-sub">İlk doğru cevap veren önce teklif hakkı kazanır!</div>
<div class="quiz-question" id="quizQuestion">-</div>
<div class="quiz-options" id="quizOptions"></div>
<div class="quiz-feedback" id="quizFeedback"></div>
</div>
</div>
</div>
<script>
/* ==================== OYUNCU HAVUZU ==================== */
const PLAYER_POOL = [
{ name: "Lionel Messi", year: 2012, club: "Barcelona", pos: "FW", rating: 99, color: "#c0392b", stat: "2012: 91 gol, 22 asist (tek yıl rekoru)" },
{ name: "Cristiano Ronaldo", year: 2014, club: "Real Madrid",pos: "FW", rating: 98, color: "#2c3e50", stat: "2014: 61 gol, ŞL rekoru" },
{ name: "Ronaldo Nazario", year: 1997, club: "Inter", pos: "FW", rating: 95, color: "#2980b9", stat: "1997: 34 gol, UEFA finali" },
{ name: "Zinedine Zidane", year: 2002, club: "Real Madrid",pos: "MF", rating: 94, color: "#8e44ad", stat: "2002: ŞL finalinde vole golü" },
{ name: "Ronaldinho", year: 2005, club: "Barcelona", pos: "MF", rating: 93, color: "#16a085", stat: "2005: Ballon d'Or, 21 gol" },
{ name: "Thierry Henry", year: 2004, club: "Arsenal", pos: "FW", rating: 92, color: "#c0392b", stat: "2004: 39 gol, namağlup şampiyon" },
{ name: "Kaka", year: 2007, club: "Milan", pos: "MF", rating: 91, color: "#e74c3c", stat: "2007: Ballon d'Or, ŞL şampiyonu" },
{ name: "Andres Iniesta", year: 2010, club: "Barcelona", pos: "MF", rating: 91, color: "#3498db", stat: "2010: Dünya Kupası final golü" },
{ name: "Paolo Maldini", year: 2003, club: "Milan", pos: "DF", rating: 92, color: "#c0392b", stat: "2003: ŞL şampiyonu, 8. finali" },
{ name: "Roberto Carlos", year: 2002, club: "Real Madrid",pos: "DF", rating: 91, color: "#ecf0f1", stat: "2002: ŞL + Dünya Kupası aynı yıl" },
{ name: "Iker Casillas", year: 2010, club: "Real Madrid",pos: "GK", rating: 92, color: "#16a085", stat: "2010: Dünya Kupası, 5 maç gol yemedi" },
{ name: "Gianluigi Buffon", year: 2006, club: "Juventus", pos: "GK", rating: 93, color: "#2980b9", stat: "2006: Dünya Kupası, 1 gol yedi" },
{ name: "Manuel Neuer", year: 2014, club: "Bayern", pos: "GK", rating: 92, color: "#c0392b", stat: "2014: Dünya Kupası, altın eldiven" },
{ name: "Luka Modric", year: 2018, club: "Real Madrid",pos: "MF", rating: 91, color: "#f1c40f", stat: "2018: Ballon d'Or, ŞL şampiyonu" },
{ name: "Kevin De Bruyne", year: 2020, club: "Man City", pos: "MF", rating: 92, color: "#3498db", stat: "2020: 13 asist, PL şampiyonu" },
{ name: "Sergio Ramos", year: 2015, club: "Real Madrid",pos: "DF", rating: 91, color: "#c0392b", stat: "2015: 92. dakika final golü" },
{ name: "Zlatan Ibrahimovic",year: 2013, club: "PSG", pos: "FW", rating: 92, color: "#9b59b6", stat: "2013: 30 gol, Ligue 1 şampiyonu" },
{ name: "Samuel Eto'o", year: 2009, club: "Barcelona", pos: "FW", rating: 91, color: "#e67e22", stat: "2009: Treble, final golü" },
{ name: "Claude Makélélé", year: 2005, club: "Chelsea", pos: "MF", rating: 88, color: "#2980b9", stat: "2005: 'Makélélé rolü' literatüre girdi" },
{ name: "Gennaro Gattuso", year: 2007, club: "Milan", pos: "MF", rating: 87, color: "#c0392b", stat: "2007: ŞL şampiyonu, sahanın pitbulu" },
{ name: "Giovanni van Bronckhorst", year: 2010, club: "Feyenoord", pos: "DF", rating: 85, color: "#e74c3c", stat: "2010: Dünya Kupası finali, uzaktan füze" },
{ name: "Massimo Oddo", year: 2007, club: "Milan", pos: "DF", rating: 82, color: "#e74c3c", stat: "2007: ŞL finali, sağ kanat" },
{ name: "Christian Karembeu",year: 1998, club: "Real Madrid",pos: "MF", rating: 84, color: "#7f8c8d", stat: "1998: Dünya Kupası + ŞL aynı yıl" },
{ name: "Youri Djorkaeff", year: 1998, club: "Inter", pos: "MF", rating: 86, color: "#2c3e50", stat: "1998: Dünya Kupası şampiyonu" },
{ name: "Emmanuel Petit", year: 1998, club: "Arsenal", pos: "MF", rating: 86, color: "#c0392b", stat: "1998: Dünya Kupası finalinde gol" },
{ name: "Dida", year: 2003, club: "Milan", pos: "GK", rating: 87, color: "#f1c40f", stat: "2003: ŞL şampiyonu, penaltı kahramanı" },
{ name: "Julio Cesar", year: 2010, club: "Inter", pos: "GK", rating: 88, color: "#f1c40f", stat: "2010: Treble, ŞL şampiyonu" },
{ name: "Diego Milito", year: 2010, club: "Inter", pos: "FW", rating: 88, color: "#2980b9", stat: "2010: ŞL finalinde 2 gol" },
{ name: "Wesley Sneijder", year: 2010, club: "Inter", pos: "MF", rating: 90, color: "#e67e22", stat: "2010: Treble, Dünya Kupası finali" },
{ name: "Arjen Robben", year: 2013, club: "Bayern", pos: "FW", rating: 91, color: "#c0392b", stat: "2013: ŞL finalinde galibiyet golü" },
{ name: "Franck Ribery", year: 2013, club: "Bayern", pos: "MF", rating: 91, color: "#c0392b", stat: "2013: Treble, Ballon d'Or 3.'sü" },
{ name: "Bastian Schweinsteiger", year: 2014, club: "Bayern",pos: "MF", rating: 89, color: "#e74c3c", stat: "2014: Dünya Kupası finali, kanlar içinde" },
{ name: "Philipp Lahm", year: 2014, club: "Bayern", pos: "DF", rating: 90, color: "#e74c3c", stat: "2014: Dünya Kupası kaptanı" },
{ name: "Miroslav Klose", year: 2014, club: "Lazio", pos: "FW", rating: 87, color: "#3498db", stat: "2014: Dünya Kupası gol rekoru (16)" },
{ name: "Carles Puyol", year: 2009, club: "Barcelona", pos: "DF", rating: 89, color: "#8e44ad", stat: "2009: 6 kupa, ŞL finali kaptan" },
{ name: "Xavi", year: 2011, club: "Barcelona", pos: "MF", rating: 90, color: "#e67e22", stat: "2011: 3 kupa, ŞL finali asist" },
{ name: "Gerard Pique", year: 2011, club: "Barcelona", pos: "DF", rating: 89, color: "#8e44ad", stat: "2011: ŞL finali, 3 kupa" },
{ name: "David Villa", year: 2010, club: "Barcelona", pos: "FW", rating: 89, color: "#e74c3c", stat: "2010: Dünya Kupası gol kralı adayı" },
{ name: "Fernando Torres", year: 2008, club: "Liverpool", pos: "FW", rating: 88, color: "#c0392b", stat: "2008: Euro 2008 final golü" },
{ name: "Steven Gerrard", year: 2005, club: "Liverpool", pos: "MF", rating: 90, color: "#c0392b", stat: "2005: İstanbul mucizesi kaptanı" },
{ name: "Frank Lampard", year: 2006, club: "Chelsea", pos: "MF", rating: 90, color: "#2980b9", stat: "2006: 20 gol (orta saha rekoru)" },
{ name: "Didier Drogba", year: 2010, club: "Chelsea", pos: "FW", rating: 90, color: "#2980b9", stat: "2010: 37 gol, altın krampon" },
{ name: "Petr Cech", year: 2008, club: "Chelsea", pos: "GK", rating: 90, color: "#27ae60", stat: "2008: ŞL finali, 21 maç gol yemedi" },
{ name: "Edwin van der Sar", year: 2008, club: "Man United", pos: "GK", rating: 89, color: "#27ae60", stat: "2008: ŞL, 1311 dk gol yemedi" },
{ name: "Wayne Rooney", year: 2008, club: "Man United", pos: "FW", rating: 90, color: "#e74c3c", stat: "2008: ŞL şampiyonu, 16 gol" },
{ name: "Roy Keane", year: 1999, club: "Man United", pos: "MF", rating: 88, color: "#e74c3c", stat: "1999: Treble kaptanı" },
{ name: "David Beckham", year: 2001, club: "Man United", pos: "MF", rating: 88, color: "#e74c3c", stat: "2001: Serbest vuruş ustası" },
{ name: "Alessandro Nesta", year: 2003, club: "Milan", pos: "DF", rating: 89, color: "#c0392b", stat: "2003: ŞL, kaya gibi defans" },
{ name: "Andrea Pirlo", year: 2007, club: "Milan", pos: "MF", rating: 91, color: "#e74c3c", stat: "2007: ŞL şampiyonu, final asist" },
{ name: "Cafu", year: 2002, club: "Roma", pos: "DF", rating: 90, color: "#f1c40f", stat: "2002: Dünya Kupası kaptanı" },
{ name: "Fabio Cannavaro", year: 2006, club: "Juventus", pos: "DF", rating: 90, color: "#2c3e50", stat: "2006: Dünya Kupası + Ballon d'Or" },
{ name: "Patrick Vieira", year: 2002, club: "Arsenal", pos: "MF", rating: 89, color: "#c0392b", stat: "2002: Double, 34 maç yenilmedi" },
{ name: "Luis Figo", year: 2000, club: "Real Madrid",pos: "MF", rating: 90, color: "#2c3e50", stat: "2000: Ballon d'Or, tartışmalı transfer" },
{ name: "Rivaldo", year: 1999, club: "Barcelona", pos: "MF", rating: 89, color: "#2980b9", stat: "1999: Ballon d'Or, 24 gol" },
{ name: "Lilian Thuram", year: 1998, club: "Parma", pos: "DF", rating: 88, color: "#f1c40f", stat: "1998: Dünya Kupası, 2 yarı final golü" },
{ name: "Nicolas Anelka", year: 1999, club: "Arsenal", pos: "FW", rating: 84, color: "#7f8c8d", stat: "1999: 17 gol, genç yetenek" },
{ name: "Mario Balotelli", year: 2012, club: "Man City", pos: "FW", rating: 83, color: "#e74c3c", stat: "2012: 'Why always me?' derbi golü" },
{ name: "Robinho", year: 2008, club: "Man City", pos: "FW", rating: 85, color: "#3498db", stat: "2008: İngiltere rekoru transfer" },
{ name: "Robin van Persie", year: 2013, club: "Man United", pos: "FW", rating: 89, color: "#e74c3c", stat: "2013: 26 gol, PL şampiyonu" },
{ name: "Antonio Cassano", year: 2010, club: "Sampdoria", pos: "FW", rating: 84, color: "#2980b9", stat: "2010: Yetenek + kaos karışımı" },
{ name: "Adriano", year: 2005, club: "Inter", pos: "FW", rating: 88, color: "#2980b9", stat: "2005: 28 gol, fiziksel canavar" },
{ name: "Deco", year: 2004, club: "Porto", pos: "MF", rating: 88, color: "#2980b9", stat: "2004: ŞL şampiyonu, Mourinho'nun beyni" },
{ name: "Ricardo Carvalho", year: 2004, club: "Porto", pos: "DF", rating: 88, color: "#2980b9", stat: "2004: ŞL şampiyonu, defans lideri" },
{ name: "Maniche", year: 2004, club: "Porto", pos: "MF", rating: 85, color: "#2980b9", stat: "2004: ŞL yarı final golü" },
{ name: "Benni McCarthy", year: 2004, club: "Porto", pos: "FW", rating: 84, color: "#2980b9", stat: "2004: ŞL şampiyonu, 2 gol" },
{ name: "Jerzy Dudek", year: 2005, club: "Liverpool", pos: "GK", rating: 86, color: "#c0392b", stat: "2005: İstanbul'da penaltı kahramanı" },
{ name: "Djibril Cisse", year: 2005, club: "Liverpool", pos: "FW", rating: 84, color: "#c0392b", stat: "2005: ŞL şampiyonu, hızlı forvet" },
{ name: "Vladimir Smicer", year: 2005, club: "Liverpool", pos: "MF", rating: 83, color: "#c0392b", stat: "2005: ŞL finalinde gol, son maçı" },
{ name: "Dietmar Hamann", year: 2005, club: "Liverpool", pos: "MF", rating: 84, color: "#c0392b", stat: "2005: İstanbul'da oyunu değiştirdi" },
{ name: "Hernan Crespo", year: 2005, club: "Milan", pos: "FW", rating: 88, color: "#c0392b", stat: "2005: ŞL finalinde 2 gol attı ama..." },
{ name: "Andriy Shevchenko", year: 2004, club: "Milan", pos: "FW", rating: 91, color: "#c0392b", stat: "2004: Ballon d'Or, 24 gol" },
{ name: "Pavel Nedved", year: 2003, club: "Juventus", pos: "MF", rating: 90, color: "#2c3e50", stat: "2003: Ballon d'Or, ŞL finali kaçırdı" },
{ name: "Alessandro Del Piero", year: 2006, club: "Juventus",pos: "FW", rating: 90, color: "#2c3e50", stat: "2006: Dünya Kupası, yarı final golü" },
{ name: "Francesco Totti", year: 2006, club: "Roma", pos: "FW", rating: 91, color: "#c0392b", stat: "2006: Dünya Kupası, penaltı golü" }
];
const QUIZ_QUESTIONS = [
{ q: "2005 ŞL finalinde Liverpool 3-0'dan sonra kaç dakikada 3 gol attı?", opts: ["6 dakika", "10 dakika", "15 dakika", "20 dakika"], ans: 0 },
{ q: "2014 Dünya Kupası'nda Almanya finalde kimi yendi?", opts: ["Brezilya", "Arjantin", "Hollanda", "Fransa"], ans: 1 },
{ q: "Messi 2012'de bir takvim yılında kaç gol attı?", opts: ["73", "79", "86", "91"], ans: 3 },
{ q: "Zidane 2006 Dünya Kupası finalinde kime kafa attı?", opts: ["Cannavaro", "Materazzi", "Gattuso", "Pirlo"], ans: 1 },
{ q: "Ronaldinho hangi yıl Ballon d'Or kazandı?", opts: ["2003", "2004", "2005", "2006"], ans: 2 },
{ q: "Roberto Carlos hangi yıl ŞL ve Dünya Kupası'nı aynı yıl kazandı?", opts: ["1998", "2000", "2002", "2004"], ans: 2 },
{ q: "Buffon 2006 Dünya Kupası'nda kaç gol yedi?", opts: ["0", "1", "2", "3"], ans: 1 },
{ q: "Iniesta 2010 Dünya Kupası finalinde golü kaçıncı dakikada attı?", opts: ["90", "105", "116", "120"], ans: 2 },
{ q: "Modric hangi yıl Ballon d'Or kazandı?", opts: ["2016", "2017", "2018", "2019"], ans: 2 },
{ q: "Cristiano Ronaldo 2014'te kaç gol attı?", opts: ["51", "56", "61", "66"], ans: 2 },
{ q: "Kaka Ballon d'Or'u hangi yıl kazandı?", opts: ["2005", "2006", "2007", "2008"], ans: 2 },
{ q: "Drogba 2010'da kaç gol attı (Premier Lig)?", opts: ["29", "32", "37", "40"], ans: 2 },
{ q: "Makélélé hangi takımda 'Makélélé rolü' kavramını yarattı?", opts: ["Real Madrid", "Chelsea", "PSG", "Marseille"], ans: 1 },
{ q: "Klose kaç Dünya Kupası golü attı (rekor)?", opts: ["14", "15", "16", "17"], ans: 2 },
{ q: "Pirlo hangi takımla 2007'de ŞL kazandı?", opts: ["Inter", "Juventus", "Milan", "Roma"], ans: 2 },
{ q: "Beckham hangi yıl Real Madrid'e transfer oldu?", opts: ["2001", "2002", "2003", "2004"], ans: 2 },
{ q: "Samuel Eto'o 2009'da hangi takımla treble kazandı?", opts: ["Real Madrid", "Barcelona", "Inter", "Chelsea"], ans: 1 },
{ q: "2004'te Porto ŞL'yi kazandı. Teknik direktörü kimdi?", opts: ["Guardiola", "Mourinho", "Ancelotti", "Ferguson"], ans: 1 },
{ q: "Cannavaro 2006'da Ballon d'Or kazanan tek defans. Hangi takımdan?", opts: ["Milan", "Inter", "Juventus", "Roma"], ans: 2 },
{ q: "Van der Sar 2008'de kaç dakika gol yemedi (rekor)?", opts: ["1000", "1111", "1311", "1500"], ans: 2 },
{ q: "Nedved 2003'te hangi takımla ŞL finali oynadı?", opts: ["Juventus", "Lazio", "Roma", "Inter"], ans: 0 },
{ q: "Totti kariyerini hangi takımda geçirdi?", opts: ["Milan", "Inter", "Roma", "Lazio"], ans: 2 },
{ q: "Shevchenko 2004'te Ballon d'Or'u hangi takımdayken kazandı?", opts: ["Dynamo Kiev", "Milan", "Chelsea", "Inter"], ans: 1 },
{ q: "Lahm 2014'te Dünya Kupası'nı kaptan olarak kaldırdı. Hangi takımdan?", opts: ["Bayern", "Dortmund", "Schalke", "Stuttgart"], ans: 0 },
{ q: "2013 ŞL finali Bayern-Dortmund. Galibiyet golünü kim attı?", opts: ["Müller", "Robben", "Ribery", "Mandzukic"], ans: 1 },
{ q: "2002 Dünya Kupası'nda Ronaldo kaç gol attı?", opts: ["6", "7", "8", "9"], ans: 2 }
];
const POS_TR = { GK: "Kaleci", DF: "Defans", MF: "Orta", FW: "Forvet" };
const BUDGET = 25;
const BID_TIME = 10;
let state = {};
let countdownInterval = null;
let timerInterval = null;
let timeLeft = 0;
let usedQuizQuestions = [];
function startGame() {
const shuffled = [...PLAYER_POOL].sort(() => Math.random() - 0.5).slice(0, 10);
usedQuizQuestions = [];
state = {
teams: {
1: { money: BUDGET, players: [], name: "Sen", isAI: false, out: false },
2: { money: BUDGET, players: [], name: "AI", isAI: true, out: false }
},
pool: shuffled,
poolIndex: 0,
currentTeam: 1,
currentBid: 0,
bidder: null,
aiThinking: false,
quizFirstBidder: 1,
aiConfidence: 0,
aiMaxBid: 0,
aiInterestLevel: "cold"
};
document.getElementById("startScreen").classList.add("hidden");
renderPitches();
updateAllUI();
showQuiz();
}
/* ==================== AI GÜVEN SKORU ==================== */
function aiCalculateConfidence(player, team) {
const roster = team.players;
const money = team.money;
const remainingPlayersToBuy = 5 - roster.length;
const remainingPool = state.pool.length - state.poolIndex;
const posCount = { GK: 0, DF: 0, MF: 0, FW: 0 };
roster.forEach(p => posCount[p.pos]++);
// 5 kişilik ideal: 1 GK, 1 DF, 2 MF, 1 FW
const ideal = { GK: 1, DF: 1, MF: 2, FW: 1 };
const needRatio = posCount[player.pos] / ideal[player.pos];
const needScore = needRatio === 0 ? 100 : (needRatio < 1 ? 80 : 40);
const gkBonus = (player.pos === "GK" && posCount.GK === 0) ? 15 : 0;
const ratingScore = Math.max(0, Math.min(100, (player.rating - 78) * 5));
const avgBudget = money / Math.max(remainingPlayersToBuy, 1);
const fairPrice = (player.rating - 78) * 0.55 + 1;
const budgetFit = avgBudget >= fairPrice ? 100 : (avgBudget / fairPrice) * 100;
const yearBonus = player.rating >= 88 && player.rating <= 92 ? 8 : 0;
const scarcityBonus = remainingPool <= 3 ? 10 : (remainingPool <= 5 ? 5 : 0);
const score = (
needScore * 0.35 +
ratingScore * 0.30 +
budgetFit * 0.20 +
gkBonus + yearBonus + scarcityBonus
);
return Math.max(0, Math.min(100, score));
}
/* ==================== QUIZ ==================== */
function showQuiz() {
checkOutTeams();
if (bothOut()) { endGame(); return; }
if (state.poolIndex >= state.pool.length) { endGame(); return; }
let available = QUIZ_QUESTIONS.map((_, i) => i).filter(i => !usedQuizQuestions.includes(i));
if (available.length === 0) { usedQuizQuestions = []; available = QUIZ_QUESTIONS.map((_, i) => i); }
const qIdx = available[Math.floor(Math.random() * available.length)];
usedQuizQuestions.push(qIdx);
const quiz = QUIZ_QUESTIONS[qIdx];
const screen = document.getElementById("quizScreen");
screen.classList.remove("hidden");
document.getElementById("quizQuestion").textContent = quiz.q;
document.getElementById("quizFeedback").textContent = "";
const optsEl = document.getElementById("quizOptions");
optsEl.innerHTML = "";
quiz.opts.forEach((opt, i) => {
const btn = document.createElement("button");
btn.className = "quiz-opt";
btn.textContent = opt;
btn.onclick = () => answerQuiz(i, quiz.ans, optsEl);
optsEl.appendChild(btn);
});
state.quizAnswered = false;
const aiDelay = 1500 + Math.random() * 2500;
state.aiQuizTimer = setTimeout(() => {
if (state.quizAnswered) return;
aiAnswerQuiz(quiz.ans, optsEl);
}, aiDelay);
}
function answerQuiz(chosen, correct, optsEl) {
if (state.quizAnswered) return;
state.quizAnswered = true;
clearTimeout(state.aiQuizTimer);
const buttons = optsEl.querySelectorAll(".quiz-opt");
buttons.forEach((b, i) => {
b.disabled = true;
if (i === correct) b.classList.add("correct");
else if (i === chosen) b.classList.add("wrong");
});
const fb = document.getElementById("quizFeedback");
if (chosen === correct) {
fb.textContent = "✅ Doğru! Sen önce teklif hakkı kazandın.";
state.quizFirstBidder = 1;
} else {
fb.textContent = `❌ Yanlış! Doğru cevap: ${buttons[correct].textContent}. AI önce teklif hakkı kazandı.`;
state.quizFirstBidder = 2;
}
setTimeout(() => {
document.getElementById("quizScreen").classList.add("hidden");
state.currentTeam = state.quizFirstBidder;
startCountdown();
}, 1800);
}
function aiAnswerQuiz(correct, optsEl) {
if (state.quizAnswered) return;
state.quizAnswered = true;
const aiCorrect = Math.random() < 0.65;
let aiChoice = correct;
if (!aiCorrect) {
const wrongs = [0,1,2,3].filter(i => i !== correct);
aiChoice = wrongs[Math.floor(Math.random() * wrongs.length)];
}
const buttons = optsEl.querySelectorAll(".quiz-opt");
buttons.forEach((b, i) => {
b.disabled = true;
if (i === correct) b.classList.add("correct");
else if (i === aiChoice) b.classList.add("wrong");
});
const fb = document.getElementById("quizFeedback");
if (aiCorrect) {
fb.textContent = "🤖 AI doğru cevap verdi! AI önce teklif hakkı kazandı.";
state.quizFirstBidder = 2;
} else {
fb.textContent = `🤖 AI yanlış cevap verdi! Sen önce teklif hakkı kazandın.`;
state.quizFirstBidder = 1;
}
setTimeout(() => {
document.getElementById("quizScreen").classList.add("hidden");
state.currentTeam = state.quizFirstBidder;
startCountdown();
}, 1800);
}
/* ==================== GERİ SAYIM ==================== */
function startCountdown() {
const screen = document.getElementById("countdownScreen");
const numEl = document.getElementById("countdownNum");
screen.classList.remove("hidden");
let n = 3;
numEl.textContent = n;
countdownInterval = setInterval(() => {
n--;
if (n > 0) {
numEl.textContent = n;
} else {
clearInterval(countdownInterval);
screen.classList.add("hidden");
loadNextPlayer();
}
}, 700);
}
/* ==================== TAKIM DURUMU ==================== */
function checkOutTeams() {
[1,2].forEach(id => {
const t = state.teams[id];
if (t.players.length >= 5) t.out = true;
if (t.money < 1) t.out = true;
});
}
function bothOut() { return state.teams[1].out && state.teams[2].out; }
/* ==================== OYUNCU YÜKLE ==================== */
function loadNextPlayer() {
checkOutTeams();
if (bothOut()) { endGame(); return; }
if (state.poolIndex >= state.pool.length) { endGame(); return; }
const player = state.pool[state.poolIndex];
state.currentPlayer = player;
state.currentBid = 0;
state.bidder = null;
state.aiThinking = false;
// AI güven skoru
const conf = aiCalculateConfidence(player, state.teams[2]);
state.aiConfidence = conf;
let interest = "cold";
if (conf >= 70) interest = "hot";
else if (conf >= 55) interest = "warm";
state.aiInterestLevel = interest;
// AI max teklif
const money = state.teams[2].money;
const remaining = 5 - state.teams[2].players.length;
const avgBudget = money / Math.max(remaining, 1);
if (interest === "hot") {
state.aiMaxBid = Math.min(
Math.floor(money * 0.55),
Math.floor((player.rating - 78) * 0.7 + avgBudget * 0.4 + 3)
);
} else if (interest === "warm") {
state.aiMaxBid = Math.min(
Math.floor(money * 0.35),
Math.floor((player.rating - 78) * 0.4 + 1)
);
} else {
state.aiMaxBid = 0;
}
// Sıra quiz kazananına
let starter = state.quizFirstBidder;
if (state.teams[starter].out) starter = starter === 1 ? 2 : 1;
if (state.teams[starter].out) {
state.poolIndex++;
setTimeout(showQuiz, 300);
return;
}
state.currentTeam = starter;
const initials = player.name.split(" ").map(w => w[0]).join("").slice(0, 2).toUpperCase();
const av = document.getElementById("pAvatar");
av.textContent = initials;
av.style.background = player.color;
document.getElementById("pName").textContent = player.name;
document.getElementById("pMeta").textContent = `${player.year} • ${player.club}`;
document.getElementById("pPos").textContent = POS_TR[player.pos];
document.getElementById("pStat").textContent = "⭐ " + player.stat;
const sig = document.getElementById("aiSignal");
sig.classList.remove("hot", "warm", "cold");
if (interest === "hot") {
sig.classList.add("hot");
sig.textContent = "🔥 AI bu oyuncuya çok inanıyor — kapışacak!";
} else if (interest === "warm") {
sig.classList.add("warm");
sig.textContent = "⚡ AI kararsız — belki teklif verir";
} else {
sig.classList.add("cold");
sig.textContent = "❄️ AI bu oyuncuya inanmıyor — pas geçecek";
}
const card = document.getElementById("playerCard");
const colors = { GK: "#b8860b", DF: "#1f6fa8", MF: "#1f8a4c", FW: "#b0362a" };
card.style.borderColor = colors[player.pos];
document.getElementById("pPos").style.background = colors[player.pos];
document.getElementById("pPos").style.color = "#fff";
updateAllUI();
setMessage(`Sıra: ${teamLabel(state.currentTeam)}`);
if (!state.teams[state.currentTeam].isAI) {
startBidTimer();
} else {
document.getElementById("timerFill").style.width = "100%";
setTimeout(aiTurn, 1000);
}
}
function teamLabel(id) {
return state.teams[id].isAI ? "🤖 AI" : "Sen";
}
/* ==================== ZAMANLAYICI ==================== */
function startBidTimer() {
clearInterval(timerInterval);
timeLeft = BID_TIME;
const fill = document.getElementById("timerFill");
fill.classList.remove("urgent");
fill.style.width = "100%";
timerInterval = setInterval(() => {
timeLeft -= 0.1;
const pct = Math.max(0, (timeLeft / BID_TIME) * 100);
fill.style.width = pct + "%";
if (timeLeft <= 3) fill.classList.add("urgent");
if (timeLeft <= 0) {
clearInterval(timerInterval);
autoPass();
}
}, 100);
}
function stopTimer() {
clearInterval(timerInterval);
document.getElementById("timerFill").style.width = "100%";
document.getElementById("timerFill").classList.remove("urgent");
}
/* ==================== KULLANICI ==================== */
function placeBid() {
if (state.currentTeam !== 1 || state.aiThinking) return;
const nextBid = state.currentBid + 1;
if (state.teams[1].money < nextBid) { setMessage(`Paran yetmiyor!`); return; }
if (state.teams[1].players.length >= 5) { setMessage(`Kadron dolu!`); return; }
stopTimer();
state.currentBid = nextBid;
state.bidder = 1;
setMessage(`Sen ${nextBid}💰 teklif ettin.`);
if (state.teams[2].out) { sellPlayer(); return; }
state.currentTeam = 2;
updateAllUI();
setTimeout(aiTurn, 1200);
}
function passBid() {
if (state.currentTeam !== 1 || state.aiThinking) return;
stopTimer();
if (state.bidder === null) {
setMessage(`Pas geçtin. Oyuncu satılmadı.`);
state.poolIndex++;
updateAllUI();
setTimeout(showQuiz, 700);
return;
}
sellPlayer();
}
function autoPass() {
if (state.currentTeam !== 1) return;
setMessage("⏰ Süre doldu! Otomatik pas.");
passBid();
}
/* ==================== AI KARAR ==================== */
function aiTurn() {
if (state.currentTeam !== 2) return;
if (state.teams[2].out || state.teams[2].players.length >= 5 || state.teams[2].money < 1) {
state.currentTeam = 1;
updateAllUI();
setMessage("🤖 AI çekildi. Sıra: Sen");
startBidTimer();
return;
}
state.aiThinking = true;
updateAllUI();
setMessage("🤖 AI düşünüyor...");
setTimeout(() => {
state.aiThinking = false;
if (state.aiInterestLevel === "cold" || state.aiMaxBid === 0) {
handleAiPass("bu oyuncuya inanmıyor");
return;
}
const nextBid = state.currentBid + 1;
if (nextBid > state.aiMaxBid || nextBid > state.teams[2].money) {
handleAiPass("bütçe limiti");
return;
}
if (state.aiInterestLevel === "warm" && state.bidder === 1) {
handleAiPass("kararsız, çekiliyor");
return;
}
state.currentBid = nextBid;
state.bidder = 2;
setMessage(`🤖 AI ${nextBid}💰 teklif etti.`);
if (state.teams[1].out) { sellPlayer(); return; }
state.currentTeam = 1;
updateAllUI();
startBidTimer();
}, 700 + Math.random() * 600);
}
function handleAiPass(reason) {
if (state.bidder === 1) {
setMessage(`🤖 AI pas geçti (${reason}).`);
sellPlayer();
} else {
setMessage(`🤖 AI da pas geçti. Oyuncu satılmadı.`);
state.poolIndex++;
updateAllUI();
setTimeout(showQuiz, 800);
}
}
/* ==================== SATIŞ ==================== */
function sellPlayer() {
stopTimer();
const buyer = state.bidder;
const price = state.currentBid;
const player = state.currentPlayer;
if (buyer === null) { state.poolIndex++; updateAllUI(); setTimeout(showQuiz, 500); return; }
state.teams[buyer].money -= price;
state.teams[buyer].players.push({ ...player, price });
setMessage(`${teamLabel(buyer)} ${player.name}'i ${price}💰 aldı!`);
state.poolIndex++;
renderPitches();
updateAllUI();
setTimeout(() => {
checkOutTeams();
if (bothOut()) endGame();
else if (state.poolIndex >= state.pool.length) endGame();
else showQuiz();
}, 1100);
}
/* ==================== UI ==================== */
function updateAllUI() {
const t1 = state.teams[1], t2 = state.teams[2];
document.getElementById("m1").textContent = t1.money + "💰";
document.getElementById("m2").textContent = t2.money + "💰";
document.getElementById("c1").textContent = t1.players.length + "/5" + (t1.out ? " ❌" : "");
document.getElementById("c2").textContent = t2.players.length + "/5" + (t2.out ? " ❌" : "");
document.getElementById("tb1").textContent = "T1: " + t1.money + "💰";
document.getElementById("tb2").textContent = "🤖 " + t2.money + "💰";
document.getElementById("sm1").textContent = t1.money + "💰" + (t1.out ? " (çekildi)" : "");
document.getElementById("sm2").textContent = t2.money + "💰" + (t2.out ? " (çekildi)" : "");
document.getElementById("tm1").classList.toggle("active", state.currentTeam === 1 && !state.aiThinking);
document.getElementById("tm2").classList.toggle("active", state.currentTeam === 2 || state.aiThinking);
document.getElementById("tm2").classList.toggle("interested", state.aiInterestLevel === "hot");
const it2 = document.getElementById("it2");
if (state.poolIndex < state.pool.length) {
if (state.aiInterestLevel === "hot") it2.textContent = "🔥 İLGİLİ";
else if (state.aiInterestLevel === "warm") it2.textContent = "⚡ KARARSIZ";
else it2.textContent = "";
}
const myTurn = state.currentTeam === 1 && !state.aiThinking && !state.teams[1].out && state.poolIndex < state.pool.length;
const canBid = myTurn && state.teams[1].money >= state.currentBid + 1
&& state.teams[1].players.length < 5;
const bidBtn = document.getElementById("bidBtn");
bidBtn.disabled = !canBid;
bidBtn.textContent = `Teklif (${state.currentBid + 1}💰)`;
document.getElementById("passBtn").disabled = !myTurn;
if (state.aiThinking) {
bidBtn.classList.add("thinking");
bidBtn.textContent = "🤖 AI düşünüyor...";
} else {
bidBtn.classList.remove("thinking");
}
}
function setMessage(txt) { document.getElementById("message").textContent = txt; }
function switchTab(name) {
document.querySelectorAll(".tab").forEach(t => t.classList.toggle("active", t.dataset.tab === name));
document.querySelectorAll(".page").forEach(p => p.classList.toggle("active", p.id === "page-" + name));
}
/* ==================== SAHA (5 SLOT) ==================== */
const SLOT_LAYOUT = [
{ cls: "slot-gk", pos: "GK" },
{ cls: "slot-df", pos: "DF" },
{ cls: "slot-mf1", pos: "MF" },
{ cls: "slot-mf2", pos: "MF" },
{ cls: "slot-fw", pos: "FW" }
];
function renderTeamPitch(teamId) {
const el = document.getElementById("pitch" + teamId);
const players = [...state.teams[teamId].players];
const byPos = { GK: [], DF: [], MF: [], FW: [] };
players.forEach(p => byPos[p.pos] && byPos[p.pos].push(p));
el.innerHTML = "";
SLOT_LAYOUT.forEach(slot => {
const p = byPos[slot.pos].shift();
const div = document.createElement("div");
div.className = "pos-slot " + slot.cls;
if (p) {
div.classList.add("filled");
div.dataset.pos = p.pos;
const surname = p.name.split(" ").slice(-1)[0];
div.innerHTML = `<div>${surname}<br><span style="font-size:9px;opacity:0.85">${p.year}</span></div>`;
} else {
div.classList.add("empty");
div.textContent = POS_TR[slot.pos];
}
el.appendChild(div);
});
}
function renderPitches() {
renderTeamPitch(1);
renderTeamPitch(2);
}
/* ==================== MAÇ SİMÜLASYONU ==================== */
/* İki takımın mevki bazlı gücünü hesapla, gol at, skoru belirle */
function simulateMatch(t1, t2) {
// Mevki güçleri
const powerOf = (players, pos) => {
const arr = players.filter(p => p.pos === pos);
if (arr.length === 0) return 50; // mevki yoksa zayıf
return arr.reduce((a,p) => a + p.rating, 0) / arr.length;
};
const t1Gk = powerOf(t1.players, "GK");
const t1Df = powerOf(t1.players, "DF");
const t1Mf = powerOf(t1.players, "MF");
const t1Fw = powerOf(t1.players, "FW");
const t2Gk = powerOf(t2.players, "GK");
const t2Df = powerOf(t2.players, "DF");
const t2Mf = powerOf(t2.players, "MF");
const t2Fw = powerOf(t2.players, "FW");
// Atak gücü (forvet + orta saha)
const t1Atk = (t1Fw * 0.6 + t1Mf * 0.4);
const t2Atk = (t2Fw * 0.6 + t2Mf * 0.4);
// Savunma gücü (defans + kaleci)
const t1Def = (t1Df * 0.5 + t1Gk * 0.5);
const t2Def = (t2Df * 0.5 + t2Gk * 0.5);
// Gol beklentisi (Poisson benzeri)
const baseGoals = 2.5;
const t1Expected = Math.max(0, baseGoals * (t1Atk / (t1Atk + t2Def)) * 2);
const t2Expected = Math.max(0, baseGoals * (t2Atk / (t2Atk + t1Def)) * 2);
// Rastgelelik ekle
const rand = () => {
let u = 0, v = 0;
while(u === 0) u = Math.random();
while(v === 0) v = Math.random();
return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
};
let s1 = Math.max(0, Math.round(t1Expected + rand() * 1.2));
let s2 = Math.max(0, Math.round(t2Expected + rand() * 1.2));
// Üst sınır (max 6 gol)
s1 = Math.min(s1, 6);
s2 = Math.min(s2, 6);
// Gol dakikaları ve atanlar
const events = [];
const scorers = (t, count) => {
const candidates = t.players.filter(p => p.pos === "FW" || p.pos === "MF");
const pool = candidates.length ? candidates : t.players;
const arr = [];
for (let i = 0; i < count; i++) {
const p = pool[Math.floor(Math.random() * pool.length)];
arr.push(p);
}
return arr;
};
const t1Scorers = scorers(t1, s1);
const t2Scorers = scorers(t2, s2);
t1Scorers.forEach(p => {
events.push({ min: 1 + Math.floor(Math.random() * 90), team: 1, player: p });
});
t2Scorers.forEach(p => {
events.push({ min: 1 + Math.floor(Math.random() * 90), team: 2, player: p });
});
events.sort((a, b) => a.min - b.min);
return { s1, s2, events, t1Atk, t2Atk, t1Def, t2Def };
}
/* ==================== SONUÇ ==================== */
function endGame() {
stopTimer();
switchTab("result");
const t1 = state.teams[1], t2 = state.teams[2];
const s1 = avg(t1.players), s2 = avg(t2.players);
const b1 = formationBonus(t1.players), b2 = formationBonus(t2.players);
const total1 = s1 + b1, total2 = s2 + b2;
// Maç simülasyonu
const match = simulateMatch(t1, t2);
const fmt = (t, s, b, total) => `
<div class="row">
<b>${t.name}</b> — Ort: ${s.toFixed(1)} | Bonus: +${b} | <b style="color:#7CFC00">Toplam: ${total.toFixed(1)}</b><br>
<span style="font-size:9px;opacity:0.75">${t.players.map(p => p.name + " (" + POS_TR[p.pos] + ")").join(", ") || "Oyuncu yok"}</span>
</div>`;
let winner, winnerColor;
if (match.s1 > match.s2) { winner = "🏆 SEN KAZANDIN!"; winnerColor = "#27ae60"; }
else if (match.s2 > match.s1) { winner = "🤖 AI KAZANDI!"; winnerColor = "#c0392b"; }
else { winner = "🤝 BERABERE!"; winnerColor = "#f39c12"; }
// Gol olayları HTML
let eventsHtml = "";
match.events.forEach(e => {
const teamName = e.team === 1 ? "Sen" : "AI";
const cls = e.team === 1 ? "" : "right";
const surname = e.player.name.split(" ").slice(-1)[0];
const icon = e.player.pos === "FW" ? "⚽" : "🎯";
eventsHtml += `<div class="event ${cls}"><span class="min">${e.min}'</span> ${icon} <b>${surname}</b> <span style="opacity:0.6">(${teamName})</span></div>`;
});
if (!eventsHtml) eventsHtml = `<div class="event" style="text-align:center;opacity:0.6;">Gol olmadı — sıkıcı maç!</div>`;
document.getElementById("resultBox").innerHTML = `
<h2>🏆 Maç Sonucu</h2>
<div class="match-score">
<div class="team-names">
<span>Sen</span>
<span style="opacity:0.5">MAÇ</span>
<span>🤖 AI</span>
</div>
<div class="score-line">
<span>${match.s1}</span>
<span class="vs">-</span>
<span>${match.s2}</span>
</div>
</div>
<div style="max-height:100px;overflow-y:auto;margin-bottom:6px;">${eventsHtml}</div>
<div class="winner" style="color:${winnerColor}">${winner}</div>
${fmt(t1, s1, b1, total1)}
${fmt(t2, s2, b2, total2)}
<button onclick="location.reload()">TEKRAR OYNA</button>
`;
}
function avg(players) {
if (!players.length) return 0;
return players.reduce((a, p) => a + p.rating, 0) / players.length;
}
function formationBonus(players) {
const set = new Set(players.map(p => p.pos));
return set.size * 2;
}
</script>
</body>
</html>Game Source: Futbol Açık Arttırma
Creator: DriftBuilder15
Libraries: none
Complexity: complex (1115 lines, 50.8 KB)
The full source code is displayed above on this page.
Remix Instructions
To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: futbol-a-k-artt-rma-driftbuilder15-mum20fjj" to link back to the original. Then publish at arcadelab.ai/publish.