package com.example.archermind.my2048;

import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.Toast;

import java.util.Arrays;

public class BlocksController {
    int[] data = new int[16];

    int empty_count = 16;
    private FrameLayout game_layout;
    private Context context;
    private int WIDTH = (int) Utils.WIDTH;
    private int[][][] positions;
    private BlockView[] blockViews = new BlockView[16];
    private int steps_all = 0;
    private int mScore;
    private GameController gc;

    BlocksController(Context context, View v, GameController controller) {
        gc = controller;
        this.context = context;
        game_layout = (FrameLayout) v;
        for (int i = 0; i < 16; i++) {
            data[i] = 0;
        }
        mScore = 0;
        positions = new int[][][]{
                {{0, 0}, {WIDTH / 4, 0}, {WIDTH / 2, 0}, {WIDTH * 3 / 4, 0}},
                {{0, WIDTH / 4}, {WIDTH / 4, WIDTH / 4}, {WIDTH / 2, WIDTH / 4}, {WIDTH * 3 / 4, WIDTH / 4}},
                {{0, WIDTH / 2}, {WIDTH / 4, WIDTH / 2}, {WIDTH / 2, WIDTH / 2}, {WIDTH * 3 / 4, WIDTH / 2}},
                {{0, WIDTH * 3 / 4}, {WIDTH / 4, WIDTH * 3 / 4}, {WIDTH / 2, WIDTH * 3 / 4}, {WIDTH * 3 / 4, WIDTH * 3 / 4}}
        };

    }

    public void handleMove(int dir) {
        switch (dir) {
            case Direction.UP:
            case Direction.DOWN:
                upOrDown(dir);
                break;
            case Direction.LEFT:
            case Direction.RIGHT:
                leftOrRight(dir);
                break;
            default:
                break;
        }
    }

    private void upOrDown(int dir) {
        int line = 0;
        while (line != 4) {
            int mergeCount;
            int[] pre = new int[4];
            for (int i = line; i < 16; i += 4) {
                pre[(i - line) / 4] = data[i];
            }
            if (pre[0] == 0 && pre[0] == pre[1] && pre[0] == pre[2] && pre[0] == pre[3]) {
                line++;
                continue;
            }
            mergeCount = getMergeCount(pre);
            doMove(dir, pre, line, mergeCount);
            line++;
        }
        if (steps_all != 0) {
            create(1);
            steps_all = 0;
        }
    }

    private void oneMergeDown(int[] pre, int line) {
        int[] post = new int[4];
        int first_position = 3;
        int[] temp = copyArr(pre);
        boolean mergeDone = false;
        for (int i = 3; i >= 0; i--) {
            if (temp[i] == 0) {
                continue;
            }
            //找相同
            for (int j = i - 1; j >= 0 && !mergeDone; ) {
                if (temp[i] != temp[j] && temp[j] != 0) {
                    if (!mergeDone && i != first_position) {
                        remove_blocks(line + i * 4);
                        _createBlockView(pre[i], line + 4 * first_position);
                    }
                    first_position--;
                    break;
                }

                if (temp[j] == temp[i]) {
                    temp[j] = 0;
                    post[first_position] = 2 * pre[i];
                    remove_blocks(line + i * 4);
                    remove_blocks(line + j * 4);
                    _createBlockView(2 * pre[i], 4 * first_position + line);
                    mergeDone = true;
                    i--;
                    first_position--;
                    break;
                }
                j--;
                //没找到相同
                if (j < 0 && !mergeDone) {
                    first_position--;
                }
            }
            //已经merge，只移动后排
            if (mergeDone) {
                if (temp[i] != 0) {
                    remove_blocks(line + i * 4);
                    _createBlockView(temp[i], 4 * first_position + line);
                    first_position--;
                }
            }
        }

    }

