Skip to content
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

adding 2048, init of chess #24

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
| 2 | Quest | BizzCard | 1 day | [github.com](./subjects/flutter_piscine/bizzCard) |
| 3 | Quest | QuizApp | 1 day | [github.com](./subjects/flutter_piscine/quizApp) |
| 4 | Quest | MovieList | 2 days | [github.com](./subjects/flutter_piscine/movieList) |
| 5 | Rush | Hackernews | 2 days | [github.com](./subjects/flutter_piscine/hackernews) |
| 5 | Raid | Hackernews | 2 days | [github.com](./subjects/flutter_piscine/hackernews) |
| 6 | Quest | FavouriteImages | 1 day | [github.com](./subjects/flutter_piscine/favoriteImages) |
| 7 | Quest | Bouncer | 1 day | [github.com](./subjects/flutter_piscine/bouncer) |
| 8 | Quest | 01Map | 1 day | [github.com](./subjects/flutter_piscine/01Maps) |
| 9 | Quest | BlocCounter | 2 days | [github.com](./subjects/flutter_piscine/blocCounter) |
| 10 | Rush | SecureNotes | 2 days | [github.com](./subjects/flutter_piscine/secureNotes) |
| 7 | Quest | Bouncer | 2 days | [github.com](./subjects/flutter_piscine/bouncer) |
| 8 | Quest | 01Map | 2 days | [github.com](./subjects/flutter_piscine/01Maps) |
| 9 | Raid | SecureNotes | 2 days | [github.com](./subjects/flutter_piscine/secureNotes) |
| 10 | Quest | Package | 1 day | [github.com](./subjects/flutter_piscine/blocCounter) |
| 11 | Quest | BlocCounter | 2 days | [github.com](./subjects/flutter_piscine/blocCounter) |



Expand Down
Binary file added resources/2048.01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion subjects/flutter_piscine/week01/day01/ex01/intro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Dart is a programming language designed for client development, such as for the web and mobile apps. It is developed by Google and can also be used to build server and desktop applications. Dart is an object-oriented, class-based, garbage-collected language with C-style syntax.

Dart (within Flutter) is used to develop cross platform applications for Android, iOS, Linux, macOS, Windows, Google Fuchsia, and the web from a single codebase.
Dart (within Flutter framework) is used to develop cross platform applications for Android, iOS, Linux, macOS, Windows, Google Fuchsia, and the web from a single codebase.

Let's start with standard programming language tradition, write your first `"Hello, world!"` in Dart.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
In Dart you can declare variables in two ways:

```dart
var str1 = 'Patrick';
var strPatrick = 'Patrick';
// or ...
String str2 = 'Spongebob';
String strSpongebob = 'Spongebob';
```

- The first way declares using `var` which detects variable types automatically.
Expand All @@ -14,7 +14,7 @@ String str2 = 'Spongebob';
Declare and initialize following variables:

- `obj` of type `Object` containing any value;
- `planet` of type `String` containing planet's name you live in;
- `planet` of type `String` containing planet's name you live on;
- `year` of type `int` containing current year;
- `lucky` of type `bool` containing true of false (you decide);
- constant `pi` of type `double` containing pi value with 2 decimal points;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ List<int> listNum2 = [1, 2, 3];

### Set

Set is an unordered collection of unique items. Sets are created as:
Set is an unordered collection of unique items. Sets are created as follows:

```dart
var set1 = {'Germany', 'Kazakhstan', 'France'};
var set1 = {'Germany', 'Kazakhstan', 'France', 'Englang'};
// or ...
Set<String> set2 = {'Germany', 'Kazakhstan', 'France'};
Set<String> set2 = {'Germany', 'Kazakhstan', 'France', 'England'};
```

### Map

Map is a key-value data structure. Maps are created as:

```dart
var map1 = {
var mapRadius = {
'Earth': 6378.1,
'Jupiter': 71492,
'Moon': 1738.1,
};
// or ...
Map<String, double> map1 = {
Map<String, double> mapRadius = {
'Earth': 6378.1,
'Jupiter': 71492,
'Moon': 1738.1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bool isEven(int num) {
}
```

---


### **Exercise**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
In Dart you can declare functions that require explicit naming for arguments. Compare 2 functions below.

```dart
// Instead of
// Example 1
void someFunction(bool bold, bool hidden) {...}

someFunction(true, false);
```

```dart

// Example 2
// Now you must specify which argument you are referring to
void someFunction({bool? bold, bool? hidden}) {...}

someFunction(bold: true, hidden: false);
```

This way you must specify the name of argument each time you call a function. You can also skip parameter by simply not specifying its name and value.
This way you must specify the name of argument each time you call a function. You can also skip parameter by simply not specifying its name and value. What do you think will be default value for skipped parameters?

### Null safety

Expand All @@ -31,5 +31,5 @@ What happens if the argument of the function is optional and it is omitted? It s

### **Exercise**

