<commit_before>import QtQuick 2.0
import Ubuntu.Components 0.1
import "../components"

Board {
    id: board
    anchors.fill: parent
    columns: 6
    columnSpaces: 8
    rows: 1
    rowSpaces: 2
    cardYStacks: 13

    decks: 1

    fillDuration: 50

    onSingelPress: {
        if (!stack)
            return
        startMove()
        print(getStackList[0])
        if (stack === deckStack) {
            if(deckStack.count>0) {
                var count = deckStack.count
                for(var iii=1; iii<=4; iii++) {
                    moveCard(
                                deckStack.count-iii,
                                deckStack, getStackList[iii-1],
                                true)
                }
            }
        } else if(stack !== putStack ){
            var lastCard = stack.lastCard
            if(lastCard && lastCard.card!==1) {
                var success = true
                var foundSuit = false
                for(var key in getStackList ) {
                    var tmpStack = getStackList[key]
                    if(stack === tmpStack)
                        continue
                    if(tmpStack.lastCard) {
                        if(tmpStack.lastCard.suit === lastCard.suit) {
                            foundSuit = true
                            if(tmpStack.lastCard.card!==1 && tmpStack.lastCard.card < lastCard.card) {
                                success = false
                            }
                        }
                    }
                }
                if(success && foundSuit) {
                    moveCard(
                                stack.count-1,
                                stack, putStack)
                }
            }
        }

        endMove()
    }

    onSelectedStackChanged: {
        if (previousSelectedStack) {
            if (!selectedStack) {
                if (hoverStack) {
                    if (previousSelectedStack.highlightFrom !== -1) {
                        startMove()
                        moveCard(
                                    previousSelectedStack.count-1,
                                    previousSelectedStack, hoverStack)
                        moveCard(
                                    hoverStack.count-1,
                                    hoverStack, hoverStack)
                        endMove()
                    }
                }
                stopHighlight()
                checkGame()
            }
        }
    }

    onHoverStackChanged: {
        if (selectedStack) {
            if (!hoverStack) {
                stopHighlight()
                return
            } else if (!hoverStack.cardsDropable) {
                stopHighlight()
                return
            }
            else if (selectedStack === hoverStack) {
                stopHighlight()
                return
            }
            highlightFrom(selectedStack.count-1)
        }
    }

    function checkGame() {
        for(var iii = 0; iii<getStackList.count; iii++) {
            if(getStackList.count>0)
                return false
        }
        end(true)
    }

    Stack {
        id: putStack
        x: board.width - board.columnWidth - board.columnMargin
        y: board.columnMargin
        width: board.columnWidth
        cardHeight: board.columnHeight
        showHidden: false

        cardsMoveable: true
        nrCardsMoveable: 1

        cardsDropable: false
    }

    Stack {
        id: deckStack
        x: board.columnMargin
        y: board.columnMargin
        cardWidth: board.columnWidth
        cardHeight: board.columnHeight
        goUpZ: true

        cardsMoveable: true
        nrCardsMoveable: 1

        goDown: true

        cardsDropable: false
    }

    Stack {
        id: getStack1
        width: board.columnWidth
        height: board.columnHeight
        cardWidth: board.columnWidth
        cardHeight: board.columnHeight
        x: deckStack.x+columnMargin+columnWidth
        y: columnMargin

        cardsMoveable: true
        nrCardsMoveable: 1

        goDown: true

        cardsDropable: count===0
    }

    Stack {
        id: getStack2
        width: board.columnWidth
        height: board.columnHeight
        cardWidth: board.columnWidth
        cardHeight: board.columnHeight
        x: getStack1.x+columnMargin+columnWidth
        y: columnMargin

        cardsMoveable: true
        nrCardsMoveable: 1

        goDown: true

        cardsDropable: count===0
    }

    Stack {
        id: getStack3
        width: board.columnWidth
        height: board.columnHeight
        cardWidth: board.columnWidth
        cardHeight: board.columnHeight
        x: getStack2.x+columnMargin+columnWidth
        y: columnMargin

        cardsMoveable: true
        nrCardsMoveable: 1

        goDown: true

        cardsDropable: count===0
    }

    Stack {
        id: getStack4
        width: board.columnWidth
        height: board.columnHeight<commit_msg>A log of things with AcesUp game<commit_after>import QtQuick 2.0
import Ubuntu.Components 0.1
import "../components"

Board {
    id: board
    anchors.fill: parent
    columns: 6
    columnSpaces: 8
    rows: 1
    rowSpaces: 2
    cardYStacks: 13

    decks: 1

    fillDuration: 50

    onSingelPress: {
        if (!stack)
            return
        startMove()
        print(getStackList[0])
        if (stack === deckStack) {
            if(deckStack.count>0) {
                var count = deckStack.count
                for(var iii=1; iii<=4; iii++) {
                    moveCard(
                                deckStack.count-iii,
                                deckStack, getStackList[iii-1],
                                true)
                }
            }
        } else if(stack !== putStack ){
            var lastCard = stack.lastCard
            if(lastCard && lastCard.card!==1) {
                var success = true
                var foundSuit = false
                for(var key in getStackList ) {
                    var tmpStack = getStackList[key]
                    if(stack === tmpStack)
                        continue
                    if(tmpStack.lastCard) {
                        if(tmpStack.lastCard.suit === lastCard.suit) {
                            foundSuit = true
                            if(tmpStack.lastCard.card!==1 && tmpStack.lastCard.card < lastCard.card) {
                                success = false
                            }
                        }
                    }
                }
                if(success && foundSuit) {
                    moveCard(
                                stack.count-1,
                                stack, putStack)
                }
            }
        }
        endMove()
        checkGame()
    }

    onSelectedStackChanged: {
        if (previousSelectedStack) {
            if (!selectedStack) {
                if (hoverStack) {
                    if (previousSelectedStack.highlightFrom !== -1) {
                        startMove()
                        moveCard(
                                    previousSelectedStack.count-1,
                                    previousSelectedStack, hoverStack)
                        endMove()
                        checkGame()
                    }
                }
                stopHighlight()
            }
        }
    }

    onHoverStackChanged: {
        if (selectedStack) {
            if (!hoverStack) {
                stopHighlight()
                return
            } else if (!hoverStack.cardsDropable) {
                stopHighlight()
                return
            }
            else if (selectedStack === hoverStack) {
                stopHighlight()
                return
            }
            highlightFrom(selectedStack.count-1)
        }
    }

    function checkGame() {
        for(var iii = 0; iii<getStackList.length; iii++) {
            if(getStackList[iii].count>0)
                return false
        }
        end(true)
    }

    Stack {
        id: putStack
        x: board.width - board.columnWidth - board.columnMargin
        y: board.columnMargin
        cardWidth: board.columnWidth
        cardHeight: board.columnHeight
        showHidden: false

        cardsMoveable: false
        nrCardsMoveable: 1

        cardsDropable: false
    }

    Stack {
        id: deckStack
        x: board.columnMargin
        y: board.columnMargin
        cardWidth: board.columnWidth
        cardHeight: board.columnHeight
        goUpZ: true

        cardsMoveable: true
        nrCardsMoveable: 1

        goDown: true

        cardsDropable: false
    }

    Stack {
        id: getStack1
        cardWidth: board.columnWidth
        cardHeight: board.columnHeight
        x: deckStack.x+columnMargin+columnWidth
        y: columnMargin

        cardsMoveable: true
        nrCardsMoveable: 1

        goDown: true

        cardsDropable: count===0
    }

    Stack {
        id: getStack2
        cardWidth: board.columnWidth
        cardHeight: board.columnHeight
        x: getStack1.x+columnMargin+columnWidth
        y: columnMargin

        cardsMoveable: true
        nrCardsMoveable: 1

        goDown: true

        cardsDropable: count===0
    }

    Stack {
        id: getStack3
        cardWidth: board.columnWidth
        cardHeight: board.columnHeight
        x: getStack2.x+columnMargin+columnWidth
        y: columnMargin

        cardsMoveable: true
        nrCardsMoveable: 1

        goDown: true

        cardsDropable: count===0
    }

    Stack {
        id: getStack4
{'fraction_non_alphanumeric': 0.07319361901782921, 'fraction_numerical': 0.008445417578980294, 'mean_word_length': 1.1225934941358708, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4691610', 'n_tokens_mistral': 2551, 'n_tokens_neox': 2368, 'n_words': 506}