PolyCare

Car Simulator — Village & City

Car Simulator

Speed: 0 km/h  |  Distance: 0 m
Controls: Arrow keys / WASD — Up to accelerate, Down to brake, Left/Right to steer
/* Basic layout and responsive canvas */ *{box-sizing:border-box;font-family:Inter,Arial,Helvetica,sans-serif} body{margin:0;background:#111;color:#eee;display:flex;flex-direction:column;align-items:center;gap:12px;padding:12px} #ui{width:100%;max-width:1100px} .controls{display:flex;gap:8px;align-items:center;margin-bottom:6px} .controls select, .controls button{padding:6px 10px;border-radius:8px;border:1px solid #333;background:#222;color:#eee} .hud{margin-bottom:6px} .hint{font-size:13px;color:#bbb} #gameArea{width:100%;max-width:1100px;background:#000;padding:6px;border-radius:12px;box-shadow:0 6px 24px rgba(0,0,0,0.7)} canvas{display:block;width:100%;height:auto;border-radius:8px;background:#222} /* Small screens */ @media(max-width:640px){.controls{flex-direction:column;align-items:flex-start}} // Simple top-down car simulator with two modes (village, city) // Save as game.js (() => { const canvas = document.getElementById('gameCanvas'); const ctx = canvas.getContext('2d'); const speedEl = document.getElementById('speed'); const distanceEl = document.getElementById('distance'); const startBtn = document.getElementById('startBtn'); const restartBtn = document.getElementById('restartBtn'); const modeSelect = document.getElementById('modeSelect'); const difficultySelect = document.getElementById('difficulty'); // Logical size independent from CSS scaling const W = 900, H = 600; canvas.width = W; canvas.height = H; let keys = {}; window.addEventListener('keydown', e => keys[e.key.toLowerCase()] = true); window.addEventListener('keyup', e => keys[e.key.toLowerCase()] = false); function rand(min, max){ return Math.random()*(max-min)+min } // Game state let running=false, distance=0, speed=0; let car = {x:W/2,y:H-140,angle:0,w:36,h:60,vel:0}; let obstacles = []; let mode='village'; let difficulty='normal'; function init(){ running=false; distance=0; speed=0; car = {x:W/2,y:H-140,angle:0,w:36,h:60,vel:0}; obstacles = []; spawnObstacles(10); drawStartScreen(); } function spawnObstacles(n){ obstacles=[]; for(let i=0;i{ init(); startBtn.disabled=false; restartBtn.disabled=true }; function drawStartScreen(){ ctx.clearRect(0,0,W,H); ctx.fillStyle = '#081B14'; ctx.fillRect(0,0,W,H); ctx.fillStyle = '#fff'; ctx.font='28px Arial'; ctx.fillText('Click Start to play — Mode: '+mode, 30,80); } function drawBackground(t){ if(mode==='village') drawVillage(t); else drawCity(t); } function drawVillage(t){ // sky const g = ctx.createLinearGradient(0,0,0,H); g.addColorStop(0,'#87CEEB'); g.addColorStop(1,'#cfe6d8'); ctx.fillStyle=g; ctx.fillRect(0,0,W,H); // rolling hills ctx.fillStyle='#4da373'; for(let i=-1;i<5;i++){ ctx.beginPath(); const offset = (t*0.03 + i*200)%W; ctx.ellipse(offset, H-160, 300, 80, 0, 0, Math.PI*2); ctx.fill(); } // road ctx.fillStyle='#555'; ctx.fillRect(100, 80, W-200, H-160); } function drawCity(t){ // dusk gradient const g = ctx.createLinearGradient(0,0,0,H); g.addColorStop(0,'#0f1724'); g.addColorStop(1,'#3b3b4f'); ctx.fillStyle=g; ctx.fillRect(0,0,W,H); // buildings (parallax) for(let i=0;i<8;i++){ const bw = 80 + (i%3)*20; const bx = (i*150 + (t*0.05 % 150))% (W+bw) - bw; ctx.fillStyle = '#222'; ctx.fillRect(bx, H-300, bw, 300); // windows ctx.fillStyle='#ffd'; for(let y=H-280;y H + 100){ ob.y = -rand(50,800); ob.x = rand(120,W-120); ob.size = mode==='city'? rand(30,80) : rand(20,60); } // collision const dx = ob.x - car.x; const dy = ob.y - car.y; if(Math.abs(dx) < (ob.size/2 + car.w/2) && Math.abs(dy) < (ob.size/2 + car.h/2)){ // simple collision response: slow car and bump back car.vel *= 0.4; car.x -= Math.sign(dx) * 20; car.y -= Math.sign(dy) * 20; } } // distance travelled distance += car.vel * 10 * dt; } function drawCar(){ ctx.save(); ctx.translate(car.x, car.y); ctx.rotate(car.angle); // body ctx.fillStyle = '#c32'; ctx.fillRect(-car.w/2, -car.h/2, car.w, car.h); // windows ctx.fillStyle = '#88d'; ctx.fillRect(-car.w/4, -car.h/2, car.w/2, car.h/4); // wheels ctx.fillStyle = '#111'; ctx.fillRect(-car.w/2-4, -car.h/4, 6, car.h/3); ctx.fillRect(car.w/2-2, -car.h/4, 6, car.h/3); ctx.restore(); } function drawObstacles(){ for(let ob of obstacles){ ctx.save(); ctx.translate(ob.x, ob.y); ctx.fillStyle = mode==='city'? '#444' : '#6a4500'; ctx.fillRect(-ob.size/2, -ob.size/2, ob.size, ob.size); ctx.restore(); } } let last=0; function loop(now){ if(!running) return; const dt = Math.min(0.05, (now-last)/1000); last = now; // update and render update(dt); // background uses now for subtle animation drawBackground(now/1000); // road centerline ctx.fillStyle = '#777'; ctx.fillRect(120, H-160, W-240, 40); // dashed line ctx.fillStyle = '#eee'; for(let y= -300 + (now*0.25%60); y e.preventDefault()); // simple tilt/button UI could be added here })(); 'send POST']); exit; } $name = isset($_POST['name'])?substr($_POST['name'],0,40):'Guest'; $score = isset($_POST['score'])?intval($_POST['score']):0; $entry = [ 'time' => date('c'), 'name'=> $name, 'score' => $score ]; $file = __DIR__ . '/leaderboard.json'; $all = []; if(file_exists($file)){ $txt = file_get_contents($file); $all = json_decode($txt, true) ?: []; } $all[] = $entry; usort($all, function($a,$b){ return $b['score'] - $a['score']; }); $all = array_slice($all, 0, 50); file_put_contents($file, json_encode($all, JSON_PRETTY_PRINT)); header('Content-Type: application/json'); echo json_encode(['ok'=>true,'entry'=>$entry]); ?> { "short_name":"CarSim", "name":"Car Simulator — Village & City", "start_url":"/index.html", "display":"standalone", "background_color":"#081B14", "theme_color":"#222", "icons":[{"src":"icon-192.png","sizes":"192x192","type":"image/png"}] } CarSim Simple car simulator web game wrapped as an app You 1) Install Node.js and Cordova (or use Android Studio + WebView). Example (on your dev machine): - npm install -g cordova 2) Create a cordova project and copy the web files into `www/`: - cordova create CarSim com.example.carsim CarSim - cd CarSim - Replace the contents of CarSim/www/ with the files: index.html, style.css, game.js, server.php (server.php is optional and must be on a server), manifest.json - cordova platform add android 3) Build the APK (debug): - cordova build android - The debug APK will be in platforms/android/app/build/outputs/apk/debug/app-debug.apk 4) To produce a signed release APK, follow Android signing steps via Android Studio or use cordova build --release then sign with jarsigner / apksigner. Alternative: Use capacitor (Ionic) or a WebView wrapper (Android Studio) or convert to an Android PWA / TWA. If you need the exact Android Studio steps, I included the minimal Cordova flow above. - If you want multi-file packaging (images, sfx), add an `assets/` folder and load images in game.js. - To support leaderboards, host server.php on a PHP-enabled host and from the game use fetch POST to save score. - This code is intentionally simple and educational. For production you'd want better physics, asset loading, audio, collision polishing, touch UI, and security on server endpoints.
""" Single-file Flask web application for a "Polipas" (polyp) treatment clinic. Features: - Homepage with clinic info - Doctor profiles - Appointment booking form (stored in SQLite) - Contact form (stored in SQLite) - Simple admin view to list appointments/messages (protected by a simple password) - Responsive CSS embedded How to use: save this file as polipas_clinic_single_file.py, install Flask: pip install flask, then run: python polipas_clinic_single_file.py Open http://127.0.0.1:5000 in your browser. This single file contains HTML/CSS templates rendered with render_template_string. """ from flask import Flask, request, redirect, url_for, render_template_string, g, flash import sqlite3 import os from datetime import datetime # Configuration DATABASE = 'polipas_clinic.db' ADMIN_PASSWORD = 'clinicadmin123' # change this in production app = Flask(__name__) app.secret_key = os.urandom(24) # ---------- Database helpers ---------- def get_db(): db = getattr(g, '_database', None) if db is None: db = g._database = sqlite3.connect(DATABASE) db.row_factory = sqlite3.Row return db @app.teardown_appcontext def close_connection(exception): db = getattr(g, '_database', None) if db is not None: db.close() def init_db(): db = get_db() cursor = db.cursor() # appointments table cursor.execute(''' CREATE TABLE IF NOT EXISTS appointments ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, phone TEXT NOT NULL, email TEXT, preferred_date TEXT, message TEXT, created_at TEXT NOT NULL ) ''') # messages table cursor.execute(''' CREATE TABLE IF NOT EXISTS messages ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, email TEXT, subject TEXT, message TEXT, created_at TEXT NOT NULL ) ''') db.commit() # Initialize DB at startup with app.app_context(): init_db() # ---------- Templates (embedded) ---------- BASE_HTML = ''' Polipas Clinic - পলিপাস চিকিৎসা সেবা

Polipas Clinic

পলিপাস (Polyp) সংক্রান্ত চেকআপ, পরামর্শ ও চিকিৎসা সেবা। অনলাইন অ্যাপয়েন্টমেন্ট ও টেলিমেডিসিন সুবিধা।

অ্যাপয়েন্টমেন্ট:
অনলাইনে বুক করুন

কোন প্রয়োজনে ফোন করুন: +880-1XX-XXXXXXX

{% with messages = get_flashed_messages() %} {% if messages %}
{% for m in messages %}
{{ m }}
{% endfor %}
{% endif %} {% endwith %} {{ content|safe }}

© {{ year }} Polipas Clinic — All rights reserved. Designed with care.

''' INDEX_CONTENT = '''

স্বাগত — Polipas Clinic

আমরা পলিপাস সংক্রান্ত স্বাস্থ্যসেবা প্রদান করি: চেকআপ, এনডোস্কপি রেফারেল, কনসাল্টেশন এবং সার্জিক্যাল ম্যানেজমেন্ট (প্রয়োজনে)। আমাদের অভিজ্ঞ ডাক্তাররা রোগীর উপসর্গ অনুসারে উপযুক্ত চিকিৎসা পরিকল্পনা দেবেন।

Our Approach

  • প্রাথমিক অনলাইন পরামর্শ
  • চিকিৎসা পরিকল্পনা ও রেফারেল
  • টেলিমেডিসিন ও ফলো-আপ

Patient Steps

  1. অ্যাপয়েন্টমেন্ট বুক করুন
  2. অনলাইন কনসাল্টেশন / টেলেমেডিসিন
  3. চাহিদা অনুযায়ী ইন-হসপিটাল রেফারেল
''' SERVICES_CONTENT = '''

Services

  • Initial Consultation (On-site / Telemedicine)
  • Diagnostic Tests & Endoscopy Referral
  • Non-surgical management & Follow-up
  • Surgical referral & pre-op counseling
''' DOCTORS_CONTENT = '''

Our Doctors

Dr. A. Rahman

Gastroenterologist — 12 years experience. Specialized in endoscopic management of polyps.

Dr. S. Akter

Surgeon — Minimally invasive procedures and surgical management.

Dr. M. Karim

General Physician — Initial assessment and referral coordination.

''' BOOK_CONTENT = '''

Book an Appointment

Please provide your details — our staff will contact you to confirm.

''' CONTACT_CONTENT = '''

Contact Us

Send a message and we will reply as soon as possible.

''' ADMIN_LOGIN_CONTENT = '''

Admin Login

''' ADMIN_DASH_CONTENT = '''

Admin Dashboard

Appointments

{% if appointments %} {% for a in appointments %} {% endfor %}
#NamePhonePreferred DateCreated
{{ a['id'] }} {{ a['name'] }} {{ a['phone'] }} {{ a['preferred_date'] }} {{ a['created_at'] }}
Message: {{ a['message'] }}
{% else %}

No appointments yet.

{% endif %}

Messages

{% if messages %} {% for m in messages %} {% endfor %}
#NameEmailSubjectCreated
{{ m['id'] }}{{ m['name'] }}{{ m['email'] }}{{ m['subject'] }}{{ m['created_at'] }}
{{ m['message'] }}
{% else %}

No messages yet.

{% endif %}
''' # ---------- Routes ---------- @app.route('/') def index(): return render_template_string(BASE_HTML, content=INDEX_CONTENT, year=datetime.now().year) @app.route('/services') def services(): return render_template_string(BASE_HTML, content=SERVICES_CONTENT, year=datetime.now().year) @app.route('/doctors') def doctors(): return render_template_string(BASE_HTML, content=DOCTORS_CONTENT, year=datetime.now().year) @app.route('/book', methods=['GET','POST']) def book(): if request.method == 'POST': name = request.form.get('name','').strip() phone = request.form.get('phone','').strip() email = request.form.get('email','').strip() preferred_date = request.form.get('preferred_date','').strip() message = request.form.get('message','').strip() if not name or not phone: flash('Please provide at least name and phone.') return redirect(url_for('book')) db = get_db() db.execute('INSERT INTO appointments (name,phone,email,preferred_date,message,created_at) VALUES (?,?,?,?,?,?)', (name,phone,email,preferred_date,message, datetime.now().isoformat())) db.commit() flash('Your booking request has been received. We will contact you soon.') return redirect(url_for('index')) return render_template_string(BASE_HTML, content=BOOK_CONTENT, year=datetime.now().year) @app.route('/contact', methods=['GET','POST']) def contact(): if request.method == 'POST': name = request.form.get('name','').strip() email = request.form.get('email','').strip() subject = request.form.get('subject','').strip() message = request.form.get('message','').strip() if not name or not message: flash('Please include your name and a message.') return redirect(url_for('contact')) db = get_db() db.execute('INSERT INTO messages (name,email,subject,message,created_at) VALUES (?,?,?,?,?)', (name,email,subject,message, datetime.now().isoformat())) db.commit() flash('Thank you for your message. We will reply soon.') return redirect(url_for('index')) return render_template_string(BASE_HTML, content=CONTACT_CONTENT, year=datetime.now().year) @app.route('/admin', methods=['GET','POST']) def admin(): if request.method == 'POST': pw = request.form.get('password','') if pw != ADMIN_PASSWORD: flash('Invalid password') return redirect(url_for('admin')) db = get_db() cur = db.execute('SELECT * FROM appointments ORDER BY created_at DESC') appointments = cur.fetchall() cur2 = db.execute('SELECT * FROM messages ORDER BY created_at DESC') messages = cur2.fetchall() return render_template_string(BASE_HTML, content=ADMIN_DASH_CONTENT, appointments=appointments, messages=messages, year=datetime.now().year) return render_template_string(BASE_HTML, content=ADMIN_LOGIN_CONTENT, year=datetime.now().year) # Health check route @app.route('/health') def health_check(): return {'status':'ok'} # ---------- Run ---------- if __name__ == '__main__': app.run(debug=True)