    private void oneMergeUp(int[] pre, int line) {
        int first_position = 0;
        int[] temp = copyArr(pre);
        boolean mergeDone = false;
        for (int i = 0; i < 4; i++) {
            if (temp[i] == 0) {
                continue;
            }
            //找相同
            for (int j = i + 1; j < 4 && !mergeDone; ) {
                if (temp[i] != temp[j] && temp[j] != 0) {
                    if (!mergeDone && i != first_position) {
                        remove_blocks(line + 4 * i);
                        _createBlockView(pre[i], line + 4 * first_position);
                    }
                    first_position++;
                    break;
                }

                if (temp[j] == temp[i]) {
                    temp[j] = 0;
                    remove_blocks(line + i * 4);
                    remove_blocks(line + j * 4);
                    _createBlockView(2 * pre[i], 4 * first_position + line);
                    mergeDone = true;
                    i++;
                    first_position++;
                    break;
                }
                j++;
                //没找到相同
                if (j == 4 && !mergeDone) {
                    first_position++;
                }
            }
            //已经merge，只移动后排
            if (mergeDone) {
                if (temp[i] != 0) {
                    remove_blocks(line + i * 4);
                    _createBlockView(temp[i], 4 * first_position + line);
                    first_position++;
                }
            }
        }
    }

    private void onlyMoveDown(int[] pre, int line) {
        int step = 0;
        for (int i = 3; i >= 0; i--) {
            if (pre[i] == 0) {
                step++;
            } else {
                if (step != 0) {
                    remove_blocks(4 * i + line);
                    _createBlockView(pre[i], 4 * (i + step) + line);
                }
            }
        }
    }

    private void onlyMoveUp(int[] pre, int line) {
        int step = 0;
        for (int i = 0; i < 4; i++) {
            if (pre[i] == 0) {
                step++;
            } else {
                if (step != 0) {
                    remove_blocks(4 * i + line);
                    _createBlockView(pre[i], 4 * (i - step) + line);
                }
            }
        }
    }

    public void leftOrRight(int dir) {
        int line = 0;
        while (line != 4) {
            int mergeCount = 0;
            int[] pre = new int[4];

            for (int i = 0; i < 4; i++) {
                pre[i] = data[4 * line + i];
            }
            if (pre[0] == 0 && pre[0] == pre[1] && pre[0] == pre[2] && pre[0] == pre[3]) {
                line++;
                continue;
            }
            mergeCount = getMergeCount(pre);
            doMove(dir, pre, line, mergeCount);
            line++;
        }

        if (steps_all != 0) {
            create(1);
            steps_all = 0;
        }

    }

    private void doMove(int dir, int[] pre, int line, int mergeCount) {

        if (mergeCount == 0) {
            if (dir == Direction.LEFT) {
                onlyMoveLeft(pre, line);
            } else if (dir == Direction.UP) {
                onlyMoveUp(pre, line);
            } else if (dir == Direction.RIGHT) {
                onlyMoveRight(pre, line);
            } else {
                onlyMoveDown(pre, line);
            }
        } else if (mergeCount == 1) {
            if (dir == Direction.LEFT) {
                oneMergeLeft(pre, line);
            } else if (dir == Direction.UP) {
                oneMergeUp(pre, line);
            } else if (dir == Direction.RIGHT) {
                oneMergeRight(pre, line);
            } else {
                oneMergeDown(pre, line);
            }
        } else {
            if (dir == Direction.LEFT) {
                twoMergeLeft(pre, line);
            } else if (dir == Direction.UP) {
                twoMergeUp(pre, line);
            } else if (dir == Direction.RIGHT) {
                twoMergeRight(pre, line);
            } else {
                twoMergeDown(pre, line);
            }
        }

        gc.updateScore(mScore + "");

    }

    public boolean gameIsOver() {
        boolean isOver = true;
        for (int i = 0; i < 16; i++) {
            isOver &= _BlockIsDead(i);
        }
        return isOver;
    }

    private boolean _BlockIsDead(int i) {
        if (i == 0) {
            //左上角
            return data[i] != data[i + 1] && data[i] != data[i + 4];
        } else if (i == 3) {
            //右上角
            return data[i] != data[i - 1] && data[i] != data[i + 4];
        } else if (i == 12) {
            //左下角
            return data[i] != data[i + 1] && data[i] != data[i - 4];
        } else if (i == 15) {
            //右下角
            return data[i] != data[i - 1] && data[i] != data[i - 4];
        } else if (i == 4 || i == 8) {
            //左边
            return data[i] != data[i + 1] && data[i] != data[i - 4] && data[i] != data[i + 4];
        } else if (i == 1 || i == 2) {
            //上边
            return data[i] != data[i + 1] && data[i] != data[i - 1] && data[i] != data[i + 4];
        } else if (i == 7 || i == 11) {
            //右边
            return data[i] != data[i - 1] && data[i] != data[i - 4] && data[i] != data[i + 4];
        } else if (i == 13 || i == 14) {
            //下边
            return data[i] != data[i + 1] && data[i] != data[i - 1] && data[i] != data[i - 4];
        } else
            //中间
            return data[i] != data[i + 1] && data[i] != data[i - 1] && data[i] != data[i + 4] && data[i] != data[i - 4];

    }

