Skip to content

Commit ac5d9f8

Browse files
committed
fixed level calculating
1 parent 8f86450 commit ac5d9f8

File tree

7 files changed

+11
-6
lines changed

7 files changed

+11
-6
lines changed

env.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ void Env::calcLevel() {
9090
ratio = 0.5;
9191
}
9292
else {
93-
(double)statList[i]->getKnown() / statList[i]->getTotal();
93+
ratio = (double)statList[i]->getKnown() / statList[i]->getTotal();
9494
}
9595
if (ratio > 0.9) {
9696
basic->setLevel((i + 1) * (LEVEL_MAX / DIFFI_NUM)
97-
+ (LEVEL_MAX / DIFFI_NUM) * ratio * 0.5);
97+
+ (LEVEL_MAX / DIFFI_NUM) * ratio * 0.8);
9898
if (basic->getLevel() > LEVEL_MAX) {
9999
basic->setLevel(LEVEL_MAX);
100100
}

env.h

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define ENV_H
33

44
#include <fstream>
5+
#include <cstdlib>
6+
#include <ctime>
57
#include "util.h"
68
#include "info.h"
79
#include "def.h"

interaction.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ string LearnOneWord::getWord() {
7474

7575
void LearnOneWord::ask() {
7676
word = sstra->next(diffi);
77+
cout << " @@@@diffi: " << diffi << endl;
7778
fstra->setWord(word);
7879
cout << fstra->display();
7980
}

program.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ void Program::show() {
1111
login();
1212
for (;;) {
1313
//TODO
14-
RandomSelection* rs = new RandomSelection(env);
14+
//RandomSelection* rs = new RandomSelection(env);
15+
SmartSelection* ss = new SmartSelection(env);
1516
RemOrNotForm* ronf = new RemOrNotForm();
16-
MainInterface mi(env, rs, ronf);
17+
MainInterface mi(env, ss, ronf);
1718
mi.work();
1819
if (mi.toQuit()) {
1920
break;

strategy.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "strategy.h"
22

33
SelectStrategy::SelectStrategy(Env* env) : env(env), diffi(0) {
4+
srand(time(0));
45
}
56

67
string SelectStrategy::next(int& difficulty) {
@@ -67,7 +68,6 @@ RandomSelection::RandomSelection(Env* env) : SelectStrategy(env) {
6768
}
6869

6970
int RandomSelection::chooseDifficulty() {
70-
srand(time(0));
7171
return rand() % DIFFI_NUM;
7272
}
7373

user/userlist.dat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!ZXCroon

vocabulary/def.dat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@
12141214
}
12151215

12161216
*feel* {
1217-
#n. an intuitive awareness; #
1217+
#n. an intuitive awareness;#
12181218
#n. the general atmosphere of a place or situation and the effect that it has on people#
12191219
#n. a property perceived by touch#
12201220
#v. undergo an emotional sensation or be in a particular state of mind#

0 commit comments

Comments
 (0)