@@ -186,13 +186,13 @@ <h1>Buckshot Roulette Helper</h1>
186186 < div id ="setupSection " class ="setup-section ">
187187 < h2 > Setup Game</ h2 >
188188 < label > Total Rounds in Shotgun:</ label > < br >
189- < input type ="number " id ="totalRounds " min ="1 " value ="8 " onchange =" updateLivesFromTotal() " > < br > < br >
189+ < input type ="number " id ="totalRounds " min ="1 " value ="8 "> < br > < br >
190190
191191 < label > Live Shells:</ label > < br >
192- < input type ="number " id ="liveShells " min ="0 " value ="4 " onchange ="updateBlanksFromLives () "> < br > < br >
192+ < input type ="number " id ="liveShells " min ="0 " value ="4 " onchange ="updateTotalFromLives () "> < br > < br >
193193
194194 < label > Blank Shells:</ label > < br >
195- < input type ="number " id ="blankShells " min ="0 " value ="4 " onchange ="updateLivesFromBlanks () "> < br > < br >
195+ < input type ="number " id ="blankShells " min ="0 " value ="4 " onchange ="updateTotalFromBlanks () "> < br > < br >
196196
197197 < button onclick ="startGame() "> Start Game</ button >
198198 </ div >
@@ -290,40 +290,16 @@ <h3>Remaining Shells Visualization</h3>
290290 let currentShotPosition = 1 ;
291291 let knownShells = { } ;
292292
293- function updateLivesFromTotal ( ) {
294- const total = parseInt ( document . getElementById ( 'totalRounds ' ) . value ) || 0 ;
293+ function updateTotalFromLives ( ) {
294+ const lives = parseInt ( document . getElementById ( 'liveShells ' ) . value ) || 0 ;
295295 const blanks = parseInt ( document . getElementById ( 'blankShells' ) . value ) || 0 ;
296-
297- if ( blanks <= total ) {
298- document . getElementById ( 'liveShells' ) . value = total - blanks ;
299- } else {
300- document . getElementById ( 'blankShells' ) . value = total ;
301- document . getElementById ( 'liveShells' ) . value = 0 ;
302- }
296+ document . getElementById ( 'totalRounds' ) . value = lives + blanks ;
303297 }
304298
305- function updateBlanksFromLives ( ) {
306- const total = parseInt ( document . getElementById ( 'totalRounds' ) . value ) || 0 ;
299+ function updateTotalFromBlanks ( ) {
307300 const lives = parseInt ( document . getElementById ( 'liveShells' ) . value ) || 0 ;
308-
309- if ( lives <= total ) {
310- document . getElementById ( 'blankShells' ) . value = total - lives ;
311- } else {
312- document . getElementById ( 'liveShells' ) . value = total ;
313- document . getElementById ( 'blankShells' ) . value = 0 ;
314- }
315- }
316-
317- function updateLivesFromBlanks ( ) {
318- const total = parseInt ( document . getElementById ( 'totalRounds' ) . value ) || 0 ;
319301 const blanks = parseInt ( document . getElementById ( 'blankShells' ) . value ) || 0 ;
320-
321- if ( blanks <= total ) {
322- document . getElementById ( 'liveShells' ) . value = total - blanks ;
323- } else {
324- document . getElementById ( 'blankShells' ) . value = total ;
325- document . getElementById ( 'liveShells' ) . value = 0 ;
326- }
302+ document . getElementById ( 'totalRounds' ) . value = lives + blanks ;
327303 }
328304
329305 function startGame ( ) {
0 commit comments