    private void twoMergeLeft(int[] pre, int line) {
        remove_blocks(4 * line);
        remove_blocks(4 * line + 1);
        _createBlockView(2 * pre[0], 4 * line);
        remove_blocks(4 * line + 2);
        remove_blocks(4 * line + 3);
        _createBlockView(2 * pre[2], 4 * line + 1);

    }

    private void twoMergeUp(int[] pre, int line) {
        remove_blocks(line);
        remove_blocks(line + 4);
        _createBlockView(2 * pre[0], line);

        remove_blocks(line + 8);
        remove_blocks(line + 12);
        _createBlockView(2 * pre[2], line + 4);
    }

    private void twoMergeRight(int[] pre, int line) {
        remove_blocks(4 * line + 2);
        remove_blocks(4 * line + 3);
        _createBlockView(2 * pre[2], 4 * line + 3);

        remove_blocks(4 * line);
        remove_blocks(4 * line + 1);
        _createBlockView(2 * pre[0], 4 * line + 2);

    }

    private void twoMergeDown(int[] pre, int line) {
        remove_blocks(line + 3 * 4);
        remove_blocks(line + 2 * 4);
        _createBlockView(2 * pre[3], line + 3 * 4);

        remove_blocks(line + 4);
        remove_blocks(line);
        _createBlockView(2 * pre[1], line + 2 * 4);
    }

    private int getMergeCount(int[] pre) {
        int mergeCount = 0;
        int[] temp = copyArr(pre);
        for (int i = 0; i < 4; i++) {
            if (temp[i] != 0) {
                for (int j = i + 1; j < 4; j++) {
                    if (temp[j] != 0 && temp[j] != temp[i]) {
                        break;
                    }
                    if (temp[i] == temp[j]) {
                        mergeCount++;
                        temp[j] = 0;
                        break;
                    }
                }
            }
        }
        return mergeCount;
    }

    private int[] copyArr(int[] pre) {
        int[] temp = new int[pre.length];
        for (int i = 0; i < pre.length; i++) {
            temp[i] = pre[i];
        }
        return temp;
    }

    private void onlyMoveLeft(int[] pre, int line) {
        int step = 0;
        for (int i = 0; i < 4; i++) {
            if (pre[i] == 0) {
                step++;
            } else {
                if (step != 0) {
                    remove_blocks(4 * line + i);
                    _createBlockView(pre[i], 4 * line + i - step);
                }
            }
        }
    }

    private void onlyMoveRight(int[] pre, int line) {
        int step = 0;
        for (int i = 3; i >= 0; i--) {
            if (pre[i] == 0) {
                step++;
            } else {
                if (step != 0) {
                    remove_blocks(4 * line + i);
                    _createBlockView(pre[i], 4 * line + i + step);
                }
            }
        }
    }

    private void oneMergeRight(int[] pre, int line) {
        //bug
        //[0 2 0 2]
        //[0 2 0 2]
        int first_position = 3;
        int[] temp = copyArr(pre);
        boolean mergeDone = false;
        for (int i = 3; i >= 0; i--) {

            if (pre[i] == 0) {
                continue;
            }
            for (int j = i - 1; j >= 0 && !mergeDone; ) {
                if (temp[i] != temp[j] && temp[j] != 0) {
                    if (!mergeDone && i != first_position) {
                        remove_blocks(4 * line + i);
                        _createBlockView(pre[i], 4 * line + first_position);
                    }
                    first_position--;
                    break;
                }

                if (temp[j] == temp[i]) {
                    temp[j] = 0;
                    remove_blocks(4 * line + i);
                    remove_blocks(4 * line + j);
                    _createBlockView(2 * pre[i], 4 * line + first_position);
                    mergeDone = true;
                    i--;
                    first_position--;
                    break;
                }
                j--;
                if (j == -1 && !mergeDone) {
                    first_position--;
                }
            }
            if (mergeDone) {
                if (temp[i] != 0) {
                    remove_blocks(4 * line + i);
                    _createBlockView(temp[i], 4 * line + first_position);
                    first_position--;
                }
            }
        }
    }

