Skip to content

Commit

Permalink
Merge pull request #27 from Suke-H/fix-round6-correct-dicision
Browse files Browse the repository at this point in the history
fix: #26 ロード時の最終行の正解判定の不具合修正
  • Loading branch information
Suke-H authored Apr 21, 2024
2 parents 89b16eb + d1edd60 commit 18106d5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/load/saveAndLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const saveGameData = (todaysNo: number, answerList: string[][]) => {
export const loadGameData = (todaysNo: number, correctAnswer: string, loadDataSetters: LoadDataSetters) => {
// ローカルストレージからロード
const answerList = loadGameDataInLocal(todaysNo);
// console.table(answerList);

// ロードしたデータをセット
loadDataSetters.setAnswerList(answerList);
Expand All @@ -29,7 +28,6 @@ export const loadGameData = (todaysNo: number, correctAnswer: string, loadDataSe
const index = answerList.findIndex((row) => row.includes(""));
// 空文字列がない(indexが-1)場合は5をセット
const round = index !== -1 ? index : 5;
// console.log("round", round, "index", index);

loadDataSetters.setRound(round+1);

Expand All @@ -41,14 +39,14 @@ export const loadGameData = (todaysNo: number, correctAnswer: string, loadDataSe
}

// ゲームの状態をセット
loadDataSetters.setGameState(checkClear(correctAnswer, answerList, round));
loadDataSetters.setGameState(checkClear(correctAnswer, answerList, round+1));

// マッチリストをセット
const matchList = calcMatchList(answerList, correctAnswer, round)
const matchList = calcMatchList(answerList, correctAnswer, round+1)
loadDataSetters.setMatchList(matchList);

// 使用したアルファベットをセット
loadDataSetters.setAlphabetMatch(calcAlphabetMatch(answerList, matchList, round));
loadDataSetters.setAlphabetMatch(calcAlphabetMatch(answerList, matchList, round+1));
}

const resetGameData = () => {
Expand Down

0 comments on commit 18106d5

Please sign in to comment.