-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDictionary.h
More file actions
60 lines (43 loc) · 1.63 KB
/
Dictionary.h
File metadata and controls
60 lines (43 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef DICTIONARY_H
#define DICTIONARY_H
#include <string>
#include <vector>
#include <map>
class Dictionary
{
private:
// 레벨별 문장 저장 (key: 레벨, value: 문장 리스트)
std::map<int, std::vector<std::string>> levelSentences;
// 현재 로드된 문장의 단어들
std::vector<std::string> currentWords;
// 현재 레벨과 문장 인덱스
int currentLevel;
int currentSentenceIndex;
public:
// 생성자
Dictionary();
// 소멸자
~Dictionary() {}
// 초기 문장 데이터 로드
void initializeSentences();
// 레벨별 문장 개수 반환
int getSentenceCount(int level) const;
// 특정 레벨의 특정 문장을 8개 단어로 분리하여 반환
std::vector<std::string> getWordsForLevel(int level, int sentenceIndex);
// 특정 레벨의 특정 문장 전체를 반환
std::string getFullSentence(int level, int sentenceIndex) const;
// 현재 로드된 단어들 반환
const std::vector<std::string>& getCurrentWords() const { return currentWords; }
// 랜덤으로 레벨에 맞는 문장 선택
std::vector<std::string> getRandomSentenceWords(int level);
// 현재 레벨 반환
int getCurrentLevel() const { return currentLevel; }
// 현재 문장 인덱스 반환
int getCurrentSentenceIndex() const { return currentSentenceIndex; }
private:
// 문장을 단어로 분리하는 헬퍼 함수
std::vector<std::string> splitSentenceIntoWords(const std::string& sentence);
// 랜덤 시드 초기화
void initRandomSeed();
};
#endif // DICTIONARY_H