Foxtable(狐表)用户栏目专家坐堂 → [求助]超费脑的逻辑判断,求传说级出来指点下~


  共有3151人关注过本帖树形打印复制链接

主题:[求助]超费脑的逻辑判断,求传说级出来指点下~

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/13 11:03:00 [显示全部帖子]

A、B、C、D

 

比如第一种,得出A的,这样写

iif((A-B>4 OR A-B<-4) AND (A-C>4 OR A-C<-4) AND (A-D>4 OR A-D<-4),'A', '否则继续其余的判断')

 

得出A、B这样写

iif((A-B>4 OR A-B<-4) AND (A-C>4 OR A-C<-4) AND (A-D>4 OR A-D<-4),'A', iif((B-A>4 OR B-A<-4) AND (B-C>4 OR B-C<-4) AND (B-D>4 OR B-D<-4),'B','否则继续其余的判断'))

 

-------------------------- 拼凑起来,就是一大段判断


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/13 11:10:00 [显示全部帖子]

比如第一种的情况,就这样处理。其余你的,你照着逻辑写代码就行。分别判断。

 

Dim ary1() As String = {"A", "B", "C", "D"}
Dim ary2() As Integer = {-3, 7,  -1, -11}

 

For i As Integer = 0 To ary1.Length - 1
    Dim flag As Boolean = True
    For j As Integer = 0 To ary2.length - 1
        If i<>j AndAlso Math.Abs(ary2(i)-ary2(j)) < 4 Then
            flag = False
            Exit For
        End If
    Next
    If flag  = True Then
        msgbox(ary1(i))
        Return Nothing
    End If
Next


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/13 11:30:00 [显示全部帖子]

洗牌要这样

 

Dim cnt As Integer = DataTables("表A").DataRows.Count
Dim str As New List(of Integer) '用于存储洗牌前的位置

For i As Integer = 0 To cnt -1 '准备初始的牌
    str.add(i)
Next

For i As Integer = 1 To str.count '洗牌测次数
    Dim rnum1 As Integer = Rand.Next(str.count -1)
    Dim rnum2 As Integer = Rand.Next(str.count -1)
    Dim temp As String = str(rnum1)
    str(rnum1) = str(rnum2)
    str(rnum2) = temp   
Next

For i As Integer = 0 To 5 - 1 '5为要抽取的行数
    output.show(str(i))
Next


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/13 11:50:00 [显示全部帖子]

Tables("题库").StopRedraw()
DataTables("题库").ReplaceFor("抽取",False)
For i As Integer = 0 To 5 - 1 '5为要抽取的行数
    DataTables("题库").DataRows(str(i))("抽取") = True
Next
Tables("题库").Filter = "[抽取] = True"
Tables("题库").ResumeRedraw()

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/18 9:53:00 [显示全部帖子]

无语,看3楼啊。

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/18 10:08:00 [显示全部帖子]

第二种

 

Dim ary1() As String = {"A", "B", "C", "D"}
Dim ary2() As Integer = {-3, 7,  -1, -11}


For i As Integer = 0 To ary1.Length - 1
    For j As Integer = 0 To ary2.length - 1
        If i<>j AndAlso Math.Abs(ary2(i)-ary2(j)) < 3 Then
        Dim flag As Boolean = True
            For k As Integer = 0 To ary2.length -1
                If k <> i AndAlso k <> j Then
                    If math.abs(ary2(k)-ary2(i)) < 4 OrElse math.abs(ary2(k)-ary2(j)) < 4 Then
                        flag = False
                        Exit For
                    End If
                End If
            Next
            If flag  = True Then
                msgbox(ary1(i) & " " & ary1(j))
                Return Nothing
            End If
        End If
    Next
Next


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/18 10:22:00 [显示全部帖子]

第三种

 

Dim ary1() As String = {"A", "B", "C", "D"}
Dim ary2() As Integer = {1, 2,  3, -11}


For i As Integer = 0 To ary1.Length - 1
    For j As Integer = 0 To ary2.length - 1
        If i<>j AndAlso Math.Abs(ary2(i)-ary2(j)) < 3 Then
            For k As Integer = 0 To ary2.length - 1
                If k <> j AndAlso k <> i Then
                    If math.abs(ary2(k)-ary2(i)) < 3 AndAlso math.abs(ary2(k)-ary2(j)) < 3 Then
                        For l As Integer = 0 To ary2.length - 1
                            If l <> i AndAlso l <> j AndAlso l <> k Then
                                If math.abs(ary2(l)-ary2(i)) > 4 AndAlso math.abs(ary2(l)-ary2(j)) > 4 AndAlso math.abs(ary2(l)-ary2(k)) > 4 Then
                                    msgbox(ary1(i) & " " & ary1(j)  & " " & ary1(k))
                                    Return Nothing
                                End If
                            End If
                        Next
                    End If
                End If
            Next
        End If
    Next
Next


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/18 10:24:00 [显示全部帖子]

第四种。

 

Dim ary1() As String = {"A", "B", "C", "D"}
Dim ary2() As Integer = {1, 2,  3, 0}


For i As Integer = 0 To ary1.Length - 1
    For j As Integer = 0 To ary2.length - 1
        If i<>j AndAlso Math.Abs(ary2(i)-ary2(j)) < 3 Then
            For k As Integer = 0 To ary2.length - 1
                If k <> j AndAlso k <> i Then
                    If math.abs(ary2(k)-ary2(i)) < 3 AndAlso math.abs(ary2(k)-ary2(j)) < 3 Then
                        For l As Integer = 0 To ary2.length - 1
                            If l <> i AndAlso l <> j AndAlso l <> k Then
                                If math.abs(ary2(l)-ary2(i)) > 4 AndAlso math.abs(ary2(l)-ary2(j)) > 4 AndAlso math.abs(ary2(l)-ary2(k)) > 4 Then
                                    msgbox(ary1(i) & " " & ary1(j)  & " " & ary1(k))
                                    Return Nothing
                                Else
                                    msgbox("无法判断")
                                    Return Nothing
                                End If
                            End If
                        Next
                    End If
                End If
            Next
        End If
       
    Next
Next


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/18 10:24:00 [显示全部帖子]

你好好看看6楼的方法。

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/25 10:42:00 [显示全部帖子]

e.DataRow("气质类型_评价") = Functions.Execute("气质类型",qz1,qz2,qz3,qz4)

 回到顶部
总数 11 1 2 下一页