Skip to content

Commit ec74610

Browse files
committed
feat: Enhance KMap functionality with don't care expressions and improved UI
- Added support for don't care expressions in KMapProvider. - Updated grid state management to handle don't care cells. - Introduced a toggle for displaying minimized SOP and POS expressions in the UI. - Enhanced KMapGrid to visually differentiate don't care cells. - Improved the minimization result display with a segmented button for SOP/POS selection. - Removed the deprecated SolverScreen widget and refactored related logic. - Added a detailed step explanation widget for better user guidance. - Updated pubspec.yaml with a more descriptive project description. - Updated icon assets for better visual representation.
1 parent 5620942 commit ec74610

22 files changed

Lines changed: 1298 additions & 370 deletions

GEMINI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class SimpliMapApp extends StatelessWidget {
206206
return Consumer<ThemeProvider>(
207207
builder: (context, themeProvider, child) {
208208
return MaterialApp(
209-
title: 'Flutter Material AI App',
209+
title: 'SimpliMap',
210210
theme: lightTheme,
211211
darkTheme: darkTheme,
212212
themeMode: themeProvider.themeMode,
645 KB
Loading
645 KB
Loading
645 KB
Loading
644 KB
Loading
644 KB
Loading

lib/logic/boolean_parser.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ class BooleanParser {
77
return [];
88
}
99

10+
// Check if expression uses minterm notation (m0, m1, m5, etc.)
11+
if (_isMintermNotation(expression)) {
12+
return _parseMintermNotation(expression, numVariables);
13+
}
14+
15+
// Otherwise, parse as traditional Boolean expression (ABCD)
1016
final variables = numVariables == 3 ? ['A', 'B', 'C'] : ['A', 'B', 'C', 'D'];
1117
final minterms = <int>{};
1218

@@ -23,6 +29,32 @@ class BooleanParser {
2329
return minterms.toList();
2430
}
2531

32+
bool _isMintermNotation(String expression) {
33+
// Check if expression contains minterm notation pattern (m followed by digits)
34+
return RegExp(r'\bm\d+\b', caseSensitive: false).hasMatch(expression);
35+
}
36+
37+
List<int> _parseMintermNotation(String expression, int numVariables) {
38+
final minterms = <int>{};
39+
final maxMinterm = pow(2, numVariables).toInt() - 1;
40+
41+
// Find all minterm numbers in the expression
42+
final regex = RegExp(r'\bm(\d+)\b', caseSensitive: false);
43+
final matches = regex.allMatches(expression);
44+
45+
for (final match in matches) {
46+
final mintermStr = match.group(1);
47+
if (mintermStr != null) {
48+
final mintermNum = int.tryParse(mintermStr);
49+
if (mintermNum != null && mintermNum >= 0 && mintermNum <= maxMinterm) {
50+
minterms.add(mintermNum);
51+
}
52+
}
53+
}
54+
55+
return minterms.toList();
56+
}
57+
2658
Set<int> _getMintermsForTerm(String term, List<String> variables) {
2759
final termMinterms = <int>{};
2860

0 commit comments

Comments
 (0)