From 52607271b5ed070b6733137f28832b20ddf876cc Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Tue, 18 Feb 2025 15:18:54 +1100 Subject: [PATCH 1/2] DEV: complex artifact update --- artifact/assets/css_replace/instructions.txt | 248 +++++++++++++++++++ artifact/assets/css_replace/main.css | 204 +++++++++++++++ artifact/assets/css_replace/main.html | 114 +++++++++ artifact/assets/css_replace/main.js | 87 +++++++ artifact/css_replace.yml | 10 + 5 files changed, 663 insertions(+) create mode 100644 artifact/assets/css_replace/instructions.txt create mode 100644 artifact/assets/css_replace/main.css create mode 100644 artifact/assets/css_replace/main.html create mode 100644 artifact/assets/css_replace/main.js create mode 100644 artifact/css_replace.yml diff --git a/artifact/assets/css_replace/instructions.txt b/artifact/assets/css_replace/instructions.txt new file mode 100644 index 0000000..c595a1d --- /dev/null +++ b/artifact/assets/css_replace/instructions.txt @@ -0,0 +1,248 @@ +Update the CSS with a brutalist design. Replace the current CSS with: + +```css +:root { + --primary: #ff0000; + --secondary: #000000; + --accent: #0000ff; + --background: #ffffff; + --text: #000000; +} + +@font-face { + font-family: 'Courier Prime'; + src: url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&display=swap'); +} + +body { + margin: 0; + background: var(--background); + font-family: 'Courier Prime', monospace; + color: var(--text); + overflow: hidden; + cursor: crosshair; +} + +#presentation-container { + width: 100vw; + height: 100vh; + position: relative; + background: #ffffff; + border: 8px solid black; + box-sizing: border-box; +} + +.scanlines { + display: none; +} + +.slides-wrapper { + position: relative; + width: 90%; + height: 85%; + margin: 2% auto; + border: 4px solid black; +} + +.slide { + position: absolute; + width: 100%; + height: 100%; + opacity: 0; + transition: all 0.2s steps(5); + padding: 40px; + box-sizing: border-box; + background: #ffffff; + display: flex; + flex-direction: column; + overflow: hidden; +} + +.slide::before { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 20px; + background: #000000; +} + +.slide.active { + opacity: 1; + transform: translateX(0) rotate(0deg); +} + +.slide:not(.active) { + transform: translateX(100%) rotate(2deg); +} + +.grid-background { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-image: + linear-gradient(#000 1px, transparent 1px), + linear-gradient(90deg, #000 1px, transparent 1px); + background-size: 50px 50px; + opacity: 0.1; + z-index: -1; +} + +h1 { + color: var(--text); + font-size: 5rem; + margin: 60px 0 40px; + text-transform: uppercase; + font-weight: 900; + line-height: 0.9; + transform: scaleY(1.2); + text-align: left; + border-bottom: 8px solid black; + padding-bottom: 20px; +} + +h2 { + color: var(--text); + font-size: 3.5rem; + margin: 40px 0; + text-transform: uppercase; + font-weight: 900; + transform: scaleY(1.1); + border-left: 20px solid var(--primary); + padding-left: 20px; +} + +ul { + list-style: none; + padding: 0; + margin: 40px 0; +} + +li { + margin: 30px 0; + padding: 15px; + position: relative; + font-size: 1.8rem; + line-height: 1.4; + background: #ffffff; + border: 3px solid black; + transform: skew(-2deg); + transition: transform 0.3s; +} + +li:hover { + transform: skew(0deg) scale(1.02); + background: #000; + color: #fff; +} + +li::before { + content: '►'; + position: absolute; + left: -30px; + color: var(--primary); + font-size: 1.2rem; +} + +.controls { + position: fixed; + bottom: 40px; + left: 50%; + transform: translateX(-50%); + display: flex; + gap: 30px; + align-items: center; + background: #ffffff; + padding: 20px; + border: 4px solid black; +} + +button { + background: #ffffff; + border: 4px solid black; + color: var(--text); + font-family: 'Courier Prime', monospace; + padding: 15px 30px; + cursor: pointer; + text-transform: uppercase; + font-size: 1.2rem; + font-weight: bold; + transition: all 0.2s; + transform: skew(-5deg); +} + +button:hover { + background: #000000; + color: #ffffff; + transform: skew(-5deg) scale(1.1); +} + +.digital-clock { + position: fixed; + top: 20px; + right: 20px; + font-size: 1.5rem; + color: var(--text); + background: #ffffff; + padding: 15px; + border: 4px solid black; + font-family: 'Courier Prime', monospace; + transform: rotate(2deg); +} + +.progress { + font-family: 'Courier Prime', monospace; + font-size: 2rem; + font-weight: bold; + background: #000; + color: #fff; + padding: 10px 20px; + transform: skew(-5deg); +} + +.retro-logo { + margin-top: auto; + font-size: 2rem; + letter-spacing: 4px; + text-align: right; + padding: 20px; + border-top: 4px solid black; + transform: skew(-2deg); + font-weight: bold; +} + +@media (max-width: 768px) { + h1 { font-size: 3rem; } + h2 { font-size: 2.5rem; } + li { font-size: 1.2rem; } + .controls { width: 90%; } +} + +/* Add visual noise effect */ +.slide::after { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyBAMAAADsEZWCAAAAElBMVEUAAAD8/vz08vT09PT0+PT///+e9DmyAAAABXRSTlMAGhslIyZ8Y1EAAAA1SURBVDjLY2AYBaNg2AJGYQgQlIdwmCFcBzgXyuVFcEVhXEe4EARQxQWRxUmTH1Jy+XADALaqEf6SJ0OFAAAAAElFTkSuQmCC"); + opacity: 0.03; + pointer-events: none; +} +``` + +This brutalist design features: +1. High contrast black and white base +2. Bold, geometric shapes +3. Raw, unpolished aesthetics +4. Aggressive typography +5. Intentionally skewed elements +6. Thick borders and stark lines +7. Minimal color usage (only for emphasis) +8. Unconventional layout choices +9. Visible grid systems +10. Interactive elements with dramatic transformations \ No newline at end of file diff --git a/artifact/assets/css_replace/main.css b/artifact/assets/css_replace/main.css new file mode 100644 index 0000000..0a83e54 --- /dev/null +++ b/artifact/assets/css_replace/main.css @@ -0,0 +1,204 @@ +:root { + --primary: #2dd4bf; + --secondary: #f472b6; + --accent: #818cf8; + --dark-bg: #0f172a; + --text: #e2e8f0; + --surface: #1e293b; +} + +body { + margin: 0; + background: var(--dark-bg); + font-family: 'Inter', 'VT323', sans-serif; + color: var(--text); + overflow: hidden; +} + +#presentation-container { + width: 100vw; + height: 100vh; + position: relative; + perspective: 1000px; + background: linear-gradient(135deg, var(--dark-bg) 0%, #1e1b4b 100%); +} + +.scanlines { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: linear-gradient( + to bottom, + rgba(255,255,255,0.02) 50%, + rgba(0,0,0,0.02) 50% + ); + background-size: 100% 4px; + pointer-events: none; + z-index: 100; +} + +.slides-wrapper { + position: relative; + width: 80%; + height: 80%; + margin: 5% auto; + transform-style: preserve-3d; +} + +.slide { + position: absolute; + width: 100%; + height: 100%; + opacity: 0; + transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); + padding: 40px; + box-sizing: border-box; + background: var(--surface); + border-radius: 12px; + box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); + backdrop-filter: blur(8px); + display: flex; + flex-direction: column; +} + +.slide.active { + opacity: 1; + transform: scale(1); +} + +.slide:not(.active) { + transform: scale(0.95); +} + +.grid-background { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-image: + linear-gradient(var(--primary) 1px, transparent 1px), + linear-gradient(90deg, var(--primary) 1px, transparent 1px); + background-size: 40px 40px; + opacity: 0.05; + transform: perspective(1000px) rotateX(60deg); + z-index: -1; +} + +h1 { + color: var(--primary); + font-size: 3.5rem; + text-shadow: 0 0 20px rgba(45, 212, 191, 0.5); + margin-bottom: 40px; + letter-spacing: -1px; +} + +h2 { + color: var(--secondary); + font-size: 2.5rem; + margin-bottom: 40px; + letter-spacing: -0.5px; +} + +ul { + list-style: none; + padding: 0; +} + +li { + margin: 20px 0; + padding-left: 30px; + position: relative; + font-size: 1.25rem; + line-height: 1.6; +} + +li:before { + content: '⚡'; + position: absolute; + left: 0; + color: var(--accent); +} + +.controls { + position: fixed; + bottom: 40px; + left: 50%; + transform: translateX(-50%); + display: flex; + gap: 20px; + align-items: center; + background: var(--surface); + padding: 12px 24px; + border-radius: 100px; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); +} + +button { + background: transparent; + border: 2px solid var(--primary); + color: var(--primary); + font-family: 'Inter', sans-serif; + padding: 8px 16px; + cursor: pointer; + text-transform: uppercase; + transition: all 0.3s ease; + border-radius: 100px; + font-size: 0.875rem; + font-weight: 600; + letter-spacing: 0.5px; +} + +button:hover { + background: var(--primary); + color: var(--dark-bg); + transform: translateY(-1px); + box-shadow: 0 4px 12px rgba(45, 212, 191, 0.3); +} + +.digital-clock { + position: fixed; + top: 20px; + right: 20px; + font-size: 1rem; + color: var(--primary); + background: var(--surface); + padding: 8px 16px; + border-radius: 8px; + font-family: 'VT323', monospace; +} + +.progress { + color: var(--secondary); + font-size: 1.25rem; + font-weight: 600; +} + +.retro-logo { + margin-top: auto; + color: var(--accent); + font-size: 1.25rem; + letter-spacing: 2px; + text-align: center; + padding: 20px; +} + +.slide h1, .slide h2, .slide li { + opacity: 0; + transform: translateY(20px); + transition: all 0.5s ease; + transition-delay: 0.2s; +} + +.slide.active h1, +.slide.active h2, +.slide.active li { + opacity: 1; + transform: translateY(0); +} + +.slide li { + transition-delay: calc(0.2s + var(--i, 0) * 0.1s); +} \ No newline at end of file diff --git a/artifact/assets/css_replace/main.html b/artifact/assets/css_replace/main.html new file mode 100644 index 0000000..baf8974 --- /dev/null +++ b/artifact/assets/css_replace/main.html @@ -0,0 +1,114 @@ +
+
+
+
+

Scythian Hemp Steam Rituals

+ +
+
+ +
+

Introduction to Scythians

+
    +
  • Nomadic warriors of the Eurasian steppes
  • +
  • 4th century BCE to 2nd century CE
  • +
  • Masters of horseback riding
  • +
  • Complex ritual practices
  • +
+
+ +
+

Historical Context

+
    +
  • Iron Age civilization (900-200 BCE)
  • +
  • Vast territory from Black Sea to Mongolia
  • +
  • Advanced metallurgy and craftsmanship
  • +
  • Rich archaeological evidence
  • +
+
+ +
+

Hemp in Scythian Culture

+
    +
  • Sacred plant in religious ceremonies
  • +
  • Documented by Herodotus (484-425 BCE)
  • +
  • Multiple practical and ritual uses
  • +
  • Archaeological remains found in tombs
  • +
+
+ +
+

The Steam Ritual Setup

+
    +
  • Felt-covered framework structure
  • +
  • Three supporting poles arrangement
  • +
  • Heated stones preparation
  • +
  • Hemp seeds collection and storage
  • +
+
+ +
+

Ritual Process

+
    +
  • Placement of heated stones
  • +
  • Hemp seeds scattered on stones
  • +
  • Steam and smoke production
  • +
  • Collective ritual participation
  • +
+
+ +
+

Archaeological Evidence

+
    +
  • Tripods and braziers found
  • +
  • Hemp seed remains in burial sites
  • +
  • Felt tent remnants discovered
  • +
  • Ceremonial vessels preserved
  • +
+
+ +
+

Cultural Significance

+
    +
  • Spiritual and social bonding
  • +
  • Purification ceremonies
  • +
  • Warrior tradition integration
  • +
  • Knowledge transmission ritual
  • +
+
+ +
+

Modern Interpretations

+
    +
  • Archaeological reconstructions
  • +
  • Anthropological analysis
  • +
  • Contemporary scholarly debate
  • +
  • Cultural heritage implications
  • +
+
+ +
+

Conclusions

+
    +
  • Sophisticated ritual practices
  • +
  • Advanced technological knowledge
  • +
  • Cultural continuity evidence
  • +
  • Historical significance preserved
  • +
+ +
+
+ +
+ +
+ 1/10 +
+ +
+ +
88:88:88
+
+ + + \ No newline at end of file diff --git a/artifact/assets/css_replace/main.js b/artifact/assets/css_replace/main.js new file mode 100644 index 0000000..eac53f5 --- /dev/null +++ b/artifact/assets/css_replace/main.js @@ -0,0 +1,87 @@ +class Presentation { + constructor() { + this.currentSlide = 1; + this.totalSlides = 10; + this.slides = document.querySelectorAll('.slide'); + this.prevBtn = document.querySelector('.prev-btn'); + this.nextBtn = document.querySelector('.next-btn'); + this.currentDisplay = document.querySelector('.current'); + this.initialize(); + } + + initialize() { + this.bindEvents(); + this.updateClock(); + this.updateProgress(); + document.addEventListener('keydown', (e) => this.handleKeyNavigation(e)); + } + + bindEvents() { + this.prevBtn.addEventListener('click', () => this.previousSlide()); + this.nextBtn.addEventListener('click', () => this.nextSlide()); + document.addEventListener('click', (e) => { + if (e.target.tagName !== 'BUTTON') { + this.nextSlide(); + } + }); + } + + updateClock() { + const clock = document.querySelector('.digital-clock'); + setInterval(() => { + const now = new Date(); + clock.textContent = now.toLocaleTimeString('en-US', { + hour12: false, + hour: '2-digit', + minute: '2-digit', + second: '2-digit' + }); + }, 1000); + } + + updateProgress() { + this.currentDisplay.textContent = this.currentSlide; + } + + goToSlide(number) { + this.slides.forEach(slide => slide.classList.remove('active')); + this.slides[number - 1].classList.add('active'); + this.currentSlide = number; + this.updateProgress(); + this.playTransitionSound(); + } + + nextSlide() { + if (this.currentSlide < this.totalSlides) { + this.goToSlide(this.currentSlide + 1); + } + } + + previousSlide() { + if (this.currentSlide > 1) { + this.goToSlide(this.currentSlide - 1); + } + } + + handleKeyNavigation(e) { + switch(e.key) { + case 'ArrowRight': + case 'Space': + this.nextSlide(); + break; + case 'ArrowLeft': + this.previousSlide(); + break; + } + } + + playTransitionSound() { + const audio = new Audio('data:audio/wav;base64,UklGRnoGAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQoGAACBhYqFbF1QOi0hGBEPCwQBAQMFCg8YIjA6RlNfaXN8gIKCgn9/fn19fX19fn+BgoSGhVpRRjYoIRkSDwwHAgEBAwUJDhckLTY/S1djaXN5foGDg4J/f35+fn5+f4CBg4WGhlxSTzsuJBwUEQ0IBwMCAQIEBwwRGiUuOEVQW2Vud3yAgoKCgIB/f39/f4CBgoSFg35XTkYyKSIbFBEOCQYDAgECBAYLEBgkLTdDT1pmb3d9gYKCgoGAf39/f4CAgYOEhYN+WE9HMykiGxQRDgkGAwIBAgQGCxAYJC03Q09aZm93fYGCgoKBgH9/f3+AgIGDhIWDflhPRzMpIhsUEQ4JBgMCAQIEBgsQGCQtN0NPWmZvd32BgoKCgYB/f39/gICBg4SFg35XTkYyKSIbFBEOCQYDAgECBAYLEBgkLTdDT1pmb3d9gYKCgoGAf39/f4CAgYOEhIJ9V05GMikiGxQRDgkGAwIBAgQGCxAYJC03Q09aZm93fIGCgoKBgH9/f3+AgIGDhISCfVdORjIpIhsUEQ4JBgMCAQIEBgsQGCQtN0NPWmZvd3yBgoKCgYB/f39/gICBg4SEgn1XTkYyKSIbFBEOCQYDAgECBAYLEBgkLTdDT1pmb3d8gYKCgoGAf39/f4CAgYOEhIJ9V05GMikiGxQRDgkGAwIBAgQGCxAYJC03Q09aZm93fIGCgoKBgH9/f3+AgIGDhISCfVdORjIpIhsUEQ4JBgMCAQIEBgsQGCQtN0NPWmZvd3yBgoKCgYB/f39/gICBg4SEgn1XTkYyKSIbFBEOCQYDAgECBAYLEBgkLTdDT1pmb3d8gYKCgoGAf39/f4CAgYOEhIJ9V05GMikiGxQRDgkGAwIBAgQGCxAYJC03Q09aZm93fIGCgoKBgH9/f3+AgIGDhISCfVdORjIpIhsUEQ4JBgMCAQIEBgsQGCQtN0NPWmZvd3yBgoKCgYB/f39/gICBg4SEgn1XTkYyKSIbFBEOCQYDAgECBAYLEBgkLTdDT1pmb3d8gYKCgoGAf39/f4CAgYOEhIJ9V05GMikiGxQRDgkGAwIBAgQGCxAYJC03Q09aZm93fIGCgoKBgH9/f3+AgIGDhISCfVdORjIpIhsUEQ4JBgMCAQIEBgsQGCQtN0NPWmZvd3yBgoKCgYB/f39/gICBg4SEgn1XTkYyKSIbFBEOCQYDAgECBAYLEBgkLTdDT1pmb3d8gYKCgoGAf39/f4CAgYOEhIJ9V05GMikiGxQRDgkGAwIBAgQGCxAYJC03Q09aZm93fIGCgoKBgH9/f3+AgIGDhISCfVdORjIpIhsUEQ4JBgMCAQIEBgsQGCQtN0NPWmZvd3yBgoKCgYB/f39/gICBg4SEgn1XTkYyKSIbFBEOCQYDAgECBAYLEBgkLTdDT1pmb3d8gYKCgoGAf39/f4CAgYOEhIJ9V05GMikiGxQRDgkGAwIBAgQGCxAYJC03Q09aZm93fIGCgoKBgH9/f3+AgIGDhISCfVdORjIpIhsUEQ4JBgMCAQIEBgsQGCQtN0NPWmZvd3yBgoKCgYB/f39/gICBg4SEgn0='); + audio.volume = 0.2; + audio.play().catch(() => {}); + } +} + +document.addEventListener('DOMContentLoaded', () => { + const presentation = new Presentation(); +}); \ No newline at end of file diff --git a/artifact/css_replace.yml b/artifact/css_replace.yml new file mode 100644 index 0000000..74d033d --- /dev/null +++ b/artifact/css_replace.yml @@ -0,0 +1,10 @@ +id: css_replace_artifact +name: CSS Replace +description: Replace a large chunk of CSS in an artifact +type: edit_artifact +args: + css_path: "assets/css_replace/main.css" + js_path: "assets/css_replace/main.js" + html_path: "assets/css_replace/main.html" + instructions_path: "assets/css_replace/instructions.txt" +expected_output_regex: "transform: skew\\(-5deg\\);" From 34e238de972429a80d264c7de3433b3c0dc9cd75 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Wed, 19 Feb 2025 14:30:03 +1100 Subject: [PATCH 2/2] more evals --- artifact/assets/astroids/instructions.txt | 17 + artifact/assets/astroids/main.css | 25 + artifact/assets/astroids/main.html | 4 + artifact/assets/astroids/main.js | 668 ++++++++++++++++++++++ artifact/repair_astroids.yml | 10 + translate/translate_with_markdown.yml | 28 + 6 files changed, 752 insertions(+) create mode 100644 artifact/assets/astroids/instructions.txt create mode 100644 artifact/assets/astroids/main.css create mode 100644 artifact/assets/astroids/main.html create mode 100644 artifact/assets/astroids/main.js create mode 100644 artifact/repair_astroids.yml create mode 100644 translate/translate_with_markdown.yml diff --git a/artifact/assets/astroids/instructions.txt b/artifact/assets/astroids/instructions.txt new file mode 100644 index 0000000..1e356fa --- /dev/null +++ b/artifact/assets/astroids/instructions.txt @@ -0,0 +1,17 @@ +Rework the JavaScript to remove all leftover change markers & duplicate code. Address the issues by simplifying and structuring the code: + +### Instructions: +1. **Remove All Change Markers**: Remove any `<<<<<<<`, `=======`, `>>>>>>>` remnants from previous conflicting merges or update attempts. +2. **Centralize `generateShape()` Logic**: Ensure this method is only called once per object creation (e.g., in `Asteroid` or `Spaceship` constructors). Remove duplicates completely. +3. **Cleanup of Classes and Objects**: + - Separate and clearly define shared properties of asteroids, bullets, and spaceship. + - Ensure all elements (asteroids, bullets, spaceship states) are cleanly updated and rendered in the game loop. +4. **Improve Game Flow**: + - Ensure all global variables (score, lives, gameOver, etc.) and game state are properly governed and readable. + - Make restarting smoother and consistent. +5. **Fix Edge Cases**: + - Check collisions and interactions to ensure they logically work without overlaps or missing functionality. + - Manage object removal more robustly when out-of-bounds or destroyed. +6. **Final Testing**: The game should run with proper features and no residual issues. + +Result: A clean, error-free, and structured codebase where functionalities are compartmentalized, and the overall gameplay logic is functional and easier to maintain. \ No newline at end of file diff --git a/artifact/assets/astroids/main.css b/artifact/assets/astroids/main.css new file mode 100644 index 0000000..003fc9e --- /dev/null +++ b/artifact/assets/astroids/main.css @@ -0,0 +1,25 @@ +body { + margin: 0; + overflow: hidden; + background-color: black; + color: white; + font-family: Arial, sans-serif; +} + +canvas { + display: block; +} + +#score { + position: absolute; + top: 10px; + left: 10px; + font-size: 20px; +} + +#lives { + position: absolute; + top: 10px; + right: 10px; + font-size: 20px; +} \ No newline at end of file diff --git a/artifact/assets/astroids/main.html b/artifact/assets/astroids/main.html new file mode 100644 index 0000000..d0d643e --- /dev/null +++ b/artifact/assets/astroids/main.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/artifact/assets/astroids/main.js b/artifact/assets/astroids/main.js new file mode 100644 index 0000000..b201c67 --- /dev/null +++ b/artifact/assets/astroids/main.js @@ -0,0 +1,668 @@ +const canvas = document.getElementById("gameCanvas"); +const ctx = canvas.getContext("2d"); +canvas.width = window.innerWidth; +canvas.height = window.innerHeight; + +const thrustSound = document.getElementById("thrustSound"); +const fireSound = document.getElementById("fireSound"); +const explodeSound = document.getElementById("explodeSound"); + +let score = 0; +let lives = 3; +let gameOver = false; +const keys = {}; +const asteroids = []; +const bullets = []; +class Spaceship { + constructor() { + this.x = canvas.width / 2; + this.y = canvas.height / 2; + this.angle = 0; + this.speedX = 0; + this.speedY = 0; + this.radius = 15; + this.thrusting = false; + this.shape = this.generateShape(15); + } + + generateShape(size) { + const shape = []; + const points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * size * offset, y: Math.sin(angle) * size * offset }); + } + return shape; + } + + update() { + this.x += this.speedX; + this.y += this.speedY; + if (this.x < 0) this.x = canvas.width; + if (this.x > canvas.width) this.x = 0; + if (this.y < 0) this.y = canvas.height; + if (this.y > canvas.height) this.y = 0; + } + + draw() { + ctx.save(); + ctx.translate(this.x, this.y); + ctx.rotate(this.angle); + ctx.beginPath(); + ctx.moveTo(this.shape[0].x, this.shape[0].y); + for (let i = 1; i < this.shape.length; i++) { + ctx.lineTo(this.shape[i].x, this.shape[i].y); + } + ctx.closePath(); + ctx.strokeStyle = "white"; + ctx.stroke(); + ctx.restore(); + } +} + this.radius = 15; + this.thrusting = false; + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + + draw() { + ctx.save(); + ctx.translate(this.x, this.y); + ctx.rotate(this.angle); +ctx.beginPath(); + ctx.moveTo(this.x + this.shape[0].x, this.y + this.shape[0].y); + for (let i = 1; i < this.shape.length; i++) { + ctx.lineTo(this.x + this.shape[i].x, this.y + this.shape[i].y); + } + ctx.closePath(); + ctx.strokeStyle = "white"; + ctx.stroke(); + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + + update() { + this.x += this.speedX; + this.y += this.speedY; + + if (this.x < 0) this.x = canvas.width; + if (this.x > canvas.width) this.x = 0; + if (this.y < 0) this.y = canvas.height; + if (this.y > canvas.height) this.y = 0; + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } +>>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + +class Bullet { + constructor(x, y, angle) { + this.x = x; + this.y = y; + this.angle = angle; + this.speed = 5; + this.radius = 2; + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + + draw() { + ctx.beginPath(); + ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2); + ctx.fillStyle = "red"; + ctx.fill(); + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + + update() { + this.x += Math.cos(this.angle) * this.speed; + this.y += Math.sin(this.angle) * this.speed; + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } +>>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + +const ship = new Spaceship(); + +function createAsteroids(count) { + for (let i = 0; i < count; i++) { + let x = Math.random() * canvas.width; + let y = Math.random() * canvas.height; + let size = Math.random() * 20 + 20; + let speedX = (Math.random() - 0.5) * 2; + let speedY = (Math.random() - 0.5) * 2; + asteroids.push(new Asteroid(x, y, size, speedX, speedY)); + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } +>>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + +function shootBullet() { + bullets.push(new Bullet(ship.x, ship.y, ship.angle)); + fireSound.play(); +>>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + +function checkCollisions() { + for (let i = asteroids.length - 1; i >= 0; i--) { + const asteroid = asteroids[i]; + + if (Math.hypot(ship.x - asteroid.x, ship.y - asteroid.y) < asteroid.size + ship.radius) { + lives--; + if (lives <= 0) { + gameOver = true; + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + return; + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + + for (let j = bullets.length - 1; j >= 0; j--) { + const bullet = bullets[j]; + + if (Math.hypot(bullet.x - asteroid.x, bullet.y - asteroid.y) < asteroid.size) { + bullets.splice(j, 1); + asteroids.splice(i, 1); + explodeSound.play(); + score += 10; + + function createAsteroids(count) { + for (let i = 0; i < count; i++) { + let x = Math.random() * canvas.width; + let y = Math.random() * canvas.height; + let size = Math.random() * 20 + 20; + let speedX = (Math.random() - 0.5) * 2; + let speedY = (Math.random() - 0.5) * 2; + asteroids.push(new Asteroid(x, y, size, speedX, speedY)); + } +} + asteroids.push(new Asteroid(asteroid.x, asteroid.y, asteroid.size / 2, (Math.random() - 0.5) * 2, (Math.random() - 0.5) * 2)); + asteroids.push(new Asteroid(asteroid.x, asteroid.y, asteroid.size / 2, (Math.random() - 0.5) * 2, (Math.random() - 0.5) * 2)); + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + return; + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } +>>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + +function updateGame() { + if (gameOver) { + ctx.fillStyle = "white"; + ctx.font = "30px Arial"; + ctx.fillText("Game Over - Press R to Restart", canvas.width / 2 - 150, canvas.height / 2); + return; + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + + ctx.clearRect(0, 0, canvas.width, canvas.height); + + ship.update(); + ship.draw(); + + bullets.forEach((bullet, i) => { + bullet.update(); + bullet.draw(); + if (bullet.x < 0 || bullet.x > canvas.width || bullet.y < 0 || bullet.y > canvas.height) { + bullets.splice(i, 1); + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + }); + + asteroids.forEach(asteroid => { + asteroid.update(); + asteroid.draw(); + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + }); + + checkCollisions(); + + ctx.fillStyle = "white"; + ctx.fillText(`Score: ${score>>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + }`, 10, 20); + ctx.fillText(`Lives: ${lives>>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + }`, canvas.width - 100, 20); + + requestAnimationFrame(updateGame); +>>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } + +document.addEventListener("keydown", (e) => { + keys[e.key] = true; + if (e.key === " " && !gameOver) shootBullet(); + if (e.key.toLowerCase() === "r" && gameOver) { + location.reload(); + >>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + } +>>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + }); + +document.addEventListener("keyup", (e) => { + keys[e.key] = false; +>>>>>>> REPLACE +<<<<<<< SEARCH +ctx.beginPath(); +======= + ctx.beginPath(); + } + + generateShape() { + let shape = []; + let points = Math.floor(Math.random() * 5) + 5; + for (let i = 0; i < points; i++) { + let angle = (Math.PI * 2 / points) * i; + let offset = Math.random() * 0.4 + 0.8; + shape.push({ x: Math.cos(angle) * this.size * offset, y: Math.sin(angle) * this.size * offset }); + } + return shape; + }); + +createAsteroids(6); +updateGame(); \ No newline at end of file diff --git a/artifact/repair_astroids.yml b/artifact/repair_astroids.yml new file mode 100644 index 0000000..c5eef4b --- /dev/null +++ b/artifact/repair_astroids.yml @@ -0,0 +1,10 @@ +id: repair_astroids +name: Repair Astroids +description: full repair of a totally broken artifact +type: edit_artifact +args: + css_path: "assets/astroids/main.css" + js_path: "assets/astroids/main.js" + html_path: "assets/astroids/main.html" + instructions_path: "assets/astroids/instructions.txt" + diff --git a/translate/translate_with_markdown.yml b/translate/translate_with_markdown.yml new file mode 100644 index 0000000..919a7fe --- /dev/null +++ b/translate/translate_with_markdown.yml @@ -0,0 +1,28 @@ +id: translate_with_markdown +name: Translate with markdown +description: A simple eval for translation with markdown links +type: helper +args: + name: translate + input: "Please **read** [my website](https://www.sam.com) and tell me **if** you like it?" + locale: he +judge: + llm: gpt-4o + pass_rating: 8 + prompt: | + Is the following: + + [[[ + {{output}} + ]]] + + a faithful Hebrew translation of: + + [[[ + {{input}} + ]]] + + - Ensure markdown structure is preserved (bold / italics) + - Ensure all links are preserved + +