text stringlengths 0 98 |
|---|
1.第三行决定求解八数码问题还是十五数码问题: |
n = 3 #选择3:八数码 4:十五数码 |
2.输入求解数码矩阵在17行(八数码)和20行(十五数码)中直接写入: |
if (n==3): |
L1 = np.mat(np.array([2,8,3,1,0,5,4,7,6]).reshape(3, 3)) |
# L1=np.mat(np.array([4,1,3,2,0,5,7,8,6]).reshape(3,3)) |
elif(n==4): |
L1=np.mat(np.array([1,2,0,5,12,14,4,6,11,13,3,7,10,9,15,8]).reshape(4,4)) |
1.交互输入不同数字用空格隔开 |
2.规则库: |
rule1 = [2] # if 动物有毛发2 then 动物是哺乳动物21 |
rule2 = [1] # if 动物有奶1 then 动物是哺乳动物21 |
rule3 = [3] # if 动物有羽毛3 then 动物是鸟22 |
rule4 = [4, 5] # if 动物会飞4 and 会生蛋5 then 动物是鸟22 |
rule5 = [6] # if 动物吃肉6 then 动物是食肉动物23 |
rule6 = [7, 8, 9] # if 动物有犀利牙齿7 and 有爪8 and 眼向前方9 then 动物是食肉动物23 |
rule7 = [21, 10] # if 动物是哺乳动物21 and 有蹄10 then 动物是有蹄类动物24 |
rule8 = [21, 11] # if 动物是哺乳动物21 and 反刍11 then 动物是有蹄类动物24 |
rule9 = [21, 23, 12, 13] # if 动物是哺乳动物21 and 是食肉动物23 and 有黄褐色12 and 有暗斑点13 then 动物是豹25 |
rule10 = [21, 23, 12, 14] # if 动物是哺乳动物21 and 是食肉动物23 and 有黄褐色12 and 有黑色条纹14 then 动物是虎26 |
rule11 = [24, 15, 16, 13] # if动物是有蹄类动物24 and 有长脖子15 and 有长腿16 and 有暗斑点13 then 动物是长颈鹿27 |
rule12 = [24, 14] # if 动物是有蹄类动物24 and 有黑色条纹14 then 动物是斑马28 |
rule13 = [22, 17, 16, 15, 19] # if 动物是鸟22 and 不会飞17 and 有长脖子16 and 有长腿15 and 有黑白二色15 then 动物是鸵鸟29 |
rule14 = [22, 17, 18, 19] # if 动物是鸟22 and 不会飞17 and 会游泳18 and 有黑白二色19 then 动物是企鹅30 |
rule15 = [22, 4, 5] # if 动物是鸟22 and善飞4 and 会生蛋5 then 动物是信天翁31 |
在239行,main位置输入要处理的问题:括号,元素,符号都需要用空格隔开方便split处理。 |
案例:s = '=> a -> ( b -> a )' |
s = "=> ( a -> b ) -> ( ( ! b ) -> ( ! a ) )" |
s = '=> ( a -> b ) -> ( ( a -> c ) -> ( a -> ( b & c ) ) )' |
s = '=> ( a -> c ) -> ( ( b -> c ) -> ( ( a | b ) -> c ) )' |
s = '=> ( a <-> b ) -> ( a -> b )' |
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
version https://git-lfs.github.com/spec/v1 oid sha256:6dfd046596b91f22886074a6043583134b28650d2b6decba03d76a3bcc1c5c3b size 444
- Downloads last month
- 45