Skip to content

Commit cc06e43

Browse files
committed
feat: add pitch game
1 parent 3019660 commit cc06e43

File tree

3 files changed

+566
-0
lines changed

3 files changed

+566
-0
lines changed

pitch/index.html

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<!DOCTYPE html>
2+
<html lang="es">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Pitchear.la</title>
8+
<link rel="stylesheet" href="styles.css">
9+
<link rel="shortcut icon" href="../favicon.png" />
10+
</head>
11+
12+
<body>
13+
<div class="main-container">
14+
<div class="header">
15+
<img src="../images/SYSARMY_logo-01.png" alt="Sysarmy Logo" class="logo">
16+
<h1>🐂 Pitcheala</h1>
17+
<h2>#AdminBirras 🍺</h2>
18+
<h3>¡Un juego para emprendedores chantas!</h3>
19+
</div>
20+
21+
<div class="startup-display">
22+
<div id="startup-name" class="startup-name">
23+
<p>- - - - -</p>
24+
</div>
25+
</div>
26+
27+
<div class="game-controls">
28+
<button id="generate-btn" class="generate-button">
29+
Generar startup
30+
</button>
31+
32+
<div id="timer-display" class="timer-display hidden">
33+
<div class="timer-circle">
34+
<span id="countdown-number">30</span>
35+
</div>
36+
<p class="timer-label">¡Pitcheala!</p>
37+
</div>
38+
39+
<div id="game-over" class="game-over hidden">
40+
<h2>¡Fin!</h2>
41+
<p>¿Conseguiste inversores?</p>
42+
</div>
43+
</div>
44+
45+
<div class="instructions">
46+
<h3>¿Cómo se juega?</h3>
47+
<ol>
48+
<li>Apretá en "Generar startup"</li>
49+
<li>Acabás de fundar una empresa. Tenés 22 segundos. <strong>¡Vendela!</strong></li>
50+
<li>El resto dice si invertiría o no</li>
51+
</ol>
52+
</div>
53+
54+
<div class="footer">
55+
<p>Hecho con <3 por <a href="https://sysarmy.com" target="_blank">Sysarmy</a>
56+
inspirado en <a href="https://github.com/dcts/bullpitch" target="_blank">Bullpitch</a></p>
57+
</div>
58+
</div>
59+
60+
<script src="main.js"></script>
61+
</body>
62+
63+
</html>

