├── LICENSE
├── README.md
├── screenshots
├── fibonacci_series.png
├── guess_the_number.png
├── math_quiz.png
└── word_scramble.png
└── src
├── FibonacciSeries.dart
├── GuessTheNumber.dart
├── MathQuiz.dart
└── WordScramble.dart
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Shavinda Dizz / Nova
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ❮ Skills Training ❯
3 |
4 | Dart Language
5 |
6 |
7 |
8 |
9 | ### Learning Goals
10 | The primary goal of these projects is to reinforce basic programming skills while creating interactive and fun games. Each game focuses on specific fundamental concepts that are essential for mastering programming logic and flow.
11 |
12 |
13 |
14 | ❱ Online Dart compiler to run Dart program online
15 | ```md
16 | https://www.tutorialspoint.com/execute_dart_online.php
17 | ```
--------------------------------------------------------------------------------
/screenshots/fibonacci_series.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NovaLogics/skills-training-cli-dart/90b4edc443b8a44b4e70f3792b6663945cc87709/screenshots/fibonacci_series.png
--------------------------------------------------------------------------------
/screenshots/guess_the_number.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NovaLogics/skills-training-cli-dart/90b4edc443b8a44b4e70f3792b6663945cc87709/screenshots/guess_the_number.png
--------------------------------------------------------------------------------
/screenshots/math_quiz.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NovaLogics/skills-training-cli-dart/90b4edc443b8a44b4e70f3792b6663945cc87709/screenshots/math_quiz.png
--------------------------------------------------------------------------------
/screenshots/word_scramble.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NovaLogics/skills-training-cli-dart/90b4edc443b8a44b4e70f3792b6663945cc87709/screenshots/word_scramble.png
--------------------------------------------------------------------------------
/src/FibonacciSeries.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | // Fibonacci Series
4 |
5 | void main() {
6 | print("Enter the number of terms in the Fibonacci series:");
7 |
8 | int numTerms = int.parse(stdin.readLineSync()!);
9 |
10 | // Initialize the first two terms of the Fibonacci series
11 | int firstTerm = 0, secondTerm = 1;
12 |
13 | print("_________________");
14 | print("Fibonacci series:");
15 |
16 | for (int i = 0; i < numTerms; i++) {
17 | // Output the current term
18 | stdout.write("$firstTerm ");
19 |
20 | // Calculate the next term
21 | int nextTerm = firstTerm + secondTerm;
22 |
23 | // Update the terms for the next iteration
24 | firstTerm = secondTerm;
25 | secondTerm = nextTerm;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/GuessTheNumber.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'dart:math';
3 |
4 | //Guess the Number
5 |
6 | void main() {
7 | // Generate a random number between 1 and 100
8 | Random random = Random();
9 | int numberToGuess = random.nextInt(100) + 1;
10 |
11 | int guess;
12 | int numberOfTries = 0;
13 |
14 | print("Welcome to Guess the Number!");
15 | print("Guess a number between 1 and 100");
16 | print("_______________________________");
17 |
18 | // Loop until the correct number is guessed
19 | do {
20 | print("\n> Enter your guess:");
21 |
22 | numberOfTries++;
23 |
24 | guess = int.parse(stdin.readLineSync()!);
25 |
26 | if (guess > numberToGuess) {
27 | print("Too high!");
28 | } else if (guess < numberToGuess) {
29 | print("Too low!");
30 | } else {
31 | print("_______ Congratulations! _______");
32 | print("You've guessed the number in $numberOfTries tries.");
33 | print("_______________________________");
34 | }
35 | } while (guess != numberToGuess);
36 | }
37 |
--------------------------------------------------------------------------------
/src/MathQuiz.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'dart:math';
3 |
4 | // Math Quiz
5 |
6 | void main() {
7 | Random random = Random();
8 | int correctAnswers = 0;
9 |
10 | print("Welcome to the Math Quiz!");
11 | print("___________________________");
12 |
13 | // Quiz the user with 5 questions
14 | for (int i = 0; i < 5; i++) {
15 | int num1 = random.nextInt(10) + 1;
16 | int num2 = random.nextInt(10) + 1;
17 |
18 | print("\n> Question ${i + 1}");
19 | print("What is $num1 + $num2?");
20 | int userAnswer = int.parse(stdin.readLineSync()!);
21 |
22 | // Check if the answer is correct
23 | if (userAnswer == num1 + num2) {
24 | print("🗸 Correct!");
25 | correctAnswers++;
26 | } else {
27 | print("ⓧ Wrong. The correct answer is ${num1 + num2}");
28 | }
29 | }
30 |
31 | // Display the final score
32 | print("___________________________");
33 | print("You got $correctAnswers out of 5 correct.");
34 | }
35 |
--------------------------------------------------------------------------------
/src/WordScramble.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'dart:math';
3 |
4 | // Word Scramble
5 |
6 | void main() {
7 | List words = ["apple", "banana", "orange", "grape", "pear"];
8 | Random random = Random();
9 |
10 | String word = words[random.nextInt(words.length)];
11 | String scrambledWord = scramble(word);
12 |
13 | // Show the scrambled word to the user
14 | print("Unscramble this word: $scrambledWord");
15 | print("_________________________________________");
16 |
17 | String guess = stdin.readLineSync()!;
18 |
19 | print("_________________________________________");
20 | // Check if the user's guess is correct
21 | if (guess == word) {
22 | print("🗸 Correct!");
23 | } else {
24 | print("ⓧ Sorry, the correct word was >> $word <<");
25 | }
26 | }
27 |
28 | // Function to scramble the letters of a word
29 | String scramble(String word) {
30 | List letters = word.split('');
31 | letters.shuffle();
32 | return letters.join();
33 | }
34 |
--------------------------------------------------------------------------------