    private void oneMergeLeft(int[] pre, int line) {
        //
        //[0 64 32 32]
        int first_position = 0;
        int[] temp = copyArr(pre);
        boolean mergeDone = false;
        for (int i = 0; i < 4; i++) {
            if (temp[i] == 0) {
                continue;
            }
            //找相同
            for (int j = i + 1; j < 4 && !mergeDone; ) {
                if (temp[i] != temp[j] && temp[j] != 0) {
                    if (!mergeDone && i != first_position) {
                        remove_blocks(4 * line + i);
                        _createBlockView(pre[i], 4 * line + first_position);
                    }
                    first_position++;
                    break;
                }

                if (temp[j] == temp[i]) {
                    temp[j] = 0;
                    remove_blocks(4 * line + i);
                    remove_blocks(4 * line + j);
                    _createBlockView(2 * pre[i], 4 * line + first_position);
                    mergeDone = true;
                    i++;
                    first_position++;
                    break;
                }
                j++;
                //没找到相同
                if (j == 4 && !mergeDone) {
                    first_position++;
                }
            }
            //已经merge，只移动后排
            if (mergeDone) {
                if (temp[i] != 0) {
                    remove_blocks(4 * line + i);
                    _createBlockView(temp[i], 4 * line + first_position);
                    first_position++;
                }
            }
        }
    }

    public void merge() {

    }

    //空白块随机创建数字块
    public boolean create(int createCount) {
        while (createCount > 0 && empty_count > 0) {
            int seed = (int) (Math.random() * 10);
            int num;
            if (seed < 9) {
                num = 2;
            } else {
                num = 4;
            }
            seed = (int) (Math.random() * 16);
            if (data[seed] == 0) {
                data[seed] = num;
                _createBlockView(num, seed);
                createCount--;

            }
        }
        if (empty_count != 0) {
            return true;
        } else {
            return false;
        }
    }

    public void _createBlockView(int num, int position) {

        int x, y;
        if (position < 4) {
            x = positions[0][position % 4][0];
            y = positions[0][position % 4][1];
        } else if (position < 8) {
            x = positions[1][position % 4][0];
            y = positions[1][position % 4][1];
        } else if (position < 12) {
            x = positions[2][position % 4][0];
            y = positions[2][position % 4][1];
        } else {
            x = positions[3][position % 4][0];
            y = positions[3][position % 4][1];
        }

        int red = 255, green = 255, blue = 255;
        switch (num) {
            case 2:
                red = 187;
                break;
            case 4:
//                30 144 255
                red = 30;
                green = 144;
                blue = 255;
                break;
            case 8:
//                78 238 148
                red = 78;
                green = 238;
                blue = 148;
                break;
            case 16:
//                 	255 215 0
                green = 215;
                blue = 0;
                break;
            case 32:
//                255 165 0
                green = 165;
                blue = 0;
                break;
            case 64:
//                139 69 19
                red = 139;
                green = 69;
                blue = 19;
                break;
            case 128:
//                255 20 147
                red = 255;
                green = 0;
                blue = 0;
                break;
            case 256:
//                255 192 203
                red = 255;
                green = 192;
                blue = 203;
                break;
            case 512:
//                160 32 240
                red = 160;
                green = 32;
                blue = 240;
                break;
        }

        BlockView bv = new BlockView(context, num, x, y);
        bv.setBackgroundColor(Color.rgb(red, green, blue));
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(WIDTH / 4 - 20, WIDTH / 4 - 20);
        params.setMargins(10, 10, 10, 10);
        bv.setLayoutParams(params);
        bv.setGravity(Gravity.CENTER);
        if (num < 1024) {
            bv.setTextSize(40);
        } else {
            bv.setTextSize(32);
        }
        bv.setPadding(15, 15, 15, 15);

        game_layout.addView(bv);
        blockViews[position] = bv;
        data[position] = num;
        empty_count--;
        steps_all++;
        mScore += num;
    }

