Programmatically generate decision table in C#?

后端 未结 5 2027
旧时难觅i
旧时难觅i 2021-01-06 23:47

I have this situation that I need to let users define decisions based on the number of given conditions. For example my program needs to automatically generate a matrix as b

5条回答
  •  滥情空心
    2021-01-07 00:02

    I think I know what you're saying. If your conditions aren't that bad, you can say:

    if (A && B && C) {
         return X;
    }
    if (!A && B && C) {
         return Y;
    }
    

    Oh wait! I think you're looking to generate all the different combinations of conditions! You want permutations! And if you just have binary, well sir, each combo can be found by counting.

    I don't quite follow: Does it look like

    State         1 2 3 4
    Condition A   T T F F
    

    ?

提交回复
热议问题