Update math
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,2 +1,3 @@
 | 
				
			|||||||
*.pyc
 | 
					*.pyc
 | 
				
			||||||
static/.DS_Store
 | 
					*.zip
 | 
				
			||||||
 | 
					.DS_Store
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								app/main.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								app/main.py
									
									
									
									
									
								
							@@ -78,17 +78,13 @@ class Session:
 | 
				
			|||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def _generate_questions(n: int) -> List[Dict]:
 | 
					    def _generate_questions(n: int) -> List[Dict]:
 | 
				
			||||||
        # Build unique unordered pairs (avoid mirrored duplicates like 6×8 and 8×6)
 | 
					        # Build unique unordered pairs (avoid mirrored duplicates like 6×8 and 8×6)
 | 
				
			||||||
        all_pairs = [(a, b) for a in range(2, 6) for b in range(a, 6)]  # a <= b
 | 
					        all_pairs = [(a, b) for a in range(2, 10) for b in range(2, 10)]  # a <= b
 | 
				
			||||||
        count = min(n, len(all_pairs))
 | 
					        count = min(n, len(all_pairs))
 | 
				
			||||||
 | 
					        print(count)
 | 
				
			||||||
        picked = random.sample(all_pairs, count)
 | 
					        picked = random.sample(all_pairs, count)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        questions: List[Dict] = []
 | 
					        questions: List[Dict] = []
 | 
				
			||||||
        for a0, b0 in picked:
 | 
					        for a, b in picked:
 | 
				
			||||||
            # Randomize order for variety while keeping uniqueness by unordered pair
 | 
					 | 
				
			||||||
            if random.random() < 0.5:
 | 
					 | 
				
			||||||
                a, b = a0, b0
 | 
					 | 
				
			||||||
            else:
 | 
					 | 
				
			||||||
                a, b = b0, a0
 | 
					 | 
				
			||||||
            correct = a * b
 | 
					            correct = a * b
 | 
				
			||||||
            options = Session._generate_options(a, b, correct)
 | 
					            options = Session._generate_options(a, b, correct)
 | 
				
			||||||
            questions.append({
 | 
					            questions.append({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,7 +71,7 @@ body {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
.result { margin-top: 18px; padding: 18px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
 | 
					.result { margin-top: 18px; padding: 18px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
 | 
				
			||||||
.result .score { font-size: 20px; margin-bottom: 8px; }
 | 
					.result .score { font-size: 20px; margin-bottom: 8px; }
 | 
				
			||||||
.again { padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: #0f172a; cursor: pointer; box-shadow: var(--shadow); }
 | 
					.again { margin-top: 1em; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: #0f172a; cursor: pointer; box-shadow: var(--shadow); }
 | 
				
			||||||
.again:hover { background: #f1f5f9; }
 | 
					.again:hover { background: #f1f5f9; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.hidden { display: none; }
 | 
					.hidden { display: none; }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user