Write a function that accepts named parameters "first", "second", "third" and returns the sum of them. All the parameters are integers. Absent parameters are considered as 0. Name of the function - namedOptionalSum.
Write a function that accepts named parameters "first", "second", "third" and returns the sum of them. All the parameters are integers. Absent parameters should be considered as 0. Name of the function - namedOptionalSum.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void main() {

> **Note:** Optional parameters **must** come after the required parameters.

> **Note:** you cannot use both optional and named parameters, you should choose **one** of them.
> **Note:** One cannot use both optional and named parameters, you should choose **only one** of them.

### **Exercise**

Expand Down
13 changes: 7 additions & 6 deletions subjects/flutter_piscine/week01/day01/ex09/person/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ class Point {
}
```

**Point** - name of the class, **x, y** - are fields
**Point** - name of the class, **x, y** - are fields/attributes.

What if one wants to create a Point with different x and y? To do that one needs to declare **_Constructor_** - a function that specifies how to create object of a class given a set of parameters.
What if one wants to initiate a Point with different x and y? To do that one needs to declare **_Constructor_** - a function that specifies how to create object of a class given a set of parameters.

```dart
class Point {
double x = 0; // field
double y = 0; // field
double x = 0; // field/attribute
double y = 0; // field/attribute

Point(double x, double y) { //Constructor
// Constructor
Point(double x, double y) {
this.x = x; // initializing fields
this.y = y; // In geometry, points must have x and y coordinates
this.y = y; // In 2D geometry, points must have x and y coordinates
}
}
```
Expand Down
13 changes: 7 additions & 6 deletions subjects/flutter_piscine/week01/day01/ex10/circle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Getters and setters

To work with objects' fields, either getting some information, or changing it, we have to use methods, as it might not be a good idea to directly change object's fields.
To work with objects' fields, either getting some information, or changing it, we should use methods, as it might not be a good idea to directly change object's fields.

An example of this principle is hunger - you should not change person's hunger level directly, but feed them instead. Since it is common to set or get fields' values, it is common to put getters and setters in the OOP.

Expand All @@ -12,27 +12,28 @@ Syntax of the getters and setters:

```dart
class Rectangle {
double left, top, width, height;
double l, t, w, h;

Rectangle(this.left, this.top, this.width, this.height);
Rectangle(this.l, this.t, this.w, this.h);

double get right => this.left + this.width;
double get right => this.l + this.w;

set left(double value) {
if (value >= 0) {
this.left = value;
this.l = value;
} else {
throw new FormatException();
}
}

double get bottom => this.top - this.height;
double get bottom => this.t - this.h;

}

void main() {
var rect = Rectangle(3, 4, 20, 15);
rect.left = 12;
print(rect.l);
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

Sometimes we need to limit access to class attributes so that it can be accessed only from the class itself. This concept is called **Encapsulation.**

In Dart you can make attributes private (meaning that they can be changed or used only in the instances of this class) by putting underscore (_) in the beginning of fields' or methods' name.
In Dart one can make attributes **private** (meaning that they can be changed or used only in the instances of this class) by putting underscore (_) in the beginning of fields' or methods' name.


Bear in mind that on a class level there is no Encapsulation in Dart. According to Dart's documentation:
Bear in mind that in Dart there is no Encapsulation on a class level. According to Dart's documentation:

> Importing libraries can help you create a modular and shareable code base. Libraries not only provide APIs, but are unit of privacy: private variables, i.e. starting with an underscore (_) are visible only inside the library. Every Dart app is a library, even if it doesn’t use a library directive.

Expand Down
10 changes: 5 additions & 5 deletions subjects/flutter_piscine/week01/day02/bizzCard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Hint: You can see some Flutter samples [here](https://flutter.github.io/samples/

BizzCard is a simple application which shows a static card with your personal information.

This subject is divided into 3 parts. Overall **objective** is:
This subject is divided into 3 parts. Overall **objective** is for you to learn:

- Learn about and apply the essence of Flutter - widgets.
- About and apply the essence of Flutter - widgets.
- Basic structure of a Flutter app.
- How to run Flutter app on physical device or Android/iOS emulator.

Expand All @@ -36,7 +36,7 @@ In this part:
- Run Flutter generated counter app
- Understand structure of the Flutter app

To create your first Flutter application open Android Studio and follow the steps:
To create your first Flutter application open Android Studio or similar IDE and follow the steps:

1. Open the IDE and select **Start a new Flutter project**.
2. Select **Flutter Application** as the project type. Then click **Next**.
Expand All @@ -46,7 +46,7 @@ To create your first Flutter application open Android Studio and follow the step
5. Click **Finish**.
6. Wait for Android Studio to install the SDK and create the project.

See the Run the app section in [https://flutter.dev/docs/get-started/test-drive?tab=androidstudio#create-app](https://flutter.dev/docs/get-started/test-drive?tab=androidstudio#create-app) to run a sample app.
See the Run the app section [here](https://flutter.dev/docs/get-started/test-drive?tab=androidstudio#create-app) to run a sample app.

The starter point in Flutter app is in lib/main.dart. Change this file to change app's behavior.

Expand All @@ -65,7 +65,7 @@ Try to make it as it is shown in the example below:
<!-- </center> -->
</center>

Possible diagram of widget tree for the app: https://flutter.dev/docs/development/ui/layout
Possible [diagram](https://flutter.dev/docs/development/ui/layout) of widget tree for the app.


#### Helpful keywords for research:
Expand Down
12 changes: 6 additions & 6 deletions subjects/flutter_piscine/week01/day02/bizzCard/audit/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#### Functional

#### In order to run and hot reload app either on emulator or device, follow the [instructions](https://docs.flutter.dev/get-started/test-drive?tab=androidstudio#run-the-app).

###### Was the app committed within the required time period?

###### Does the app run without crashes?

###### Are imported packages either package:flutter/ or dart standard packages?

###### Does the app show image, full name, email address, phone number, etc?
###### Only standard Flutter packages and url_launcher (for bonus) are allowed, is that the case in the app?

###### Does the app use local assets to store an image?
###### Does the app display image, full name, age, email address, phone number?

#### Bonus:

###### +Does the app generate qr-code?
###### +Does the app use local assets to store an image?

###### +Does qr have all the displayed information?
###### +Does the app generate qr-code that displays information shown as text?
23 changes: 12 additions & 11 deletions subjects/flutter_piscine/week01/day03/quizApp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

### Introduction

Develop a [**stateful app**](https://docs.flutter.dev/development/ui/interactive) that displays categories that you can choose from, i.e. history, pop culture, math, geography, etc (add name, and appropriate image).
Develop a [**stateful Quiz app**](https://docs.flutter.dev/development/ui/interactive) that displays categories that you can choose questions from.
Possible categories: history, pop culture, math, geography, etc (appropriate name, image must be added to all categories).

After tapping on the category the new route must show a corresponding image to the category, the question itself, true/false buttons.

Next, after tapping on the category the new route must show a corresponding image to the category, the question itself, true/false buttons.
After the question has been answered, you must let the user know if the question was answered correctly.

After the question has been answered, you must let the user know if the question was answered correctly.
After the quiz is finished, user must see their result.
After the quiz is finished, a user must see their result.

### Objective

Expand All @@ -24,7 +25,7 @@ After the quiz is finished, user must see their result.

### Categories page:

- Grid list view of categories with appropriate images and names. Make at least 5 categories and at least 10 questions to each quiz. Show 2 categories in a row.
- **Grid list** view of categories with appropriate images and names. Make at least 5 categories and at least 10 questions to each quiz. Show 2 categories in a row.
- Your app should have models for Question and Categories:

```jsx
Expand All @@ -49,7 +50,7 @@ class Category {

> Note: you can style the app as you want

> Note: only standard Dart package, package:flutter
> Note: only standard Dart package, package:flutter are allowed.



Expand All @@ -62,9 +63,9 @@ class Category {

### Navigation and routing:

- When tapping on category push screen to DetailedView, which shows appropriate image, question and true/false buttons
- Create a stateful widget, so you can change page's state. [Example](https://flutter.dev/docs/development/ui/interactive)
- When answering question change color of button or background, so the user know that answer is wrong or right
- When tapping on category push screen to **DetailedView**, which shows appropriate image, question and true/false buttons
- Create a stateful widget, so you can change page's [state](https://flutter.dev/docs/development/ui/interactive).
- When answering question change color of button or background, so the user know that answer is right or wrong.

<center>
<img src="https://github.com/alem-01/alem_public/blob/master/resources/quizApp.01.png?raw=true" style = "width: 210px !important; height: 420px !important;"/>
Expand All @@ -74,7 +75,7 @@ class Category {

## Third part

When all question are answered show the score on a new page
When all questions are answered show the score on a new page.

- It should have Text with score and button which returns user to the main page

Expand All @@ -84,4 +85,4 @@ When all question are answered show the score on a new page
</center>

### **Bonus**
Add a timer to each question, so the user must answer a question in a fixed time
Add a timer to each question, so the user must answer a question in a fixed time. After time is up, question should be marked as answered incorrectly and omitted.
14 changes: 10 additions & 4 deletions subjects/flutter_piscine/week01/day03/quizApp/audit/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#### Functional

#### In order to run and hot reload app either on emulator or device, follow the [instructions](https://docs.flutter.dev/get-started/test-drive?tab=androidstudio#run-the-app).


###### Does the app run without crashes?

###### Is the app stateful?
###### Does the app change states as it is being used, i.e. is it stateful?

###### Are there at least 5 categories?

Expand All @@ -14,14 +17,17 @@

###### Are there question text, image, and true/false buttons on the page containing questions?

###### Does tapping the true/false button let the user know the answer?
###### Does tapping the true/false button let the user know the answer, and contribute to score correctly?

###### Does the last page correctly display the score?
###### Does the last page correctly display the score, and button to go to main page?

###### Does the app behave as it is supposed to?

#### Bonus:

###### +Are there images for all the questions?

###### +Are there any animations when question is answered?
###### +When question is not answered within given time, is it considered as not answered?

###### +When question is not answered within given time, is it omitted and next one shown?

Loading