    public void remove_blocks(int position) {
        data[position] = 0;
        game_layout.removeView(blockViews[position]);
        blockViews[position] = null;
        empty_count++;
    }

    public void remove_all_blocks() {
        for (int i = 0; i < 16; i++) {
            remove_blocks(i);
        }
    }

    public void createForTest(int[] src) {
        for (int i = 0; i < 16; i++) {
            if (src[i] == 0)
                continue;
            _createBlockView(src[i], i);
        }
    }

    public void setScore(int score) {
        this.mScore = score;
    }

    public int getScore() {
        return mScore;
    }
}


Luck, see you again.


fixed


The Cable setting is the most useful as I have several games that will hang or crash at boot if cable is not set to VGA: Centipede, World Series Baseball 2K2, Gauntlet Legends, XDR, ...
Other games do not support VGA.


Hi! This is the friendly automated conda-forge-webservice.

I updated the Github team because of this commit.

- @dbast was added to this feedstock maintenance team.

You should get push access to this feedstock and CI services.

Feel free to join the community [chat room](https://gitter.im/conda-forge/conda-forge.github.io).

NOTE: Please make sure to not push to the repository directly.
      Use branches in your fork for any changes and send a PR.
      More details [here](https://conda-forge.org/docs/conda-forge_gotchas.html#using-a-fork-vs-a-branch-when-updating-a-recipe)


Remove the comments ```#```  as in whole coala code files you must have seen that comments where not present.


Nem, hanem ez az 500 csak egy bedobott változó volt tesztelésnek, és előző commitban nem vettem ki


delete


Aliasing failed with the following error:

~~~
Error! We couldn't verify the propagation of the DNS settings for kochie.io
~~~


没闹明白


Good to know. Thanks.


PR is here: https://github.com/reicast/reicast-emulator/pull/1423


Chọn


Shouldn't it be SetAppName("Slic3rPE"); ?


空格


why we cant do it this way...cause Java passes by values (copy of the value..not the memory address .)
-------------------------------------------------------------------------------------------------------------------
TextView noOfView = new TextView(this);
        while (index < words.size()) {
            noOfView.setText(words.get(index));
            rootView.addView(noOfView);
            index = index + 1;
        }


应该在判断状态为2后才解绑才对


其他属性也需要判断，不能抛出500错误


Hi DO1JLR. Why did you change the order of latitude / longitude ?


тузы не даются ))
```
Mumu: A♠ A♥ J♣ | Score: 22 | Cash: 80$
```
должно быть 12


Hi Hüseyin,

You were adding this without your implementation of SinglePhaseEss. As a result the develop branch was not compiling anymore.

Additionally each Ess needs to implement all interfaces explicitly (SymmetricEss, SinglePhaseEss,...), otherwise   OSGi is not detecting them properly.

I fixed the above problems with my latest commit, so that develop is building again.

Regards,
Stefan


In an example suggested by Thomas Neele, where a process can do 10000 consecutive
a's, linearised without clustering, the current optimisation leads to a speedup of more than
50% for the jitty rewriter, and more than 80% for jittyc.


@max-underthesun надо на бумажке решить))


Please enter nubmer one letter two numbers
2d22
#<RuntimeError: Incorrect format number >
Please enter nubmer one letter two numbers

Инстркуция говорит - введи число, букву и два числа. При этом поезд не создается. Нужно сделать ясную инструкцию, при соблюдении которой будет создаваться поезд.


Ask что? На самом деле метод у тебя такой-же как и cargo_train_ask - значит их можно объединить в 1 метод. И метод должен отражать, что он делает, или возвращает. В данном случае лучше будет назвать метод number_format_message.


注：这里应该是msg，命名错误，后续的提交已经更改。


Please invite me    a0973053602@gmail.com


message без n. Ди и лучше train_type_choise_message


можно упростить здесь код
вот смотри:
```
$ irb
2.5.1 :001 > ar = [1, 2, 3]
 => [1, 2, 3]
2.5.1 :002 > ar.all?(Integer)
 => true
2.5.1 :003 > arr = [1, 2, '3']
 => [1, 2, "3"]
2.5.1 :004 > arr.all?(Integer)
 => false
```


Please use PHP `implode()` function.
https://github.com/veronalabs/wp-sms/blob/development/includes/gateways/ozonesmsworld.class.php#L50
@mehrshaddarzi


