Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Projects/Public Policy Impact Simulator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Public Policy Impact Simulator

Enact policy changes and observe their simulated economic effects on GDP, unemployment, inflation, budget deficit, and consumer confidence over time.

## Features
- **Policy Library** — 10 distinct policies from tax cuts to universal basic income
- **Economic Indicators** — Real-time GDP, unemployment, inflation, deficit, and confidence tracking
- **Impact Timeline** — Visual chart showing how each policy affects the economy over years

Open `index.html` in any browser to start simulating.
59 changes: 59 additions & 0 deletions Projects/Public Policy Impact Simulator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Public Policy Impact Simulator — Enact policy changes and observe their economic effects.">
<title>Public Policy Impact Simulator</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="app">
<header class="topbar">
<h1><span aria-hidden="true">&#x1F4CA;</span> Public Policy Impact Simulator</h1>
<p class="subtitle">Policy Changes &middot; Economic Effects</p>
</header>

<div class="dashboard">
<div class="indicators">
<div class="indicator"><span class="ind-label">GDP Growth</span><span class="ind-value" id="gdpVal">2.1%</span></div>
<div class="indicator"><span class="ind-label">Unemployment</span><span class="ind-value" id="unempVal">4.8%</span></div>
<div class="indicator"><span class="ind-label">Inflation</span><span class="ind-value" id="inflVal">2.3%</span></div>
<div class="indicator"><span class="ind-label">Budget Deficit</span><span class="ind-value" id="defVal">$340B</span></div>
<div class="indicator"><span class="ind-label">Consumer Confidence</span><span class="ind-value" id="confVal">72</span></div>
<div class="indicator"><span class="ind-label">Year</span><span class="ind-value" id="yearVal">2026</span></div>
</div>

<div class="main-grid">
<div class="panel">
<h2>Available Policies</h2>
<div class="policy-list" id="policyList"></div>
</div>

<div class="panel">
<h2>Enacted Policies</h2>
<div id="enactedPolicies"><p class="empty-state">No policies enacted yet. Choose from the left panel.</p></div>
</div>

<div class="panel wide">
<h2>Economic Impact Timeline</h2>
<div class="chart-area" id="chartArea">
<div class="chart-bars" id="chartBars"></div>
</div>
<div class="chart-legend">
<span><span class="dot" style="background:var(--green)"></span> GDP</span>
<span><span class="dot" style="background:var(--red)"></span> Unemployment</span>
<span><span class="dot" style="background:var(--gold)"></span> Inflation</span>
</div>
</div>
</div>

<div class="event-log">
<h3>Policy Impact Log</h3>
<div class="log-entries" id="logEntries"><p class="empty-state">Simulation started. Enact policies to see their effects.</p></div>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
10 changes: 10 additions & 0 deletions Projects/Public Policy Impact Simulator/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Public Policy Impact Simulator",
"description": "Enact policy changes and observe their economic effects on GDP, unemployment, inflation, and more.",
"entry": "index.html",
"tags": ["html", "css", "javascript", "simulation"],
"author": {
"name": "Girish Madarkar",
"github": "Girish0902"
}
}
170 changes: 170 additions & 0 deletions Projects/Public Policy Impact Simulator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
const state = {
year: 2026,
gdp: 2.1,
unemployment: 4.8,
inflation: 2.3,
deficit: 340,
confidence: 72,
enactedPolicies: [],
history: [],
};

const POLICIES = [
{
name: "Cut Corporate Tax",
desc: "Reduce corporate tax rate from 21% to 15%",
effects: { gdp: 0.8, unemployment: -0.3, inflation: 0.4, deficit: 120, confidence: 5 },
},
{
name: "Increase Infrastructure Spending",
desc: "$500B investment in roads, bridges, and broadband",
effects: { gdp: 1.2, unemployment: -0.6, inflation: 0.3, deficit: 180, confidence: 8 },
},
{
name: "Raise Minimum Wage",
desc: "Increase federal minimum wage to $15/hour",
effects: { gdp: 0.1, unemployment: 0.5, inflation: 0.6, deficit: 20, confidence: 3 },
},
{
name: "Universal Healthcare",
desc: "Implement single-payer healthcare system",
effects: { gdp: -0.3, unemployment: 0.1, inflation: 0.2, deficit: 250, confidence: 6 },
},
{
name: "Education Reform",
desc: "Free public college and vocational training",
effects: { gdp: 0.5, unemployment: -0.2, inflation: 0.1, deficit: 90, confidence: 7 },
},
{
name: "Green Energy Subsidies",
desc: "Tax credits for renewable energy adoption",
effects: { gdp: 0.6, unemployment: -0.1, inflation: 0.2, deficit: 60, confidence: 4 },
},
{
name: "Deregulation Package",
desc: "Reduce business regulations across industries",
effects: { gdp: 0.7, unemployment: -0.4, inflation: 0.1, deficit: -10, confidence: 2 },
},
{
name: "Trade Tariffs",
desc: "Impose 10% tariff on imported goods",
effects: { gdp: -0.4, unemployment: 0.2, inflation: 1.1, deficit: -40, confidence: -3 },
},
{
name: "Universal Basic Income",
desc: "$500/month basic income for all citizens",
effects: { gdp: 0.3, unemployment: 0.3, inflation: 1.0, deficit: 320, confidence: 2 },
},
{
name: "Housing Affordability Act",
desc: "Subsidies and incentives for affordable housing",
effects: { gdp: 0.4, unemployment: -0.2, inflation: 0.3, deficit: 70, confidence: 5 },
},
];

