Changes
diff --git a/main.js b/main.js
index c57029a..897e987 100644
--- a/main.js
+++ b/main.js
@@ -2,6 +2,7 @@ import { h, render, useState, useEffect, html } from 'https://unpkg.com/htm/prea
// --- Constants ---
const MAX_HP = 20;
+const MAX_UNDO_STEPS = 1;
const SUITS = {
HEARTS: { symbol: '♥', color: 'red', type: 'POTION' },
DIAMONDS: { symbol: '♦', color: 'red', type: 'WEAPON' },
@@ -161,7 +162,8 @@ const App = () => {
const { history, ...stateToSave } = currentState;
// Basic deep copy for this simple state structure (arrays/objects)
const snapshot = JSON.parse(JSON.stringify(stateToSave));
- return [...history, snapshot];
+ // Limit history to MAX_UNDO_STEPS
+ return [...history, snapshot].slice(-MAX_UNDO_STEPS);
};
const undoLastMove = () => {