-
Notifications
You must be signed in to change notification settings - Fork 21
Lab1 #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Lab1 #10
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <module type="JAVA_MODULE" version="4"> | ||
| <component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
| <exclude-output /> | ||
| <content url="file://$MODULE_DIR$"> | ||
| <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
| </content> | ||
| <orderEntry type="inheritedJdk" /> | ||
| <orderEntry type="sourceFolder" forTests="false" /> | ||
| </component> | ||
| </module> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| В Полотняной стране По реке Простыне Плывет пароход То назад, то вперед, А за ним такая гладь — Ни морщинки не видать. | ||
| Утюг | ||
| Стоит дуб, В нем двенадцать гнезд, В каждом гнезде По четыре яйца, В каждом яйце По семи цыпленков. | ||
| Год | ||
| Музыкант, певец, рассказчик — А всего труба да ящик. | ||
| Граммофон | ||
| Из стены торчу, Головой кручу, Мою и пою Целую семью. | ||
| Душ | ||
| Под гору — коняшка, в гору — деревяшка. | ||
| Санки | ||
| Сидит в темнице, красная девица, а коса на улице. | ||
| Морковь | ||
| Зимой — звезда, весной — вода. | ||
| Снежинка | ||
| Кто зимой холодной ходит злой, голодный? | ||
| Волк | ||
| Белые поросятки прилегли на грядке. | ||
| Кабачки |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| Продолжите знаменитую фразу: "Ноль, ноль, ноль и так далее ..." | ||
| Ноль | ||
| Мы считали дырки в сыре три плюс два равно | ||
| Пять | ||
| Самое большое млекопитающее | ||
| Синий кит | ||
| Какой балл нужно поставить мне за лабу | ||
| Высокий | ||
| Напишите "Прикол" | ||
| хы | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| package by.Savenok.quizer; | ||
|
|
||
| import by.Savenok.quizer.task_generators.TaskGenerator; | ||
| import by.Savenok.quizer.task_generators.math_task_generators.EquationTaskGenerator; | ||
| import by.Savenok.quizer.task_generators.math_task_generators.ExpressionTaskGenerator; | ||
| import by.Savenok.quizer.task_generators.TextTaskGenerator; | ||
|
|
||
| import java.io.*; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.Objects; | ||
| import java.util.Scanner; | ||
|
|
||
|
|
||
| public class Main { | ||
| static Map<String, Quiz> getQuizMap() throws FileNotFoundException { | ||
| Map<String, Quiz> generators = new HashMap<>(); | ||
| generators.put("Expression mode (5 tasks)", | ||
| new Quiz(new ExpressionTaskGenerator(0, 100, true, true, true, true), 5)); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Консанты лучше в отдельный файлик. |
||
| generators.put("Expression mode (10 tasks)", | ||
| new Quiz(new ExpressionTaskGenerator(0, 100, true, true, true, true), 10)); | ||
| generators.put("Expression mode (15 tasks)", | ||
| new Quiz(new ExpressionTaskGenerator(0, 100, true, true, true, true), 15)); | ||
| generators.put("Equation mode (5 tasks)", | ||
| new Quiz(new EquationTaskGenerator(0, 100, true, true, true, true), 5)); | ||
| generators.put("Equation mode (10 tasks)", | ||
| new Quiz(new EquationTaskGenerator(0, 100, true, true, true, true), 10)); | ||
| generators.put("Equation mode (15 tasks)", | ||
| new Quiz(new EquationTaskGenerator(0, 100, true, true, true, true), 15)); | ||
| generators.put("Text mode (3 tasks)", | ||
| new Quiz(new TextTaskGenerator(TextTaskGenerator.DifficultyLevel.HARD), 3)); | ||
| generators.put("Text mode (2 tasks)", | ||
| new Quiz(new TextTaskGenerator(TextTaskGenerator.DifficultyLevel.NIGHTMARE), 2)); | ||
| return generators; | ||
| } | ||
| public static void main(String[] args) throws FileNotFoundException { | ||
| System.out.print("Want to create your mode or chose an existing one? (YES/NO)"); | ||
| Scanner in = new Scanner(System.in); | ||
| if (Objects.equals(in.nextLine(), "YES")) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Тут это не совсемм уместно, так как приложение тестит тебя, а не ты создаешь тесты. Но так как этого никто не просил, а ты сделал, то немного накину. |
||
| System.out.println("Choose task mode:"); | ||
| System.out.println("Expression / Equation / Text"); | ||
| String custom_mode = in.nextLine(); | ||
| System.out.println("Enter task count:"); | ||
| String custom_task_count = in.nextLine(); | ||
| if (Objects.equals(custom_mode, "Text")) { | ||
| System.out.println("Enter difficulty level:"); | ||
| System.out.println("Hard / Nightmare"); | ||
| String custom_level = in.nextLine(); | ||
| if (Objects.equals(custom_level, "Hard")) { | ||
| Quiz quiz = new Quiz(new TextTaskGenerator(TextTaskGenerator.DifficultyLevel.HARD), | ||
| Integer.parseInt(custom_task_count)); | ||
| quiz.StartQuiz(); | ||
| } else { | ||
| new Quiz(new TextTaskGenerator(TextTaskGenerator.DifficultyLevel.NIGHTMARE), | ||
| Integer.parseInt(custom_task_count)).StartQuiz(); | ||
| return; | ||
| } | ||
| } else { | ||
| System.out.println("Enable sum tasks?"); | ||
| System.out.println("Yes / No"); | ||
| String blank = in.nextLine(); | ||
| boolean sum = false; | ||
| if (Objects.equals(blank, "Yes")) { | ||
| sum = true; | ||
| } | ||
| System.out.println("Enable difference tasks?"); | ||
| System.out.println("Yes / No"); | ||
| blank = in.nextLine(); | ||
| boolean dif = false; | ||
| if (Objects.equals(blank, "Yes")) { | ||
| dif = true; | ||
| } | ||
| System.out.println("Enable multiply tasks?"); | ||
| System.out.println("Yes / No"); | ||
| blank = in.nextLine(); | ||
| boolean mul = false; | ||
| if (Objects.equals(blank, "Yes")) { | ||
| mul = true; | ||
| } | ||
| System.out.println("Enable sum tasks?"); | ||
| System.out.println("Yes / No"); | ||
| blank = in.nextLine(); | ||
| boolean div = false; | ||
| if (Objects.equals(blank, "Yes")) { | ||
| div = true; | ||
| } | ||
| System.out.println("Enter max number"); | ||
| int max = Integer.parseInt(in.nextLine()); | ||
| System.out.println("Enter min number"); | ||
| int min = Integer.parseInt(in.nextLine()); | ||
|
|
||
| if (Objects.equals(custom_mode, "Expression")) { | ||
| new Quiz(new ExpressionTaskGenerator(min, max, sum,dif, mul, div), | ||
| Integer.parseInt(custom_task_count)).StartQuiz(); | ||
| return; | ||
| } | ||
| if (Objects.equals(custom_mode, "Equation")) { | ||
| new Quiz(new EquationTaskGenerator(min, max, sum,dif, mul, div), | ||
| Integer.parseInt(custom_task_count)).StartQuiz(); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| } | ||
| System.out.println("Choose task mode (Expression / Equation / Text):"); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Вообще не интуитивно понятно, я пока в код не залез ничего не смог запустить(( |
||
| Map<String, Quiz> generators = getQuizMap(); | ||
| for (Map.Entry<String, Quiz> it : generators.entrySet()) | ||
| { | ||
| System.out.println(it.getKey()); | ||
| } | ||
| String mode = in.nextLine(); | ||
| System.out.println("Choose tasks count:"); | ||
| String count = in.nextLine(); | ||
| generators.get(mode + " mode " + "(" + count + " tasks)").StartQuiz(); | ||
| in.close(); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нет!