Update app.py
Browse files
app.py
CHANGED
@@ -21,12 +21,10 @@ for i, col in enumerate(cols):
|
|
21 |
|
22 |
def predict_result():
|
23 |
outcomes = ["Bầu", "Cua", "Tôm", "Cá", "Gà", "Nai"]
|
24 |
-
results = []
|
25 |
-
shake_count =
|
26 |
|
27 |
while True:
|
28 |
-
shake_count += 1
|
29 |
-
results.append(random.choice(outcomes))
|
30 |
result_counts = Counter(results)
|
31 |
sorted_results = sorted(result_counts.items(), key=lambda x: x[1], reverse=True)
|
32 |
|
@@ -37,6 +35,10 @@ def predict_result():
|
|
37 |
|
38 |
if (rank_1_pct - rank_2_pct) > 0.03: # Chênh lệch > 3%
|
39 |
break
|
|
|
|
|
|
|
|
|
40 |
|
41 |
# Hiển thị kết quả
|
42 |
result_text = f"Số lần lắc: {shake_count}\n\nKết quả:\n"
|
|
|
21 |
|
22 |
def predict_result():
|
23 |
outcomes = ["Bầu", "Cua", "Tôm", "Cá", "Gà", "Nai"]
|
24 |
+
results = [random.choice(outcomes) for _ in range(500)] # Lắc ban đầu 500 lần
|
25 |
+
shake_count = 500 # Đếm số lần lắc
|
26 |
|
27 |
while True:
|
|
|
|
|
28 |
result_counts = Counter(results)
|
29 |
sorted_results = sorted(result_counts.items(), key=lambda x: x[1], reverse=True)
|
30 |
|
|
|
35 |
|
36 |
if (rank_1_pct - rank_2_pct) > 0.03: # Chênh lệch > 3%
|
37 |
break
|
38 |
+
|
39 |
+
# Nếu chưa đạt yêu cầu, tiếp tục lắc từng lần một
|
40 |
+
results.append(random.choice(outcomes))
|
41 |
+
shake_count += 1
|
42 |
|
43 |
# Hiển thị kết quả
|
44 |
result_text = f"Số lần lắc: {shake_count}\n\nKết quả:\n"
|