const $=id=>document.getElementById(id);

function addLog(msg){
const el=$('logEntries');
const e=document.createElement('div'); e.className='log-entry';
e.innerHTML=`<span class="year">${state.year}</span> ${msg}`;
el.prepend(e);
if(el.children.length>30) el.removeChild(el.lastChild);
}

function updateUI(){
$('gdpVal').textContent=state.gdp.toFixed(1)+'%';
$('gdpVal').style.color=state.gdp>=2?'var(--green)':state.gdp>=0?'var(--gold)':'var(--red)';
$('unempVal').textContent=state.unemployment.toFixed(1)+'%';
$('unempVal').style.color=state.unemployment<=5?'var(--green)':state.unemployment<=7?'var(--gold)':'var(--red)';
$('inflVal').textContent=state.inflation.toFixed(1)+'%';
$('inflVal').style.color=state.inflation<=3?'var(--green)':state.inflation<=5?'var(--gold)':'var(--red)';
$('defVal').textContent='$'+(state.deficit>=0?state.deficit:0)+'B';
$('defVal').style.color=state.deficit<=200?'var(--green)':state.deficit<=400?'var(--gold)':'var(--red)';
$('confVal').textContent=state.confidence;
$('confVal').style.color=state.confidence>=70?'var(--green)':state.confidence>=50?'var(--gold)':'var(--red)';
$('yearVal').textContent=state.year;

renderPolicies();
renderEnacted();
renderChart();
}

function renderPolicies(){
const list=$('policyList');
list.innerHTML=POLICIES.map((p,i)=>{
const canEnact=!state.enactedPolicies.includes(i);
return `<button class="policy-btn" data-idx="${i}" ${!canEnact?'disabled':''}>
${p.name}
<span class="effects">${p.desc}<br>
<span class="pos">GDP: +${p.effects.gdp}%</span> ·
<span class="${p.effects.unemployment<0?'pos':'neg'}">Unemp: ${p.effects.unemployment>=0?'+':''}${p.effects.unemployment}%</span> ·
<span class="${p.effects.inflation<=0.3?'pos':'neg'}">Infl: +${p.effects.inflation}%</span> ·
Deficit: +$${p.effects.deficit}B
</span>
</button>`;
}).join('');
list.querySelectorAll('.policy-btn').forEach(b=>b.addEventListener('click',()=>enact(parseInt(b.dataset.idx))));
}

function enact(idx){
const p=POLICIES[idx];
state.enactedPolicies.push(idx);
state.gdp+=p.effects.gdp;
state.unemployment+=p.effects.unemployment;
state.inflation+=p.effects.inflation;
state.deficit+=p.effects.deficit;
state.confidence+=p.effects.confidence;
state.gdp=Math.round(state.gdp*10)/10;
state.unemployment=Math.round(Math.max(1,state.unemployment)*10)/10;
state.inflation=Math.round(Math.max(0,state.inflation)*10)/10;
state.deficit=Math.max(0,state.deficit);
state.confidence=Math.min(100,Math.max(0,state.confidence));
state.year++;

state.history.push({
year: state.year-1,
policy: p.name,
gdp: state.gdp,
unemployment: state.unemployment,
inflation: state.inflation,
});

addLog(`Enacted "${p.name}" — GDP: ${state.gdp.toFixed(1)}%, Unemployment: ${state.unemployment.toFixed(1)}%, Inflation: ${state.inflation.toFixed(1)}%`);
updateUI();
}

function renderEnacted(){
const el=$('enactedPolicies');
if(!state.enactedPolicies.length){
el.innerHTML='<p class="empty-state">No policies enacted yet. Choose from the left panel.</p>';
return;
}
el.innerHTML=state.enactedPolicies.map(i=>{
const p=POLICIES[i];
return `<div class="enacted-item"><span class="name">${p.name}</span><br>${p.desc}</div>`;
}).join('');
}

function renderChart(){
const bars=$('chartBars');
const data=state.history;
if(!data.length){
bars.innerHTML='<div class="empty-state" style="width:100%;padding:40px">Enact policies to see the economic impact timeline.</div>';
return;
}
const max=Math.max(...data.map(d=>Math.max(d.gdp,d.unemployment,d.inflation,5)));
bars.innerHTML=data.map(d=>{
const gH=Math.max(2,(d.gdp/max)*180);
const uH=Math.max(2,(d.unemployment/max)*180);
const iH=Math.max(2,(d.inflation/max)*180);
return `<div class="chart-col"><div class="chart-bar-wrap">
<div class="chart-bar gdp" style="height:${gH}px" title="GDP ${d.gdp}%"></div>
<div class="chart-bar unemp" style="height:${uH}px" title="Unemployment ${d.unemployment}%"></div>
<div class="chart-bar infl" style="height:${iH}px" title="Inflation ${d.inflation}%"></div>
</div><span class="year-label">${d.year}</span></div>`;
}).join('');
}

