2023-06-02

2023-06-01  本文已影响0人  李先生1818

$(function () {

// 00 11 22 33 01 10 02 20 21 12 30 03 31 13 32 23

// 012 123 123 012 012 123 123 123
// let m1 = ["00","11","22","33","01","10","02","20","21","12","30","03","31","13","32","23"]
// let m2 = ["00","11","22","33","01","10","02","20","21","12","30","03","31","13","32","23"]
// let m3 = ["00","11","22","33","01","10","02","20","21","12","30","03","31","13","32","23"]
// let m4 = ["00","11","22","33","01","10","02","20","21","12","30","03","31","13","32","23"]
// let m1 = ["00","11","10","20","21"]
// let m2 = ["11","22","10","20","21","30","31","32"]
// let m3 = ["00","11","22","33","01","10","02","20","21","12","30","03","31","13","32","23"]
// let m4 = ["00","11","33","01","10","02","20","21","12","30","03","31","13","32","23"]
let m1 = ["01","11","12","21"]
let m2 = ["10","20","31","21"]
let m3 = ["11","12","13","01"]
let m4 = ["12","21","13","23"]
let jg = []
m1.forEach((item1, index1) => {
m2.forEach((item2, index2) => {
m3.forEach((item3, index3) => {
m4.forEach((item4, index4) => {
jg.push([item1, item2, item3, item4])
})
})
})
})
let jgSp = []
jg.forEach((item1, index1) => {
jgSp.push([item1[0][0], item1[0][1], item1[1][0], item1[1][1], item1[2][0], item1[2][1], item1[3][0], item1[3][1]])
})

console.log(jgSp, 11121)

// let num = [2, 3, 2, 1] //每个值选择0 1 2 3个数
let num = [4, 4, 3, 2] //每个值选择0 1 2 3个数

/*上次数据*/
let lastData = ['1', '1', '2', '1', '1', '3', '2', '1'] //上期数据

let newAllXz = JSON.parse(JSON.stringify(jgSp))
let newAllB0 = []
newAllXz.forEach((item, index) => {
    let b0 = 0
    for (i = 0; i < item.length; i++) {
        if (item[i] === '0') {
            b0++
        }
    }
    if (b0 >= 2 && b0 <= num[0]) {//没有0的  0大于等于4个的
        newAllB0.push(item)
    }
})

let newAllB1 = []
newAllB0.forEach((item, index) => {
    let b1 = 0
    for (i = 0; i < item.length; i++) {
        if (item[i] === '1') {
            b1++
        }
    }
    if (b1 >= 2 && b1 <= num[1]) {//没有1的  1大于3个的
        newAllB1.push(item)
    }
})
let newAllB2 = []
newAllB1.forEach((item, index) => {
    let b2 = 0
    for (i = 0; i < item.length; i++) {
        if (item[i] === '2') {
            b2++
        }
    }
    if (b2 >= 1 && b2 <= num[2]) {//没有2的  2大于3个的
        newAllB2.push(item)
    }
})
let newAllB3 = []
newAllB2.forEach((item, index) => {
    let b3 = 0
    for (i = 0; i < item.length; i++) {
        if (item[i] === '3') {
            b3++
        }
    }
    // if (b3 !== 0 && b3 <= num[3]) { //没有3的  3大于3个的
    if (b3 >= 1 && b3 <= num[3]) { //没有3的  3大于3个的
        newAllB3.push(item)
    }
})


console.log(newAllB3, '44329')

/*和上期对应的值有1个到3个 --- 开始*/
let xtArrNew2 = []
// xtArrNew2 = newAllB3
newAllB3.forEach((item, index) => {
    let bx = 0
    item.forEach((item2, index2) => {
        if (newAllB3[index][index2] === lastData[index2]) {
            bx++
        }
    })
    if (bx > 1 && bx <= 4) {
        xtArrNew2.push(item)
    }
})
console.log(xtArrNew2, '与上期位数相同1到3个---')
/*和上期对应的值有1个到3个 --- 结束*/


/*计算和值开始*/
let heArr2 = []
 heArr2 = xtArrNew2
xtArrNew2.forEach((item, index) => {
    let bx = 0
    item.forEach((item2, index2) => {
        bx = item2 * 1 + bx
    })

    if (bx >= 7 && bx < 14) {
        heArr2.push(item)
    }
})
console.log(heArr2, '和值过滤')

/*计算和值结束*/


// 1 0 3 1 3 2 2 1
let newAllB7 = []
newAllB7 = heArr2

/*客队都比主队强,主队都比客队强*/
// newAllB7 = newAllB7.filter(item => ((item[0] * 1 <= item[1] * 1) && (item[2] * 1 <= item[3] * 1)&&(item[4] * 1 <= item[5] * 1)&&(item[6] * 1 <= item[1] * 7)))

// 去掉33
// newAllB7 = newAllB7.filter(item => ((item[0] * 1 + item[1] * 1) !== 6))
// newAllB7 = newAllB7.filter(item => ((item[2] * 1 + item[3] * 1) !== 6))
// newAllB7 = newAllB7.filter(item => ((item[4] * 1 + item[5] * 1) !== 6))
// newAllB7 = newAllB7.filter(item => ((item[6] * 1 + item[7] * 1) !== 6))

// heArr2.forEach((item, index) => {
//     if ((item[0] === '3') && (item[1] === '0' || item[1] === '1') && item[2] !== '3' && item[3] !== '0' && item[4] !== '3' && item[5] !== '0' && item[6] !== '3' && item[7] !== '0') {
//         newAllB7.push(item)
//     }
// })

console.log(newAllB7, '条件')
let html2 = ''
newAllB7.forEach((item, index) => {
    html2 += `<tr>`
    html2 += `<td class="number"><span>${index + 1}.</span></td>`
    item.forEach((item2, index2) => {
        html2 += `<td>
            <span>${item2}</span>
                </td>`
    })
    html2 += `</tr>`
})
// $('.resData').append(html2)

})

上一篇 下一篇

猜你喜欢

热点阅读