|
238 | 238 | /* |
239 | 239 | Godel's Gauntlet is an impossible game due to self-referencing of the player's position. |
240 | 240 | You must win by contradicting the coded rules of the game and changing the source code. |
241 | | - (Or for the lazy peek at the source code.) This game is a playful take on Godel's incompleteness |
242 | | - theorems. To join my semi-secret math hacker club, please dm me the answer to the following riddle: |
| 241 | + (Or for the lazy peek at the source code.) To join my semi-secret math hacker club, |
| 242 | + please dm me the answer to the following riddle: |
243 | 243 | |
244 | 244 | When you measure how I rise over time, you are just measuring me, what am I? |
245 | 245 | */ |
|
256 | 256 | }, 1000); |
257 | 257 | } |
258 | 258 |
|
| 259 | + // Get canvas width |
| 260 | + var canvasWidth = canvas.width; |
| 261 | + |
| 262 | + // Calculate font size based on canvas width |
| 263 | + var welcomeFontSize = canvasWidth * 0.05; // Adjust the multiplier to get a suitable font size |
| 264 | + var instructionFontSize = canvasWidth * 0.03; // Adjust the multiplier to get a suitable font size |
| 265 | + |
| 266 | + // Ensure the font size is not too small or too large |
| 267 | + welcomeFontSize = Math.max(Math.min(welcomeFontSize, 36), 18); // limit the font size between 18px and 36px |
| 268 | + instructionFontSize = Math.max(Math.min(instructionFontSize, 24), 12); // limit the font size between 12px and 24px |
| 269 | + |
259 | 270 | // Draw the welcome text |
260 | 271 | ctx.fillStyle = "#AA6C39"; // or any color you prefer |
261 | | - ctx.font = "36px Arial"; // size and font face |
| 272 | + ctx.font = welcomeFontSize + "px Arial"; // size and font face |
262 | 273 | ctx.textAlign = "center"; // alignment |
263 | 274 | ctx.fillText("Welcome to Gödel's Gauntlet", canvas.width/2, 110); // text and position |
264 | 275 |
|
265 | 276 | // Draw the instruction text |
266 | | - ctx.font = "24px Arial"; // size and font face |
| 277 | + ctx.font = instructionFontSize + "px Arial"; // size and font face |
267 | 278 | ctx.textAlign = "center"; // alignment |
268 | 279 | ctx.fillStyle = "#7E909A"; // or any color you prefer |
269 | 280 | ctx.fillText("Click to move the circle towards the keyhole", canvas.width/2, 150); // text and position |
|
0 commit comments