pitch/main.js

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
const techPrefixes = [
2+
"Monolito",
3+
"Cloud",
4+
"Data",
5+
"AI",
6+
"Crypto",
7+
"Serverless",
8+
"DevOps",
9+
"Kube",
10+
"Token",
11+
"Mainframe",
12+
"PHP",
13+
"Wordpress",
14+
"API",
15+
"CI",
16+
"Deploy",
17+
"Git",
18+
"Scrum",
19+
"Clave",
20+
"Front",
21+
"JS",
22+
];
23+
24+
const argentineSuffixes = [
25+
"ify",
26+
"App",
27+
"Tech",
28+
"AR",
29+
"Plus",
30+
"Max",
31+
"Soft",
32+
"verse",
33+
"Go",
34+
"pe",
35+
"udo",
36+
"ear",
37+
"izar",
38+
"ocha",
39+
"ardo",
40+
"ucha",
41+
"ón",
42+
".ar",
43+
];
44+
45+
const argentineWords = [
46+
"Choreo",
47+
"Curro",
48+
"Chamuyo",
49+
"Quilombo",
50+
"Asado",
51+
"Birra",
52+
"Mate",
53+
"Bondi",
54+
"Laburo",
55+
"Pibe",
56+
"Verso",
57+
"Factura",
58+
"AFIP",
59+
"CUIL",
60+
"Impuesto",
61+
"Tango",
62+
"Token",
63+
];
64+
65+
66+
// DOM elements
67+
const generateBtn = document.getElementById('generate-btn');
68+
const startupNameEl = document.getElementById('startup-name');
69+
const timerDisplay = document.getElementById('timer-display');
70+
const countdownNumber = document.getElementById('countdown-number');
71+
const gameOverDisplay = document.getElementById('game-over');
72+
73+
// Game state
74+
let gameState = 'ready'; // 'ready', 'pitching', 'finished'
75+
let countdownInterval;
76+
let currentStartupName = '';
77+
let usedNames = new Set();
78+
79+
// Utility functions
80+
const getRandomElement = (array) => {
81+
return array[Math.floor(Math.random() * array.length)];
82+
};
83+
84+
const capitalizeFirst = (str) => {
85+
return str.charAt(0).toUpperCase() + str.slice(1);
86+
};
87+
88+
const generateUniqueStartupName = () => {
89+
let attempts = 0;
90+
let name;
91+
92+
do {
93+
const prefix = getRandomElement(techPrefixes);
94+
const suffix = getRandomElement([...argentineSuffixes, ...argentineWords]);
95+
96+
name = `${prefix}${suffix}`;
97+
98+
attempts++;
99+
100+
// Prevent infinite loop
101+
if (attempts > 100) {
102+
usedNames.clear();
103+
break;
104+
}
105+
} while (usedNames.has(name));
106+
107+
usedNames.add(name);
108+
return name;
109+
};
110+
111+
const displayStartupName = (name) => {
112+
startupNameEl.innerHTML = `<p>${name}</p>`;
113+
startupNameEl.classList.add('active', 'fade-in');
114+
115+
// Remove animation class after animation completes
116+
setTimeout(() => {
117+
startupNameEl.classList.remove('fade-in');
118+
}, 500);
119+
};
120+
121+
const resetDisplay = () => {
122+
startupNameEl.innerHTML = '<p>- - - - -</p>';
123+
startupNameEl.classList.remove('active');
124+
timerDisplay.classList.add('hidden');
125+
gameOverDisplay.classList.add('hidden');
126+
generateBtn.disabled = false;
127+
generateBtn.textContent = 'Generar Startup';
128+
};
129+
130+
const startCountdown = () => {
131+
let timeLeft = 22;
132+
countdownNumber.textContent = timeLeft;
133+
timerDisplay.classList.remove('hidden');
134+
135+
const timerCircle = document.querySelector('.timer-circle');
136+
timerCircle.classList.add('pulse');
137+
138+
countdownInterval = setInterval(() => {
139+
timeLeft--;
140+
countdownNumber.textContent = timeLeft;
141+
142+
// Add urgency animation in last 10 seconds
143+
if (timeLeft <= 10) {
144+
timerCircle.style.background = 'linear-gradient(45deg, #ff4757, #ff6b6b)';
145+
}
146+
147+
// Add final countdown animation in last 5 seconds
148+
if (timeLeft <= 5) {
149+
timerCircle.classList.add('pulse');
150+
countdownNumber.style.color = '#ff4757';
151+
}
152+
153+
if (timeLeft <= 0) {
154+
clearInterval(countdownInterval);
155+
endGame();
156+
}
157+
}, 1000);
158+
};
159+
160+
const endGame = () => {
161+
gameState = 'finished';
162+
timerDisplay.classList.add('hidden');
163+
gameOverDisplay.classList.remove('hidden');
164+
generateBtn.disabled = false;
165+
generateBtn.textContent = 'Generar nueva startup';
166+
167+
// Reset timer circle styles
168+
const timerCircle = document.querySelector('.timer-circle');
169+
timerCircle.classList.remove('pulse');
170+
timerCircle.style.background = 'linear-gradient(45deg, #ff6b6b, #ff8e8e)';
171+
countdownNumber.style.color = '#ff6b6b';
172+
};
173+
174+
const startGame = () => {
175+
if (gameState === 'ready' || gameState === 'finished') {
176+
// Reset everything
177+
resetDisplay();
178+
179+
// Generate and display new startup name
180+
currentStartupName = generateUniqueStartupName();
181+
displayStartupName(currentStartupName);
182+
183+
// Start countdown
184+
gameState = 'pitching';
185+
generateBtn.disabled = true;
186+
generateBtn.textContent = 'Pitching...';
187+
188+
setTimeout(() => {
189+
startCountdown();
190+
}, 1000); // Wait 1 second before starting countdown
191+
}
192+
};
193+
194+
// Event listeners
195+
generateBtn.addEventListener('click', startGame);

0 commit comments

Comments
 (0)