Skip to content

Commit 537f7f0

Browse files
thamaraiselvamthamaraiselvam
authored andcommitted
code factor
1 parent 5fed04e commit 537f7f0

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/screens/GameScreen/GameScreen.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ class _GameScreenState extends State<GameScreen> {
9292
(this.gameHistory['success'] * costs['success']) +
9393
(this.gameHistory['fail'] * costs['fail']);
9494
this.gameHistory['score'] = score > 0 ? (score) : 0;
95-
print(this.gameHistory);
9695
}
9796

9897
void updateScores() {

lib/store/RecentScoreStore.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import 'dart:convert';
22
import 'package:numbers/service/RecentScoreService.dart';
3+
import 'package:numbers/utils/Config.dart';
34
import 'package:shared_preferences/shared_preferences.dart';
45

56
class RecentScoreStore {
67
SharedPreferences prefs;
78

89
final String scoreKey = 'recentScore';
9-
final maxStoreLength = 3;
10+
final maxStoreLength = maxKeepGameHistoryCount;
1011

1112
init() async {
1213
if (this.prefs == null) {
@@ -15,12 +16,12 @@ class RecentScoreStore {
1516
}
1617

1718
updateRecentScore(int score) async {
18-
1919
await this.init();
2020

2121
List recentScores = await this.getRecentScore();
2222

23-
RecentScore newScore = RecentScore.manualPush(score.toString(), DateTime.now().millisecondsSinceEpoch.toString());
23+
RecentScore newScore = RecentScore.manualPush(
24+
score.toString(), DateTime.now().millisecondsSinceEpoch.toString());
2425

2526
recentScores.insert(0, newScore);
2627

lib/utils/Config.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
const int gameDuration = 10;
22
const Map costs = {'success': 1000, 'fail': -500, 'block': 100};
3+
const int maxKeepGameHistoryCount = 6;

0 commit comments

Comments
 (0)