How much is a battery for a 2018 Subaru Legacy?
The average cost to replace the battery in a 2018 Subaru Legacy is between $150 and $250, including parts and labor. This price range can vary depending on your location, the specific battery needed, and whether you choose to have the replacement done at a dealership or an independent auto repair shop.
Detailed Breakdown of Battery Replacement Cost
The battery in a 2018 Subaru Legacy is typically a standard 12-volt, lead-acid car battery. The exact battery size and specifications can vary slightly based on the specific model and trim level of the Legacy. The cost of the replacement battery itself is usually between $100 and $150 for a good-quality, OEM-equivalent battery.
In addition to the battery cost, you'll also need to factor in the labor charges for the replacement. This typically ranges from $50 to $100, depending on the mechanic's hourly rate and the difficulty of the job. Some shops may also charge a small fee for disposing of the old battery# README.md
# Tic-Tac-Toe
A simple Tic Tac Toe game built using HTML, CSS, and JavaScript.
## Features
- Two-player game mode
- Ability to reset the game
- Displays the winner or a tie message
## How to Play
1. Open the `index.html` file in your web browser.
2. The game will start with the first player (X) making the first move.
3. Players take turns placing their marks (X or O) on the 3x3 grid.
4. The first player to get three of their marks in a row (horizontally, vertically, or diagonally) wins the game.
5. If all squares are filled and neither player has three in a row, the game is a tie.
6. To reset the game, click the "Reset" button.
## Screenshots

## Technologies Used
- HTML
- CSS
- JavaScript
## License
This project is licensed under the [MIT License](LICENSE).
End File# script.js
// Get the game board elements
const cells = document.querySelectorAll('.cell');
const resetButton = document.getElementById('reset-button');
const statusMessage = document.getElementById('status-message');
// Game state variables
let currentPlayer = 'X';
let gameBoard = ['', '', '', '', '', '', '', '', ''];
let gameActive = true;
// Function to handle a cell click
function handleCellClick(event) {
const cell = event.target;
const cellIndex = Array.from(cells).indexOf(cell);
// Check if the cell is already occupied or the game is not active
if (gameBoard[cellIndex] !== '' || !gameActive) {
return;
}
// Update the game board and the cell's content
gameBoard[cellIndex] = currentPlayer;
cell.textContent = currentPlayer;
// Check for a winner or a tie
checkGameStatus();
// Switch the current player
currentPlayer = currentPlayer === 'X' ? 'O' : 'X';
}
// Function to check the game status
function checkGameStatus() {
// Check for a winner
const winningCombinations = [
[0, 1, 2], [3, 4, 5], [6, 7, 8], // Horizontal
[0, 3, 6], [1, 4, 7], [2, 5, 8], // Vertical
[0, 4, 8], [2, 4, 6] // Diagonal
];
for (let i = 0; i < winningCombinations.length; i++) {
const [a, b, c] = winningCombinations[i];
if (gameBoard[a] !== '' && gameBoard[a] === gameBoard[b] && gameBoard[b] === gameBoard[c]) {
statusMessage.textContent = `Player ${gameBoard[a]} wins!`;
gameActive = false;
return;
}
}
// Check for a tie
if (!gameBoard.includes('')) {
statusMessage.textContent = 'It\'s a tie!';
gameActive = false;
return;
}
}
// Function to reset the game
function resetGame() {
gameBoard = ['', '', '', '', '', '', '', '', ''];
currentPlayer = 'X';
gameActive = true;
cells.forEach(cell => {
cell.textContent = '';
});
statusMessage.textContent = '';
}
// Add event listeners
cells.forEach(cell => {
cell.addEventListener('click', handleCellClick);
});
resetButton.addEventListener('click', resetGame);
End File# style.css
body {
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
}
.game-board {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 10px;
margin-bottom: 20px;
}
.cell {
width: 100px;
height: 100px;
background-color: #fff;
border: 1px solid #ccc;
display: flex;
align-items: center;
justify-content: center;
font-size: 48px;
font-weight: bold;
cursor: pointer;
}
.cell:hover {
background-color: #f0f0f0;
}
#reset-button {
padding: 10px 20px;
font-size: 16px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
#reset-button:hover {
background-color: #45a049;
}
#status-message {
font-size: 24px;
font-weight: bold;
margin-top: 20px;
}