Split ?


опять делаешь туже ошибку. Если поезд с таким номером не пройдет валидцаию то PassengerTrain.new(train_number) вернет nil. А мы не хотим добавлять nil в `@trains`


Shouldn't the target/stryker4s-tmp just always be excluded? Having it in the config would make it easy to forget if a user configures the mutate option


через ретрай


Тут тоже самое, что и в passenger_train


Preparation for #9


да и вообще методы почти одинаковы. Единственное, что отличается это какой поезд создается в зависимости от типа введенного пользователем. Что можно сделать?


Hometask on Java #1


pass


围观~~~


@HardyYao


# Specs execution successful
:scroll: [View logs](http://bamboo.comnull)
### Plans updated

Bamboo specs have been successfully imported and the following plans have been updated.

Project | Plan | Build
---|---|---
[Test](http://bamboo.com/browse/TEST) | [Comment test](http://bamboo.com/browse/TEST-CTEST)  | :white_check_mark: [\#1](http://bamboo.com/browse/TEST-CTEST-1)
[New project](http://bamboo.com/browse/NEW) | [Disabled plan](http://bamboo.com/browse/NEW-DISABLED) **disabled** | :white_check_mark: [\#1](http://bamboo.com/browse/NEW-DISABLED-1)

### Deployments updated

Bamboo specs have been successfully imported and the following deployment projects have been updated.

|Deployment project |
----|
[Deployment test](http://bamboo.com/deploy/viewDeploymentProjectVersions.action?id=2162689)|


哈哈哈哈哈哈 此地无银三百两的完美示范


Poate sessions nu e cel mai potrivit nume pt endpoint


great thx :-)


As sugera sa il destructurezi pe qotd aici ca sa se vada ce field-uri astepti (e.g. `({answer, qId})` sau ce are sens)


Hi! This is the friendly automated conda-forge-webservice.

I updated the Github team because of this commit.

- @dbast was added to this feedstock maintenance team.

You should get push access to this feedstock and CI services.

Feel free to join the community [chat room](https://gitter.im/conda-forge/conda-forge.github.io).

NOTE: Please make sure to not push to the repository directly.
      Use branches in your fork for any changes and send a PR.
      More details [here](https://conda-forge.org/docs/conda-forge_gotchas.html#using-a-fork-vs-a-branch-when-updating-a-recipe)


Stiu ca vscode iti face automat import-urile asa, dar schimba-le in `import X from '@material-ui/core/X'`. Altfel pt orice import browser-ul o sa descarce *tot* material-ui, care e destul de mare.


> 优秀

东哥出事了我怎么能独善其身呢


Legat de asta, acelasi lucru se intampla si cu lodash. Never do `import X from 'lodash'`


Inlocuieste asta cu un map peste answers.


Hi! This is the friendly automated conda-forge-webservice.

I updated the Github team because of this commit.

- @arnekr was added to conda-forge. Welcome to conda-forge!
  Go to https://github.com/orgs/conda-forge/invitation see your invitation.

- @dbast was added to this feedstock maintenance team.

You should get push access to this feedstock and CI services.

Feel free to join the community [chat room](https://gitter.im/conda-forge/conda-forge.github.io).

NOTE: Please make sure to not push to the repository directly.
      Use branches in your fork for any changes and send a PR.
      More details [here](https://conda-forge.org/docs/conda-forge_gotchas.html#using-a-fork-vs-a-branch-when-updating-a-recipe)


Asta e greseala mea, dar stilul asta pentru root paper care apare *peste tot* ar trebui mutat in tema.


develop it


This could perhaps be:
 `const myData = this.props.dog.tags.map((tag) => {
   return {label: tag}
})`


Some notes:

- It's unfortunate `-Wdouble-promotion` gives so much logspam in varargs functions. The GNU folk rejected changing it but should be pushed further I guess. That's the only sensible road if that warning exists at all.
- Using `#pragma GCC diagnostic ignored` or `_Pragma` doesn't help with `-Wdouble-promotion`, whether used on the macro or the function.
- Do we care about building on anything other than GNU or LLVM?
- Should anything be done about M_PI?
- Something in particular you use to batch-replace `sin` with `sinf` and similar?
- `-Wsingle-precision-constant` works but is ugly as heck
- There are plenty of `double` literals as per `grep(1)`. Expect a PR.
- I'm going to change all `1.0f` and `1.0` literals in a separate PR.


GG ca ai reusit sa adaptezi intr-un mod simplu radio-group-ul.


nile-common: Add PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE


Всё, исправлено


Makes sense to me. Instructions are undertaken (or carried out or done) on the inputs.


erm, de ce avem wouso-treasure-hunt in qotd?


It seems that you are dowloading 5.4 ParaView not 5.5.2
see: http://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v5.4...


FARA INLINE STYLE!


Import-uri separate.


Extrage paper si foloseste-l pe cel din tema.


Inicio do projeto


Ehe wir überlegen lass uns folgendes machen.

Bei der Hereinnahme in den Branche war ich mir "unsicher" weil ich die Lage anders einschätze wie du mir dem Branch weiter machen möchtest. Nun kommt hinzu, dir gefällt das mit dem JSON nicht mehr, so fahren wir den Branch zurück auf den Stand bevor du ausversehen diesen gemergst hast. Sozusagen auf diesen https://github.com/RFD-FHEM/RFFHEM/commit/879f6cd9a41a449836a982e3ef4116f4743914fd Stand. Einverstanden?

Alle unwesendlichen Änderungen und hinzufügen von Dokupunkten mache ich einen neuen PR.
In dem aktuellen Stand, einfach nur auskommentieren ginge auch, aber so denke ich, das wir bei einem neuen PR dann "still" auskommentierte Zeilen immer drin lassen bzw. vermehren.

>Dazu sollte es reichen den neuen Getestet Parameter und die Attribute zu entfernen.
Das use Json gefällt mir leider auch noch nicht so gut, da es in einer Standard FHEM Installation nicht enthalten ist.

Das wäre nicht dramatisch, da man auch noch prüfen könnte ob JSON auf dem System installiert ist.

>Der Name firmwareInfo gefällt mir nicht
Wieso bist Du der Meinung dass man sich hier eine Info holt?

Ich bin der Meinung Attribute sollten bestmöglich beziffert sein, das alle User sofort sich was darunter vorstellen können. Wiederum kann man auch in der CommandRef schauen wenn man dies nicht versteht. Ja, wir können es auch nach deinen Vorstellungen query benennen.

- nun mache ich erstmal nichts, bis wir uns kurzschlossen :-)
- wer macht den Reverse der Branchs? du, ich?


@davidevinavil In fact 313 drivers( https://github.com/xzr467706992/android_vendor_zuk/commit/29c66c3e54baccc8e1ee6a54268ff705dba9c793 ) has the best performance and the latest drivers is 330.Performance on 298/319/321/330 is almost same as 269.
Just a hint.


Successfully aliased the URL <https://npistats-yjvxrgmtny.now.sh> to the following alias.

* https://npi.now.sh


Foloseste o functie anonima `(...) => {...}` ca sa nu mai fie nevoie de bind


Ai repetat partea cu map. Corect ar fi `(query ? questions.filter : questions).map(...)`


Yeah, it's stupidly confusingly named. Right and left are opposites of each other, and which one we pick totally depends on our perspective! Of course...
`foldRight` is "lazy inductive folding" in Haskell. It expands out from the left to the right as it goes along the spine of the singly linked list.
Then, to make things even more confusing, it "folds up" the values from the right to the left of that expansion.

Its name is derived from the direction the application happens in. It "applies the operator consuming the right hand side" as it goes.
So, the first value to be applied/consumed from the list is the right hand most value (ie `Nil`), but this only happens once the operators have been expanded out.

We can do some equational reasoning to understand it a bit better.

Let's say we're going to write the length function:

```
length :: List a -> Int
length Nil = 0
length (x :. xs) = 1 + length xs
```
Now say we want length of `1 :. 2 :. 3 :. Nil`...  (by the way, this isn't normal Haskell. This is just for this course, normally this list would would be written `[1..3]` (as an enumeration), or `[1,2,3]`).

So let's apply this function... first thing we do is match `1 :. 2 :. 3 :. Nil` to one of the patterns.

It doesn't match `length Nil =...` but it *does* match `length (x :. xs) =...` with `x` as `1` and `xs` as `2 :. 3 :. Nil`

Sweet... so we have:

```
length (x :. xs) = 1 + length xs
  where
    x = 1
    xs = 2 :. 3 :. Nil
```

Okay, that's fine. So let's keep solving by equational reasoning / substitution...
I'll start from the beginning again. Note that this isn't Haskell, it's effectively maths:

```
-- length 1 :. 2 :. 3 :. Nil matches on the second definition
length (1 :. 2 :. 3 :. Nil)
= length (x :. xs) where x = 1; xs = 2 :. 3 :. Nil -- second definition
= 1 + (length (x :. xs)) where x = 2; xs = 3 :. Nil -- second definition
= 1 + (1 + length (x :. xs)) where x = 3; xs = Nil -- second definition
= 1 + (1 + (1 + length Nil)) where length Nil = 0 -- because of the first definition
= 1 + (1 + (1 + (0)))
```

now we fold up from the right to the left, applying `(+)`:

```
1 + (1 + (1 + (0)))
= 1 + (1 + (1 + 0))
= 1 + (1 + 1)
= 1 + 2
= 3
```

So you can see that `foldRight` is pretty inefficient when it comes to the stack. On the other hand, because Haskell is lazy, it's lazy, so it can short circuit if it needs to.

So... it **folds the right**, meaning the right is folded before the left, or toward the left, or before the left.

`+` is probably a bad example to use because `+` gives the same result no matter which order its operands are "processed" (ie it's commutative).

`foldLeft` on the other hand, is often expressed **eagerly**... that is, it isn't lazy. So it consumes its values from the left as it traverses the list. There are actually two fold lefts in the prelude — one is eager, the other isn't.

I'm **pretty** sure it's the same in elixir, though elixir has differences because the whole language is eager.


Hello! Do you know how is the checksum calculated in the header before the data block? Or this information is still unknown?

> offset | size/type | Description
> -------+-----------+-----------------------------------------------------------
> 0x0000 | 1 word | size n of compressed data block (excluding header)
> 0x0002 | 1 word | size of decompressed data block (currently 8k)
> **0x0004 | 1 dword | unknown (probably checksum)**
> 0x0008 | n bytes | compressed data (decompress using zlib)


Daca nu mai e nevoie de asta, sterge-l.


WTF is this?


mapreduce学习笔记


[](url)


First up, we have email verification support out of the box in Laravel 5.7. It's as simple as adding implements MustVerifyEmail to your User class. Seriously.


Aici ar trebui sa folosim corect / incorect pt raspunsuri, fara note.


Should use something from lodash.


Замени символ "|" на его url-код "%7C".
https://ru.wikipedia.org/wiki/%D0%92%D0%B5%D1%80%D1%82%D0%B8%D0%BA%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0%D1%8F_%D1%87%D0%B5%D1%80%D1%82%D0%B0


Could you please revert this commit? It breaks the Arch Linux package:

```
clazy --list
```

Gives the following output:

```
List of available clazy checkers:

Checks from level0. Very stable checks, 100% safe, no false-positives:
ls: cannot access '/usr/share/clazy/doc/level0/README*': No such file or directory

Checks from level1. Mostly stable and safe, rare false-positives:
ls: cannot access '/usr/share/clazy/doc/level1/README*': No such file or directory

Checks from level2. Sometimes has false-positives (20-30%):
ls: cannot access '/usr/share/clazy/doc/level2/README*': No such file or directory

Checks from level3. Not always correct, high rate of false-positives:
ls: cannot access '/usr/share/clazy/doc/level3/README*': No such file or directory
```

Related Arch Linux bug report: https://bugs.archlinux.org/task/60199


Use lodash.


This commit stops `clazy --list` from working on Arch Linux:

```
$ clazy --list
List of available clazy checkers:

Checks from level0. Very stable checks, 100% safe, no false-positives:
ls: cannot access '/usr/share/clazy/doc/level0/README*': No such file or directory

Checks from level1. Mostly stable and safe, rare false-positives:
ls: cannot access '/usr/share/clazy/doc/level1/README*': No such file or directory

Checks from level2. Sometimes has false-positives (20-30%):
ls: cannot access '/usr/share/clazy/doc/level2/README*': No such file or directory

Checks from level3. Not always correct, high rate of false-positives:
ls: cannot access '/usr/share/clazy/doc/level3/README*': No such file or directory
```