updateUI();
addLog('Simulation started. GDP: 2.1%, Unemployment: 4.8%, Inflation: 2.3%');
39 changes: 39 additions & 0 deletions Projects/Public Policy Impact Simulator/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}
:root{--bg:#0b1120;--surface:#111827;--card:rgba(30,41,59,0.6);--border:#334155;--gold:#d4a017;--gold-glow:rgba(212,160,23,0.12);--text:#f8fafc;--text2:#cbd5e1;--text3:#64748b;--accent:#93c5fd;--green:#22c55e;--red:#ef4444;--radius:10px;--trans:all 0.3s cubic-bezier(0.16,1,0.3,1)}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:var(--bg);color:var(--text2);min-height:100vh}
.app{max-width:1200px;margin:0 auto;padding:20px}
.topbar{text-align:center;padding:20px 0;border-bottom:1px solid var(--border);margin-bottom:20px}
.topbar h1{font-size:22px;font-weight:700;color:var(--gold);letter-spacing:1px}
.topbar .subtitle{font-size:13px;color:var(--text3);margin-top:4px}
.indicators{display:grid;grid-template-columns:repeat(6,1fr);gap:10px;margin-bottom:20px}
@media(max-width:900px){.indicators{grid-template-columns:repeat(3,1fr)}}
.indicator{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);padding:14px;text-align:center;backdrop-filter:blur(8px)}
.ind-label{font-size:10px;color:var(--text3);text-transform:uppercase;letter-spacing:0.8px}
.ind-value{font-family:ui-monospace,Consolas,monospace;font-size:20px;font-weight:700;color:var(--text);margin-top:4px;display:block}
.main-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:20px}
.panel{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);padding:20px;backdrop-filter:blur(8px)}
.panel.wide{grid-column:1/-1}
.panel h2{font-size:12px;font-weight:600;color:var(--accent);text-transform:uppercase;letter-spacing:1px;margin-bottom:14px;padding-bottom:8px;border-bottom:1px solid var(--border)}
.policy-list,.enacted-list{display:grid;gap:8px}
.policy-btn{width:100%;padding:12px 16px;background:var(--surface);border:1px solid var(--border);border-radius:8px;color:var(--text2);font-size:13px;cursor:pointer;transition:var(--trans);text-align:left;font-family:inherit}
.policy-btn:hover{border-color:var(--gold);background:var(--gold-glow)}
.policy-btn .effects{font-size:11px;color:var(--text3);display:block;margin-top:4px}
.policy-btn .effects .pos{color:var(--green)}.policy-btn .effects .neg{color:var(--red)}
.policy-btn:disabled{opacity:0.3;cursor:not-allowed}
.enacted-item{background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:12px;margin-bottom:8px;font-size:12px;line-height:1.6}
.enacted-item .name{color:var(--gold);font-weight:600}
.chart-area{height:200px;display:flex;align-items:flex-end;padding:10px 0}
.chart-bars{display:flex;align-items:flex-end;gap:6px;width:100%;height:100%}
.chart-col{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;position:relative}
.chart-bar-wrap{width:100%;display:flex;gap:2px;height:100%;align-items:flex-end}
.chart-bar{flex:1;border-radius:3px 3px 0 0;min-height:2px;transition:height 0.6s cubic-bezier(0.16,1,0.3,1)}
.chart-bar.gdp{background:var(--green)}.chart-bar.unemp{background:var(--red)}.chart-bar.infl{background:var(--gold)}
.chart-col .year-label{font-size:9px;color:var(--text3);margin-top:4px;white-space:nowrap}
.chart-legend{display:flex;gap:20px;justify-content:center;margin-top:8px;font-size:11px;color:var(--text2)}
.chart-legend .dot{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px;vertical-align:middle}
.event-log{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);padding:20px;backdrop-filter:blur(8px)}
.event-log h3{font-size:12px;font-weight:600;color:var(--accent);text-transform:uppercase;letter-spacing:1px;margin-bottom:10px}
.log-entries{max-height:200px;overflow-y:auto}
.log-entry{padding:8px 0;border-bottom:1px solid rgba(51,65,85,0.4);font-size:12px;color:var(--text2);line-height:1.5}
.log-entry .year{font-family:ui-monospace,Consolas,monospace;color:var(--gold)}
.empty-state{text-align:center;padding:30px;color:var(--text3);font-size:12px}
35 changes: 35 additions & 0 deletions Projects/Public Policy Impact Simulator/thumbnail.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading