diff --git a/materials/slides/Lecture_11a_Inference_in_Baysian_Networks.pdf b/materials/slides/Lecture_11a_Inference_in_Baysian_Networks.pdf new file mode 100644 index 0000000..672ac31 Binary files /dev/null and b/materials/slides/Lecture_11a_Inference_in_Baysian_Networks.pdf differ diff --git a/materials/slides/Lecture_11b_Decision_Theory.pdf b/materials/slides/Lecture_11b_Decision_Theory.pdf new file mode 100644 index 0000000..a0a34ae Binary files /dev/null and b/materials/slides/Lecture_11b_Decision_Theory.pdf differ diff --git a/materials/slides/Lecture_13a_Markov_Decision_Processes.pdf b/materials/slides/Lecture_13a_Markov_Decision_Processes.pdf new file mode 100644 index 0000000..d10af06 Binary files /dev/null and b/materials/slides/Lecture_13a_Markov_Decision_Processes.pdf differ diff --git a/materials/slides/Lecture_13b_Decision_Tree_Learning.pdf b/materials/slides/Lecture_13b_Decision_Tree_Learning.pdf new file mode 100644 index 0000000..38cf871 Binary files /dev/null and b/materials/slides/Lecture_13b_Decision_Tree_Learning.pdf differ diff --git a/materials/slides/Lecture_14a_Perceptron_Learning.pdf b/materials/slides/Lecture_14a_Perceptron_Learning.pdf new file mode 100644 index 0000000..1689f83 Binary files /dev/null and b/materials/slides/Lecture_14a_Perceptron_Learning.pdf differ diff --git a/materials/slides/Lecture_14b_Neural_Networks.pdf b/materials/slides/Lecture_14b_Neural_Networks.pdf new file mode 100644 index 0000000..cfdf3db Binary files /dev/null and b/materials/slides/Lecture_14b_Neural_Networks.pdf differ diff --git a/materials/slides/Lecture_9a_Quantifying_Uncertainty(1).pdf b/materials/slides/Lecture_9a_Quantifying_Uncertainty.pdf similarity index 100% rename from materials/slides/Lecture_9a_Quantifying_Uncertainty(1).pdf rename to materials/slides/Lecture_9a_Quantifying_Uncertainty.pdf diff --git a/proj3/CS360_Project3.pdf b/proj3/Project3_Instructions.pdf similarity index 87% rename from proj3/CS360_Project3.pdf rename to proj3/Project3_Instructions.pdf index 1f40c51..b81e8b9 100644 Binary files a/proj3/CS360_Project3.pdf and b/proj3/Project3_Instructions.pdf differ diff --git a/proj3/dev_cases/diff2.html b/proj3/dev_cases/diff2.html new file mode 100644 index 0000000..9a059be --- /dev/null +++ b/proj3/dev_cases/diff2.html @@ -0,0 +1,234 @@ + + + + +diff + + + + + + + + + + + + + + + + + + +
/home/advpetc/Documents/Ai/proj3/output.txt/home/advpetc/Documents/Ai/proj3/other/output2.txtoutput-2.txt
+
+ 1 ^<<<<o>>>^<>>>>>^<<<<>>^<<<<>>>^<<<<<<o>>^<>>>>>>^                                                                                                                                                              
+ 2 ^<^^vvvvv^^^^>>^^^^^^^^^^^^^^^^^<<<<ov>>^^^o>>^^^^                                                                                                                                                              
+ 3 v<o>vvvv<<^^>>>^^^^^^^^^^<^^^>^^^<<<<vovvov>>^^^^^
+ 4 vvvvvvvv<<<o>>>^^^^^^^^^^<<o>>^^^^^<<<<>vvv<ovvo>^                                                                                                                                                              
+ 5 vvvvv>><<vvvvv>^^^^<o>^^^^vvvv^^^^^^v<o>vv<<>vv<>^                                                                                                                                                              
+ 6 vvvv<<^^vvvvvv<^^^^vvv^^^>>vvv<<o^o>vv<>>vvo>vv<<^                                                                                                                                                              
+ 7 vv<<<<^>>vvvvv<<<o>>>vv<o>>>vvvvvvvvv<<>>vvvvvvvov                                                                                                                                                              
+ 8 <<<<<<^>>>vvvv<<<v>>>><<v>>>>vvvvv>>vv<o>>>>>vvvvv                                                                                                                                                              
+ 9 ^<<<<<o>>>>vvv<<<<<^>^^<<>>>>>vv<<<>vv<<>^>>>vvvvv                                                                                                                                                              
+10 ^^<<<<v>>>>vvv<<<<<o>^^^<^^>>>vv<<^>>v<<<^o>>vvvvv                                                                                                                                                              
+11 ^^^<<<vv>>>>v<<<<<<vv^^^^<o>>>vvv<o>vv<<ov>>>vvvvv                                                                                                                                                              
+12 ^^^^<<>>>>>>^<<<<<vvv<o>vvv>>>vvvvvvv<<<vvo>>vvvvv                                                                                                                                                              
+13 ^^^^^^>>>>^^^^^<<<vvv<<>>v>>>>>vvvvvv<<ovv>>>vvvvv                                                                                                                                                              
+14 ^^^^^^^^>^^^^^^^<<<<<<<>>>>^>>>>>vvvv<<>v<>>>vvvvv                                                                                                                                                              
+15 o^^^^^^>>^^^^^^^^<<<<<<o>v^^^^>>>>vvvvovvvo>>v>>vv                                                                                                                                                              
+16 >v^o^^o>>^^^^^^>^^<<<<vvvvv<o^^>>>>vvvv>vvv>>v>>>v                                                                                                                                                              
+17 >>vvvvvvv^^^^^>>>^^<<<vvvvvvvvo>>>>>>v>>>vvovvv>>v                                                                                                                                                              
+18 o>>>vvvvv<<<o>>>>^^<<<>>>vvvvvv>>>>>>>v^>>vvvvvovv                                                                                                                                                              
+19 v>>>>vvv<<<<>>>>>^^^<^>>>>vvvvv>^^^^>>vvo>vvvvv>vv                                                                                                                                                              
+20 vo>>>vv<<<<<>>^^^^^^<^^>>>>vvvv<^^^vo>>vv>vvvvv>vv                                                                                                                                                              
+21 vvv>vv<<<<<o>^^^>>^^<<o>>>>>>vvvvovvv>>>>>>>vvvovv                                                                                                                                                              
+22 vvvvvv<<<<<vvv<o>>vv<<v>>>>>>>vvvv>vvvo>>>>>>vvvvv                                                                                                                                                              
+23 vvvvv<<^^^vvvvvvv>vv<<<>>^>>>>>>>>>>>>>>>>v>>>vvvv                                                                                                                                                              
+24 vvvv<<<<^>>>vvvvvvv<<<<^^^^^^>>>>>^>>>>>>>vvo>vvvv                                                                                                                                                              
+25 vvvv<<<<o>>>vvvvvvv<<<<o^^o^^^^^>vvovo>v>>>vv>vvvv                                                                                                                                                              
+26 vv<<<<<<v>>>>vvvv>v<<<<vvvvv^ovvo>vvvvvvvo>>>>>vvv                                                                                                                                                              
+27 <<<<<<<vv>>>>>>>>>^<<<vvvvvvv>>v>>>>>>>>v>>>>>>>vv                                                                                                                                                              
+28 ^^^^^^<<vv^^^^^^^^^^<<vvvvvv<<>>>>>>>>>>>>>>>>>>>v                                                                                                                                                              
+29 ^^^^^^^<<<<^^^^^^^^^^<vvvv<<<<o>^^o>>>>>>>>>>>>>>.                                                                                                                                                              
+30 ^^^^^^^^<<<^^^^^^^^^^>>><<<<vv>>^>>>>>>>>>>>>>>>>^                                                                                                                                                              
+31 ^^<^^^^^^<<o>^^^^^^^^^^^^<<>>>>^^o>>>>^^^o^>>>^^o^                                                                                                                                                              
+32 ^^<<o>>^^<<vv^^^^o>^^^^^^^^^^^^^>>>>>>^^^>^o>^^^>^                                                                                                                                                              
+33 ^^^<v>>^^<<vvv<ovvv^^>>^^<<^^vvo^^o>>>>>>>>>>^^o>^                                                                                                                                                              
+34 ^^^v>>>^^^>>vvvvvvv<o>>vv<<o>vvvv>>>^^>>>>>>>^^>>^                                                                                                                                                              
+35 vo>v>>^^^^>>>v<<>vvvvvvvv<<>>vvvvo>>^^o>>>>>^^^>^^                                                                                                                                                              
+36 vvvvv^^^<o>>vv<<<>vvvvvv<<<>>>vvv>>>^<>>>>>^^^^o^^                                                                                                                                                              
+37 vvvv<<^^vvvvv<<<^>>>vvvv<<<>>>>>>>>^^^vo>>^^^^^>>^                                                                                                                                                              
+38 vvvv<<o>vvvvv<<<o>>>>>vvvv<o>>>>>>>^^>v>>>^^^^^^o^                                                                                                                                                              
+39 vvvv<vvvvvvvv<<<v>>>>>>vvvvv>>>>>>^^^>>>>>^^^^^>>^                                                                                                                                                              
+40 vvvvvvvvvvvvv<<vv>>>>>>>vvv>>>>>^^^^^o>>>^^^^o^>>^                                                                                                                                                              
+41 vvvvvvvvvvvvv<<<vv^^^>>>>>>>>^^^^^^^<>>>>^^^^>>>^^                                                                                                                                                              
+42 vvvvvvvvvvvv<<<<<<<^^>>>>>>>^^^^^^^<o>>>>^^^^>>^^^                                                                                                                                                              
+43 vvvvvvvvv>><<<<<^^<<o>>>>>^^^^^^^^<<>>>>^^^^^>^^^^                                                                                                                                                              
+44 vvvvvv<<<<^^<<<^^^<vv>>>>^^^^<o>^^^>>>>>^^^^^^^^^o                                                                                                                                                              
+45 v<<<<<<<^^^^<<<<^^>vv>>>^^^^<<>>^^<o>>^^^^^^^^^^<<                                                                                                                                                              
+46 <<<<<<<^^^^^<<<<o>>v>>>>^^^<<o>>^^<<>^^^^^^^^^^^<<                                                                                                                                                              
+47 ^<<<<<<^^^^^^<<<v>>>>>>^^^<<<vvo>vvvvo^^^^^^^^^^^<                                                                                                                                                              
+48 ^<<<<<<^^^^^^<vvvv>>>>>^^^<<<<<>>vvvvvvo^o^^^^^^^^                                                                                                                                                              
+49 ^<<<<<<<^^^>^>vvv>>>>>^^^^<<<<<>>>vvvvv<<>>>^^^^^^                                                                                                                                                              
+50 ^<<<<<<<<o>>>>>>>>>>>>>^^^<<<<o>>>>v<<<<<o>>^^^^^^                                                                                                                                                              
+
+
+
+ 1 <<<<<o>>>^<>>>>>^<<<<>>^<<<<>>>^<<<<<<o>>^<>>>>>>>                                                                                                                                                              
+ 2 ^<^^vvvvv^^^^>>^^^^^^^^^^^^^^^^^<<<<ov>>^^^o>>^^^^                                                                                                                                                              
+ 3 v<o>vvvv<<^^>>>^^^^^^^^^^<^^^>^^^<<<<vovvov>>^^^^^
+ 4 vvvvvvvv<<<o>>>^^^^^^^^^^<<o>>^^^^^<<<<>vvv<ovvo>^                                                                                                                                                              
+ 5 vvvvv>><<vvvvv>^^^^<o>^^^^vvvv^^^^^^v<o>vv<<>vv<>^                                                                                                                                                              
+ 6 vvvv<<^^vvvvvv<^^^^vvv^^^>>vvv<<ovo>vv<>>vvo>vv<<^                                                                                                                                                              
+ 7 vv<<<<^>>vvvvv<<<o>>>vv<o>>>vvvvvvvvv<<>>vvvvvvvov                                                                                                                                                              
+ 8 <<<<<<^>>>vvvv<<<v>>>><<v>>>>vvvvv>>vv<o>>>>>vvvvv                                                                                                                                                              
+ 9 ^<<<<<o>>>>vvv<<<<<^>^^<<>>>>>vv<<<>vv<<>^>>>vvvvv                                                                                                                                                              
+10 ^^<<<<v>>>>vvv<<<<<o>^^^<^^>>>vv<<^>>v<<<^o>>vvvvv                                                                                                                                                              
+11 ^^^<<<vv>>>>v<<<<<<vv^^^^<o>>>vvv<o>vv<<ov>>>vvvvv                                                                                                                                                              
+12 ^^^^<<>>>>>>^<<<<<vvv<o>vvv>>>vvvvvvv<<<vvo>>vvvvv                                                                                                                                                              
+13 ^^^^^^>>>>^^^^^<<<vvv<<>>v>>>>>vvvvvv<<ovv>>>vvvvv                                                                                                                                                              
+14 ^^^^^^^^>^^^^^^^<<<<<<<>>>>^>>>>>vvvv<<>v<>>>vvvvv                                                                                                                                                              
+15 o^^^^^^>>^^^^^^^^<<<<<<o>v^^^^>>>>vvvvovvvo>>v>>vv                                                                                                                                                              
+16 >v^o^^o>>^^^^^^>^^<<<<vvvvv<o^^>>>>vvvv>vvv>>v>>>v                                                                                                                                                              
+17 >>vvvvvvv^^^^^>>>^^<<<vvvvvvvvo>>>>>>v>>>vvovvv>>v                                                                                                                                                              
+18 o>>>vvvvv<<<o>>>>^^<<>>>>vvvvvv>>>>>>>v^>>vvvvvovv                                                                                                                                                              
+19 v>>>>vvv<<<<>>>>>^^^^^>>>>vvvvv>^^^^>>vvo>vvvvv>vv                                                                                                                                                              
+20 vo>>>vv<<<<<>>^^^^^^<^^>>>>vvvv<^^^vo>>vv>vvvvv>vv                                                                                                                                                              
+21 vvv>vv<<<<<o>^^^>>^^<<o>>>>>>vvvvovvv>>>>>>>vvvovv                                                                                                                                                              
+22 vvvvvv<<<<<vvv<o>>vv<<v>>>>>>>vvvv>vvvo>>>>>>vvvvv                                                                                                                                                              
+23 vvvvv<<^^^vvvvvvv>vv<<<>>^>>>>>>>>>>>>>>>>v>>>vvvv                                                                                                                                                              
+24 vvvv<<<<^>>>vvvvvvv<<<<^^^^^^>>>>>^>>>>>>>vvo>vvvv                                                                                                                                                              
+25 vvv<<<<<o>>>vvvvvvv<<<<o^^o^^^^^>vvovo>v>>>vv>vvvv                                                                                                                                                              
+26 v<<<<<<<v>>>>vvvv>v<<<<vvvvv^ovvo>vvvvvvvo>>>>>vvv                                                                                                                                                              
+27 <<<<<<<vv>>>>>>>>>^<<<vvvvvvv>>v>>>>>>>>v>>>>>>>vv                                                                                                                                                              
+28 ^^^^^^<<vv^^^^^^^^^^<<vvvvvv<<>>>>>>>>>>>>>>>>>>>v                                                                                                                                                              
+29 ^^^^^^^<<<<^^^^^^^^^^<vvvv<<<<o>^^o>>>>>>>>>>>>>>.                                                                                                                                                              
+30 ^^^^^^^^<<<^^^^^^^^^^>>><<<<vv>>^>>>>>>>>>>>>>>>>^                                                                                                                                                              
+31 ^^<^^^^^^<<o>^^^^^^^^^>^^<<>>>>^^o>>>>^^^o^>>>^^o^                                                                                                                                                              
+32 ^^<<o>>^^<<vv^^^^o>^^^>^^^^^^^^^>>>>>>^^^>^o>^^^>^                                                                                                                                                              
+33 ^^^<v>>^^<<vvv<ovvv^^>>^^<<^^vvo^^o>>>>>>>>>>^^o>^                                                                                                                                                              
+34 ^^^v>>>^^^>>vvvvvvv<o>>vv<<o>vvvv>>>^^>>>>>>>^^>>^                                                                                                                                                              
+35 vo>v>>^^^^>>>v<<>vvvvvvvv<<>>vvvvo>>^^o>>>>>^^^>^^                                                                                                                                                              
+36 vvvvv^^^<o>>vv<<<>vvvvvv<<<>>>vvv>>>^<>>>>>^^^^o^^                                                                                                                                                              
+37 vvvv<<^^vvvvv<<<^>>>vvvvv<<>>>>>>>>^^^vo>>^^^^^>>^                                                                                                                                                              
+38 vvvv<<o>vvvvv<<<o>>>>>vvvv<o>>>>>>>^^>v>>>^^^^^^o^                                                                                                                                                              
+39 vvvv<vvvvvvvv<<<v>>>>>>vvvvv>>>>>>^^^>>>>>^^^^^>>^                                                                                                                                                              
+40 vvvvvvvvvvvvv<<vv>>>>>>>vvv>>>>>^^^^^o>>>^^^^o^>>^                                                                                                                                                              
+41 v<<<vvvvvvvvv<<<v>^^^>>>>>>>>^^^^^^^<>>>>^^^^>>>^^                                                                                                                                                              
+42 v<<<vvvvvvvv<<<<<<^^^>>>>>>>^^^^^^^<o>>>>^^^^>>^^^                                                                                                                                                              
+43 v<<<<vvvv<<<<<<<^^<<o>>>>>^^^^^^^^<<>>>>^^^^^>^^^^                                                                                                                                                              
+44 v<<<<<<<<<<^<<<^^^<vv>>>>^^^^<o>^^^>>>>>^^^^^^^^^o                                                                                                                                                              
+45 <<<<<<<<<^^^<<<<^^>vv>>>^^^^<<>>^^<o>>^^^^^^^^^^<<                                                                                                                                                              
+46 ^<<<<<<^^^^^<<<<o>>v>>>>^^^<<o>>^^<<>^^^^^^^^^^^<<                                                                                                                                                              
+47 ^<<<<<<^^^^^^<<vv>>>>>>^^^<<<vvo>^vvvo^^^^^^^^^^^<                                                                                                                                                              
+48 ^<<<<<<^^^^^^vvvv>>>>>>^^^<<<<<>>vvvvvvo^o^^^^^^^^                                                                                                                                                              
+49 ^<<<<<<<^^^>>>vvv>>>>>>^^^<<<<<>>>vvvvv<<>>>^^^^^^                                                                                                                                                              
+50 ^<<<<<<<<o>>>>>>>>>>>>>^^^<<<<o>>>>v<<<<<o>>^^^^^^                                                                                                                                                              
+
+
+
+ 1 ^<<<<o>>>^<>>>>>^<<<<>>^<<<<>>>^<<<<<<o>>^<>>>>>>>                                                                                                                                                              
+ 2 ^<^^vvvvv^^^^>>^^^^^^^^^^^^^^^^^<<<<ov>>^^^o>^^^^^                                                                                                                                                              
+ 3 v<o>vvvv<<^^>>>^^^^^^^^^^<^^^>^^^<<<<vovvov>>^^^^^
+ 4 vvvvvvvv<<<o>>>^^^^^^^^^^<<o>>^^^^^<<<<>vvv<ov^o>^                                                                                                                                                              
+ 5 vvvvv>><<vvvvv>^^^^<o>^^^^<vvv^^^^^^v<o>vv<<>vv<>^                                                                                                                                                              
+ 6 vvvv<<^^vvvvvv<^^^^vvv^^^^>vvv<<o^o>vv<>>vvo>vv<>^                                                                                                                                                              
+ 7 vv<<<<^>>vvvvv<<<o>>>vv<o>>>vv<<vvvvv<<<>vvvvvv<ov                                                                                                                                                              
+ 8 <<<<<<^>>>vvvv<<<v>>>><<v>>>>vvvvv>>v<<o>>>>>vvvvv                                                                                                                                                              
+ 9 ^<<<<<o>>>>vvv<<<<<^>^^<<>>>>>v<<<<>^<<<>^>>>>vvvv                                                                                                                                                              
+10 ^^<<<<v>>>>vvv<<<<<o>^^^<^^>>>^<<<^>^<<<<^o>>>vvvv                                                                                                                                                              
+11 ^^^<<<vv>>>>v<<<<<<vv^^^^<o>>>^<<<o>v^<<o^>>>>>vvv                                                                                                                                                              
+12 ^^^^<<>>>>>>^<<<<<vvv<o>vvv>>>^<<<vvv<<<<vo>>>>vvv                                                                                                                                                              
+13 ^^^^^^>>>>^^^^^<<<vvv<<>>v>>>>^<<vvv<<<ovv>>>>>vvv                                                                                                                                                              
+14 ^^^^^^^^>^^^^^^^<<<<<<<>>>>^^^^^<vv<<<<>v<>>>>>>vv                                                                                                                                                              
+15 o^^^^^^>>^^^^^^^^<<<<<<o>v^^^^^^>>v<<<ovvvo>>>>>>v                                                                                                                                                              
+16 >v^o^^o>>^^^^^^>^^<<<<<vvvv<o^^>>>^<<<vvvv<>>>>>>v                                                                                                                                                              
+17 >>vvvvvvv^^^^^>>>^^<<<<vvvvvvvo>>>^<<<<<<vvovv^>>v                                                                                                                                                              
+18 o>>>vvvvv<<<o>>>>^^<<<<>>vvvvvv>>>^^^^<<>>vvvv<o>v                                                                                                                                                              
+19 v>>>>vvv<<<<>>>>>^^^<^^>>>vvvvvv^^^^^^^vo>vvvv<>>v                                                                                                                                                              
+20 vo>>>vv<<<<<>>^^^^^^<<^>>>>vvv<<<^^^o^>vv>vvvv<>>v                                                                                                                                                              
+21 vvv>vv<<<<<o>^^^>>^^<<o>>>>><<<<<ovvv>>>>>>>vvvovv                                                                                                                                                              
+22 vvvvvv<<<<<vvv<o>>vv<<v>>^^^^<<<<vvv<<o>>>>>>vvvvv                                                                                                                                                              
+23 vvvvv<<^^^vvvvvvv>vv<<<>^^^^^^^<<<<<<<>>>>v^>>vvvv                                                                                                                                                              
+24 vvvv<<<<^>>>vvvvvvv<<<<^^^^^^^^^<<<^^>>v>>vvo>>vvv                                                                                                                                                              
+25 vvvv<<<<o>>>vvvvvvv<<<<ovvo^^^^^^^vovovv<>>vv>vvvv                                                                                                                                                              
+26 vv<<<<<<v>>>>vvvv>v<<<<vvvvvvo^^ovvvvvvvvo>v>>>vvv                                                                                                                                                              
+27 <<<<<<<vv>>>>>>>>>^<<<vvvvvv<<>v>>>>v>vvv>>>>>>>vv                                                                                                                                                              
+28 ^^^^^^<<vv^^^^^^^^^^<<vvvvv<<<<>>^>>>>>>>>>>>>>>>v                                                                                                                                                              
+29 ^^^^^^^<<<<^^^^^^^^^^<vvvv<<<<o^^^o>>>>>>>>>>>>>>.                                                                                                                                                              
+30 ^^^^^^^^<<<^^^^^^^^^^>>><<<<<<vv<<>>>>>^^>>>>>^^>^                                                                                                                                                              
+31 ^^<^^^^^^<<o>^^^^^^^^^^^^<<<<<<<<o>>>^^^^o^^>^^^o^                                                                                                                                                              
+32 ^^<<o>>^^<<vv^^^^o>^^^^^^^^^^<<<<>>>>^^^<vvo>^^^>^                                                                                                                                                              
+33 ^^^<v>>^^<<vvv<ovvv^^>>^^<^^^^<ov^o>^^^^vvv>>^^o>^                                                                                                                                                              
+34 ^^^v>>>^^^>>vvvvvvv<o>>^^<<o>vvvv<>>^^^>>>>>>^<>>^                                                                                                                                                              
+35 vo>v>>^^^^>>>v<<>vvvvv>vv<<<>vvvvo>>^^o>>>>>^^^>>^                                                                                                                                                              
+36 vvvvv^^^<o>>vv<<<>vvvvvv<<<<>>vvvv>>^<<>>>>^^^^o>^                                                                                                                                                              
+37 vvvv<<^^vvvvv<<<^>>>vvv<<<<<>>>vvvvv^<<o>>>^^^<<>^                                                                                                                                                              
+38 vvvv<<o>vvvvv<<<o>>>>>v<<<<o>>>vvvv<<<v>>>^^^^<<o^                                                                                                                                                              
+39 vvvv<vvvvvvvv<<<v>>>>>^<<<<v>>>>v<<<<>>>>>^^^^^<<v                                                                                                                                                              
+40 vvvvvvvvvvvvv<<vvv>^^^^^vvvv>>>>^<<<<o>>>^^^^o^vvv                                                                                                                                                              
+41 vvvvvvvvvvvvv<<<vv<^^^>>vvvvv^^^^<<<<>>>>^^^<<vv<<                                                                                                                                                              
+42 vvvvvvvvvvvv<<<<<<<<^>>>>v<<<<^^^^<<o>>>>^^<<<v<<<                                                                                                                                                              
+43 vvvvvvvvv>><<<<<^^<<o>>>vv<<<^^^^^<<>>>>^^^^<<<<<^                                                                                                                                                              
+44 vvvvvv<<<<^^<<<^^^<vv>>>v<<<<<o>^^<<>>>>^^^^<<<<<o                                                                                                                                                              
+45 v<<<<<<<^^^^<<<<^^>vvvvvv<<<<<>>^^<o>>^^^^^^^<<<<v                                                                                                                                                              
+46 <<<<<<<^^^^^<<<<o>>vvvvvv<<<<o>>>vvv>^^^^^^^^^<<<v                                                                                                                                                              
+47 ^<<<<<<^^^^^^<<<vv>vvvvvv<<<<vvo>vvvvo^^^^^^^^<<<<                                                                                                                                                              
+48 ^<<<<<<^^^^^^<vvvvvvvvvv<<<<<<<>>vvvvvvo^o>^^^^<<<                                                                                                                                                              
+49 ^<<<<<<<^^^>^>vvvvvvvvvv<<<<<<<>>>vvvvv<<>>>^^^^<<                                                                                                                                                              
+50 ^<<<<<<<<o>>>>v>>>>>>>v<<<<<<<o>>>>v<<<<<o>>>^^^<<                                                                                                                                                              
+
+
+ + + + diff --git a/proj3/dev_cases/diff3.html b/proj3/dev_cases/diff3.html new file mode 100644 index 0000000..5ac44c4 --- /dev/null +++ b/proj3/dev_cases/diff3.html @@ -0,0 +1,234 @@ + + + + +diff + + + + + + + + + + + + + + + + + + +
/home/advpetc/Documents/Ai/proj3/output.txt/home/advpetc/Documents/Ai/proj3/other/output3.txtoutput-3.txt
+
+ 1 ^<<<<<<<^<<>>>>>>^<<<<>>>>>^<<>^<<<<<<>^<>>^<<<<<<
+ 2 ^<^^^^^^^^<o>^^^>^^<<<^>>>^^^^^^^^^^<^^^^^>^^<^^^o                                                                                                                                                              
+ 3 ^<^^^^<o>vvvv^^>>^^^<<o>>>^^^^^^^^^^<o^^vo>vv<ovvv
+ 4 ^<<o>vvv>>vvv<o>>^^^<<<>>>^^^^^^^^^^<>>vvvvvvvvv<<
+ 5 ^<<<>vv<<>>vvvvvv^^^^v<>>^^<<o^^^ov^<>>>vvvvvvv<<<
+ 6 v<<<>>v<<^>>><>vv<<ovvvo>^^<<<>vvvvv<o>>>>>vvv<<<o
+ 7 v<<o>>v<<o>^^>>>vvvvvvvvv^^^<>>>vvvvvv>>>>>>vv<<<v
+ 8 v<vvvvv<<<>^^^>>>vvvvvvv<<^^^o>>vvvvvvv^^>>>>v<<<v
+ 9 vvvvvvv<<<<^^o>>>vvvv<<<<<o^vv>>vvvvv<<<^>>>>^<<<<                                                                                                                                                              
+10 v<<vv<<<<<ovv>>>>><<<<^<<<<>>>>>>>vvvv<<o>>>>^<<<^                                                                                                                                                              
+11 <<<<<<<<<<vv<>>>>^^^^^^^<<>^>>>>>>>vvvv<v>>>>^<<<^                                                                                                                                                              
+12 ^^^^^^^^<vvv<o>^^^^^^^^^<ovvo>>^>>>>vvv<<<>>^^<<<o                                                                                                                                                              
+13 ^^^^^^^^>vv<<<>^^^^^<o>vvvvvv>>^^>>>vvv<<<^>>^<<<v                                                                                                                                                              
+14 ^^^^^<o>>vv<<<ovo>^^<>>>vvvvvv^^^>>>>vvv<<o>>^^<<v                                                                                                                                                              
+15 ^<o>vvvvvv<<<<>vvvvv<o>>vvvv<<<^o>>>>vvvvvv>>>^^<<                                                                                                                                                              
+16 ^<>>>vvvvv<<<o>vvvv<<>>>>vv<<<<>>>>>>vvvvv<<^^^^^<                                                                                                                                                              
+17 ^<>>>>vvvv<<<vvvvv<<<>>>>><<<<o>>>>>>vvvvvv<o>^^^^                                                                                                                                                              
+18 v<o>>>>>>v<<vv>>vv<<<o>>>^^<<<v>>>>>>>vvvvvvvv^^^^                                                                                                                                                              
+19 v<<>>>>>>^<<<<>>><<<<>>>>^^^<<>>>^^>>vvvvvv<<<<o^^                                                                                                                                                              
+20 v<<o>>^^^^^<<<^^^^<<<>>>^^^^^^>>^^^>>vvvvvv<<<<<vo                                                                                                                                                              
+21 v<<>>>^^^^^^^^^^^^<<o>>^^^^^^o>vv<o>vvvvvvv<<<^vvv                                                                                                                                                              
+22 v<<o>^^^^^^^^<o>>vvvvvvv<<o^^>>vvvvvvvvvvvvv<ovvvv                                                                                                                                                              
+23 <<vvvv<o>^^^^vvv>vvvvvvv<<<vo>>vvvvvvv>>vvvvvvv<<<                                                                                                                                                              
+24 ^<vvvvvvvv<o>vvvvvvvvvv<<<<>>>>>vvvvv<>>>vvvvv<<<^                                                                                                                                                              
+25 ^>>>vvvvvvvvvvvvvv<<<<<<<<o>>>>>>>vv<<>>>vvvvv<<o^                                                                                                                                                              
+26 ^>>>vv<<<<vvvvvvv<<<^^^<<<>>>>>>>>>v<<^>>vvvvv<<<v                                                                                                                                                              
+27 o>>>v<<<^>>>vvvv<<<^^^^<<o>>>>>^>>>vv<o>>vvvv<<<<>                                                                                                                                                              
+28 v>>>^<<<^>>>>>v<<<<<^^^<<<>>>>^^^>>vv<<>>vvvvv<<ov                                                                                                                                                              
+29 vvv>^<<<o>>>>>v<<<<<o>^^<<o>>>vvvovvv<ovvvvvvv<vvv                                                                                                                                                              
+30 vv<<^^<<v>>>>>v<<<<<<>>^<<<>>>>>vvvvvvvvvvvvvv<<vv                                                                                                                                                              
+31 v<<<^^^<>>>>>>^<<<<<o>>^<<<ov^^>>>vvv<vvvvvvv<<<<v                                                                                                                                                              
+32 v<<<^^^>>>>>>^^<<<<<<>>^<<>>vv<o>vvv<<vv<>vvv<<<<v                                                                                                                                                              
+33 v<<<o^^^>>>>^^^^^<<<<>^^vo>>v<<>>vvv<>vv<>vv<<<<vv                                                                                                                                                              
+34 v<<<vv^o>>>>^^^^^^^vo^^>v<>>v<>>>vvvvovvovvv<<<>vv                                                                                                                                                              
+35 v<<<<<<>>>>^^^^^^^>vvvovvvo>vvo>>vvvvvvvvvvv<<ovvv                                                                                                                                                              
+36 v<<<<<<>>^^^^^<^^o>vvvvvvv>>>vv>vvvvvvvvvvvvvvvvvv                                                                                                                                                              
+37 v<<<<<o>^^^^^v<ovvvvvvvvvv<>>>vvvvvvvvvvvvvvvvvvvv                                                                                                                                                              
+38 v<<<<<vvv<o>vvvvvvvvvvvvvvvo>>>>>vvvvvvvvvvv<<<vvv                                                                                                                                                              
+39 v<<<<vvv<<v>>vvvv>>>>>>vvvvv>>>>>>vvv>vvvvv<<<<<<v                                                                                                                                                              
+40 v<<<<<<<<>>>>>v>>>>>>>>>>v>>>>>>>>>vv>vvvv<<<<<<<v                                                                                                                                                              
+41 <<<<<<<<^>>>>>>>>>>>>>>>>>>>>>>>>>>vvovvvv<<<<<<<v                                                                                                                                                              
+42 ^<<<<<<<o^^^>>>>>>>>>>>>>>>>>>>>>>>>vvvvv<<<<vv<<v                                                                                                                                                              
+43 ^<<<<<<<vvvo>>>>>>>>>>>>>>>vv>>>vvo>vvvvv<<ovvv<<v                                                                                                                                                              
+44 ^^^^<<<<<<vv>>^^>>>>>>>>>>>vvvo>>>>>>vvvv<<<vv<<<<                                                                                                                                                              
+45 ^^^^^^<<<>>>>>^^^>>>>^^>>>>>vv>vvo>>>>vv<<<<<<<<<<                                                                                                                                                              
+46 ^<^^^^^^^>>>>vv<o>>>vvvo>>>>>>>>>>>>>>.<<<<<<<<<<<                                                                                                                                                              
+47 ^<<^^^^o^o>>>vvvv>>>>vv>>>>>>>>>>>>>>>^^<<<<<<<<<<                                                                                                                                                              
+48 ^<<<o^vvv<>>>>vv>>>>>>>>>>>>>>>>>>^>>^^^^<<<^^^^^^                                                                                                                                                              
+49 ^<<<<>>vv<o>>>>>>>>>>>>>>>>^^>>>^^^o^^^^^^^o^^o^^^                                                                                                                                                              
+50 ^<<<o>>v<<>>>>>>>>>>>>>>>>^^^o>>>^>>>^^^o^^<^<<^^^                                                                                                                                                              
+
+
+
+ 1 ^<<<<<<<^<<>>>>>>^<<<<>>>>>^<<>^<<<<<<>^<>>^<<<<<<
+ 2 ^<^^^^^^^^<o>^^^^^^<<<^>>>^^^^^^^^^^<^^^^^>^^<^^^o                                                                                                                                                              
+ 3 ^<^^^^<o>vvvv^^>>^^^<<o>>>^^^^^^^^^^<o^^vo>vv<ovvv
+ 4 ^<<o>vvv>>vvv<o>>^^^<<<>>>^^^^^^^^^^<>>vvvvvvvvv<<
+ 5 ^<<<>vv<<>>vvvvvv^^^^v<>>^^<<o^^^ov^<>>>vvvvvvv<<<
+ 6 v<<<>>v<<^>>><>vv<<ovvvo>^^<<<>vvvvv<o>>>>>vvv<<<o
+ 7 v<<o>>v<<o>^^>>>vvvvvvvvv^^^<>>>vvvvvv>>>>>>vv<<<v
+ 8 v<vvvvv<<<>^^^>>>vvvvvvv<<^^^o>>vvvvvvv^^>>>>v<<<v
+ 9 vvvvvvv<<<<^^o>>>vvvv<<<<<o^vv>>vvvvv<<<^>>>>^<<<<                                                                                                                                                              
+10 v<<vv<<<<<ovv>>>>><<<<^<<<<>>>>>>>vvvv<<o>>>>^<<<^                                                                                                                                                              
+11 <<<<<<<<<<vv<>>>>^^^^^^^<<>^>>>>>>>vvvv<v>>>>^<<<^                                                                                                                                                              
+12 ^^^^^^^^<vvv<o>^^^^^^^^^<ovvo>>^>>>>vvvv<<>>^^<<<o                                                                                                                                                              
+13 ^^^^^^^^>vv<<<>^^^^^<o>vvvvvv>>^^>>>vvv<<<^>>^<<<v                                                                                                                                                              
+14 ^^^^^<o>>vv<<<ovo>^^<>>>vvvvvv^^^>>>>vvv<<o>>^^<<v                                                                                                                                                              
+15 ^<o>vvvvvv<<<<>vvvvv<o>>vvvv<<<^o>>>>vvvvvv>>>^^<<                                                                                                                                                              
+16 ^<>>>vvvvv<<<o>vvvv<<>>>>vv<<<<>>>>>>vvvvv<<^^^^^<                                                                                                                                                              
+17 ^<>>>>vvvv<<<vvvvv<<<>>>>><<<<o>>>>>>vvvvvv<o>^^^^                                                                                                                                                              
+18 v<o>>>>>>v<<vv>>vv<<<o>>>^^<<<v>>>>>>>vvvvvvvv^^^^                                                                                                                                                              
+19 v<<>>>>>>^<<<<>>><<<<>>>>^^^<<>>>^>>>vvvvvv<<<<o^^                                                                                                                                                              
+20 v<<o>>^^^^^<<<^^^^<<<>>>^^^^^^>>^^^>>vvvvvv<<<<<vo                                                                                                                                                              
+21 v<<>>>^^^^^^^^^^^^<<o>>^^^^^^o>vv<o>vvvvvvv<<<^vvv                                                                                                                                                              
+22 v<<o>^^^^^^^^<o>>vvvvvvv<<o^^>>vvvvvvvvvvvvv<ovvvv                                                                                                                                                              
+23 <<vvvv<o>^^^^vvv>vvvvvvv<<<vo>>vvvvvvv>>vvvvvvv<<<                                                                                                                                                              
+24 ^<vvvvvvvv<o>vvvvvvvvvv<<<<>>>>>vvvvv<>>>vvvvv<<<^                                                                                                                                                              
+25 ^>>>vvvvvvvvvvvvvv<<<<<<<<o>>>>>>>vv<<>>>vvvvv<<o^                                                                                                                                                              
+26 ^>>>vv<<<<vvvvvvv<<<^^^<<<>>>>>>>>>v<<^>>vvvvv<<<v                                                                                                                                                              
+27 o>>>v<<<^>>>vvvv<<<^^^^<<o>>>>>^>>>vv<o>>vvvv<<<<>                                                                                                                                                              
+28 vv>>^<<<^>>>>>v<<<<<^^^<<<>>>>^^^>>vv<<>>vvvvv<<ov                                                                                                                                                              
+29 vvv>^<<<o>>>>>v<<<<<o>^^<<o>>>vvvovvv<ovvvvvvv<vvv                                                                                                                                                              
+30 vv<<^^<<v>>>>>v<<<<<<>>^<<<>>>>>vvvvvvvvvvvvvv<<vv                                                                                                                                                              
+31 v<<<^^^<>>>>>>^<<<<<o>>^<<<ov^^>>>vvv<vvvvvvv<<<<v                                                                                                                                                              
+32 v<<<^^^>>>>>>^^<<<<<<>>^<<>>vv<o>vvv<<vv<>vvv<<<<v                                                                                                                                                              
+33 v<<<o^^^>>>>^^^^^<<<<>^^vo>>v<<>>vvv<>vv<>vv<<<<vv                                                                                                                                                              
+34 v<<<vv^o>>>>^^^^^^^vo^^>v<>>v<>>>vvvvovvovvv<<<>vv                                                                                                                                                              
+35 v<<<<<<>>>>^^^^^^^>vvvovvvo>vvo>>vvvvvvvvvvv<<ovvv                                                                                                                                                              
+36 v<<<<<<>>^^^^^<^^o>vvvvvvv>>>vv>vvvvvvvvvvvvvvvvvv                                                                                                                                                              
+37 v<<<<<o>^^^^^v<ovvvvvvvvvv<>>>vvvvvvvvvvvvvvvvvvvv                                                                                                                                                              
+38 v<<<<<vvv<o>vvvvvvvvvvvvvvvo>>>>>vvvvvvvvvvv<<<vvv                                                                                                                                                              
+39 v<<<<vvv<<v>>vvvv>>>>>>vvvvv>>>>>>vvv>vvvvv<<<<<<v                                                                                                                                                              
+40 <<<<<<<<<>>>>>v>>>>>>>>>>v>>>>>>>>>vv>vvvv<<<<<<<v                                                                                                                                                              
+41 ^<<<<<<<^>>>>>>>>>>>>>>>>>>>>>>>>>>vvovvvv<<<<<<<v                                                                                                                                                              
+42 ^<<<<<<<o^^^>>>>>>>>>>>>>>>>>>>>>>>>vvvvv<<<<vv<<v                                                                                                                                                              
+43 ^<<<<<<<vvvo>>>>>>>>>>>>>>>vv>>>vvo>vvvvv<<ovvv<<v                                                                                                                                                              
+44 ^<^^<<<<<<vv>>^^>>>>>>>>>>>vvvo>>>>>>vvvv<<<vv<<<<                                                                                                                                                              
+45 ^^^^^^<<<>>>>>^^^>>>>^^>>>>>vv>vvo>>>>vv<<<<<<<<<<                                                                                                                                                              
+46 ^<^^^^^^^>>>>vv<o>>>vvvo>>>>>>>>>>>>>>.<<<<<<<<<<<                                                                                                                                                              
+47 ^<<^^^^o^o>>>vvvv>>>>vv>>>>>>>>>>>>>>>^^<<<<<<<<<<                                                                                                                                                              
+48 ^<<<o^vvv<>>>>vv>>>>>>>>>>>>>>>>>>^>>^^^^<<<^^^^^^                                                                                                                                                              
+49 ^<<<<>>vv<o>>>>>>>>>>>>>>>>^^>>>^^^o^^^^^^^o^^o^^^                                                                                                                                                              
+50 ^<<<o>>v<<>>>>>>>>>>>>>>>>^^^o>>>^>>>^^^o^^<^<<^^^                                                                                                                                                              
+
+
+
+ 1 ^<<<<<<<^<<>>>>>>^<<<<>>>>>^<<>^<<<<<<>^<>>^<<<<<<
+ 2 ^<^^^^^^^^<o>^^^>^^<<<^>>>^^^^^^^^^^<^^^^^>^^<^^^o                                                                                                                                                              
+ 3 ^<^^^^<o>vvvv^^>>^^^<<o>>>^^^^^^^^^^<o^^vo>vv<ovvv
+ 4 ^<<o>vvv>>vvv<o>>^^^<<<>>>^^^^^^^^^^<>>vvvvvvvvv<<
+ 5 ^<<<>vv<<>>vvvvvv^^^^v<>>^^<<o^^^ov^<>>>vvvvvvv<<<
+ 6 v<<<>>v<<^>>><>vv<<ovvvo>^^<<<>vvvvv<o>>>>>vvv<<<o
+ 7 v<<o>>v<<o>^^>>>vvvvvvvvv^^^<>>>vvvvvv>>>>>>vv<<<v
+ 8 v<vvvvv<<<>^^^>>>vvvvvvv<<^^^o>>vvvvvvv^^>>>>v<<<v
+ 9 vvvvvvv<<<<^^o>>>vvvv<<<<<o^vv>>vvvv<<<<^>>>>^<<<<                                                                                                                                                              
+10 v<<vv<<<<<ovv>>>>><<<<^<<<<>>>>>>>vv<<<<o>>>>^<<<^                                                                                                                                                              
+11 <<<<<<<<<<vv<>>>>^^^^^^^<<>^>>>>>>>vvv<<v>>>>^<<<^                                                                                                                                                              
+12 ^^^^^^^^<vvv<o>^^^^^^^^^<ovvo>>^^^>>vv<<<<>>^^<<<o                                                                                                                                                              
+13 ^^^^^^^^>vv<<<>^^^^^<o>vvvvvv>>^^^>>>vv<<<^>>^<<<v                                                                                                                                                              
+14 ^^^^^<o>>vv<<<ovo>^^<>>>vvvvvv^^^>>>>vv<<<o>>^^<<v                                                                                                                                                              
+15 ^<o>vvvvvv<<<<>vvvvv<o>>vvvv<<<^o>>>>vvvv<v>>>^^<<                                                                                                                                                              
+16 ^<>>>vvvvv<<<o>vvvv<<>>>>vv<<<<>>>>>>vvvv<<<^^^^^<                                                                                                                                                              
+17 ^<>>>>vvvv<<<vvvvv<<<>>>>><<<<o>>>>>>>vvvv<<o>^^^^                                                                                                                                                              
+18 v<o>>>>>>v<<vv>>vv<<<o>>>^^<<<v>>>>>>>vvvv<<vv^^^^                                                                                                                                                              
+19 v<<>>>>>>^<<<<>>><<<<>>>>^^^<<>>>^^>>>>vvvv<<<<o^^                                                                                                                                                              
+20 v<<o>>^^^^^<<<^^^^<<<>>>^^^^^^>>^^^>>>>vvvv<<<<<vo                                                                                                                                                              
+21 v<<>>>^^^^^^^^^^^^<<o>>^^^^^^o>vv<o>>>>vvvv<<^^vvv                                                                                                                                                              
+22 v<<o>^^^^^^^^<o>>vvvvvvv<<o^^>>vvvv>>>>>vvv<<ovvvv                                                                                                                                                              
+23 <<vvvv<o>^^^^vvv>vvvvvvv<<<vo>>vvvv>>>>>>vvvvvv<<>                                                                                                                                                              
+24 ^<vvvvvvvv<o>vvvvvvvvvv<<<<v>>>vvv>>>>>>>vvvvv<<<^                                                                                                                                                              
+25 ^>>>vvvvvvvvvvvvvv<<<<<<<<o>>>>>>>>^^^^>>>vvvv<<o^                                                                                                                                                              
+26 ^>>>vv<<<<vvvvvvv<<<^^^<<<>>>>>^^^^^^^^>>>vvv<<<<v                                                                                                                                                              
+27 o>>>v<<<^>>>vvvv<<<^^^^<<o>>>>^^^^^^<<o>>>vvv<<<<>                                                                                                                                                              
+28 v>>>^<<<^>>>>>v<<<<<^^^<<<>>>^^^^^>vv<>>>>vvvv<<ov                                                                                                                                                              
+29 vvv>^<<<o>>>>>v<<<<<o>^^<<o>>^^<<o>vv<o>>vvvvv<<vv                                                                                                                                                              
+30 vv<<^^<<v>>>>>v<<<<<<>>^<<<>>^^<vvvvv<v>>vvvvv<<vv                                                                                                                                                              
+31 v<<<^^^<>>>>>>^<<<<<o>>^<<<o>^^>>>vv<<>>>>vvv<<<<v                                                                                                                                                              
+32 v<<<^^^>>>>>>^^<<<<<<>>^<<<>v^^o>vvv<<>>>>vvv<<<<v                                                                                                                                                              
+33 v<<<o^^^>>>>^^^^^<<<<>^^<o>>v<<>>vvv<<^^>>vv<<<^>v                                                                                                                                                              
+34 v<<<vv^o>>>>^^^^^^^<o^^^v<>>v<>>>vvvvovvovvv<<<>>v                                                                                                                                                              
+35 v<<<<<<>>>>^^^^^^^^vvvovvvo>vvo>>vvvvvvvvvvv<<ovvv                                                                                                                                                              
+36 v<<<<<<>>^^^^^^^^o>vvvvvvv<>vvv>>vvvvvvvvvvv<vvvvv                                                                                                                                                              
+37 v<<<<<o>^^^^^v<ovvvvvvvvv<<>>>vvvvvvvvvvvvvvvvvvvv                                                                                                                                                              
+38 v<<<<<vvv<o>vvvvvvvvvvvvvvvo>>>>>vvv>>vvvvv<<<<vvv                                                                                                                                                              
+39 v<<<<vvv<<v>>vvvvvv>vvvvvvvv>>>>>>vv>>>vvvv<<<<<<v                                                                                                                                                              
+40 v<<<<<<<<>>>>>vv>>>>>>>>vvv>>>>>>>>vv>>vvv<<<<<<<v                                                                                                                                                              
+41 <<<<<<<<^>>>>>>>>>>>>>>>>>>>>>>>>>>vvovvv<<<<<<vvv                                                                                                                                                              
+42 ^<<<<<<<o^^^>>>>>>>>>>>>>>vv^^>>^^>>vvvvv<<<^vvvvv                                                                                                                                                              
+43 ^<<<<<<<vvvo>>>>>>>>>>>>>>vvv^^^^^o>vvvvv<<ovvvv<v                                                                                                                                                              
+44 ^^^^<<<<<<vv>>^^^>>>^^^>>>vvvvovv>>>>vvvv<<<vv<<<<                                                                                                                                                              
+45 ^^^^^^<<<>>>>v^^^>>>^^^>>>>vvvvvvo>>>>vv<<<<<<<<<<                                                                                                                                                              
+46 ^<^^^^^^^^>>>vv<o>>vvv<o>>>>>v>vv>>>>>.<<<<<<<<<<<                                                                                                                                                              
+47 ^<<^^^^o^o>>>vvvv>>vvvv>>>>>>>>>>>>>>^^^<<<<<<<<<<                                                                                                                                                              
+48 ^<<<o^vvv<>>>>vvv>>>>v>>>>>>>>>>>^^^>^^^^^<^^^^^^^                                                                                                                                                              
+49 ^<<<<>>vv<o>>>>>>>>>>>>>>>^^^^>>^^^o>^^^^^^o^^o^^^                                                                                                                                                              
+50 ^<<<o>>v<<>>>>>>>>>>>>>>>^^^^o>>^^<>>^^^o^^<^<>>^^                                                                                                                                                              
+
+
+ + + + diff --git a/proj3/other/output0.txt b/proj3/other/output0.txt new file mode 100644 index 0000000..558a80c --- /dev/null +++ b/proj3/other/output0.txt @@ -0,0 +1,4 @@ +>..^<< diff --git a/proj3/other/output2.txt b/proj3/other/output2.txt new file mode 100644 index 0000000..17faed2 --- /dev/null +++ b/proj3/other/output2.txt @@ -0,0 +1,50 @@ +<<<<>>^<>>>>>^<<<<>>^<<<<>>>^<<<<<>^<>>>>>>> +^<^^vvvvv^^^^>>^^^^^^^^^^^^^^^^^<<<>^^^o>>^^^^ +vvvvv<<^^>>>^^^^^^^^^^<^^^>^^^<<<>^^^^^ +vvvvvvvv<<>>^^^^^^^^^^<>^^^^^<<<<>vvv^ +vvvvv>><^^^^^^^^vvvv^^^^^^vvv<<>vv<>^ +vvvv<<^^vvvvvv<^^^^vvv^^^>>vvv<vv<>>vvo>vv<<^ +vv<<<<^>>vvvvv<<>>vv>>vvvvvvvvv<<>>vvvvvvvov +<<<<<<^>>>vvvv<<>>><>>>vvvvv>>vv>>>>vvvvv +^<<<<>>>vvv<<<<<^>^^<<>>>>>vv<<<>vv<<>^>>>vvvvv +^^<<<>>>vvv<<<<^^^<^^>>>vv<<^>>v<<<^o>>vvvvv +^^^<<>>>v<<<<<>>vvvvv<>>vvvvv +^^^^<<>>>>>>^<<<<vvv>>>vvvvvvv<<>vvvvv +^^^^^^>>>>^^^^^<<>v>>>>>vvvvvv<>>vvvvv +^^^^^^^^>^^^^^^^<<<<<<<>>>>^>>>>>vvvv<<>v<>>>vvvvv +o^^^^^^>>^^^^^^^^<<<<<v^^^^>>>>vvvvovvvo>>v>>vv +>v^o^^o>>^^^^^^>^^<<<>>>vvvv>vvv>>v>>>v +>>vvvvvvv^^^^^>>>^^<<>>>>>v>>>vvovvv>>v +o>>>vvvvv<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<vvvvv +^^^^<<<<<>^^^^^^^^^^^^^<<>>vvvv<>>>v^^^^>^^<^^^^^<<>>>vv<<<>>v<>^^<>^v<>>>>.<<<<<<<<<<< +^<<^^^^o^o>>>vvvvv>vv>>>>>>>^^^<<<<^^^^^^ +^<<>>>vvvvvvvvvvvvv<^^>>>^^^>^^^^^^^^^^^^^ +^<<<<>>vv>>vvvvvvvvvvvv<<<^^^^^^o>^^^^^^o^^o>^^ +^<<>v<<>>>>>>>>>v<<<<<<<<>^<<>>^^>v>>>^ diff --git a/proj3/project3cs360s2019.py b/proj3/project3cs360s2019.py new file mode 100644 index 0000000..ec2e51b --- /dev/null +++ b/proj3/project3cs360s2019.py @@ -0,0 +1,146 @@ +import os + +__location__ = os.path.realpath( + os.path.join(os.getcwd(), os.path.dirname(__file__))) + +test_path = "dev_cases/" +# right, down, left, up +orientation = [(1, 0), (0, 1), (-1, 0), (0, -1)] + +class Solver(object): + def __init__(self, grid_size, obstacles, dest): + self.row, self.col = grid_size, grid_size + self.dest = dest + self.reward = dict() + self.states = set() + self.obstacles = obstacles + for x in range(grid_size): + for y in range(grid_size): + self.states.add((x, y)) + if (x, y) == dest: + self.reward[x, y] = 99 + elif (x, y) in obstacles: + self.reward[x, y] = -101 + else: + self.reward[x, y] = -1 + + def prettyPrint(self, U): + to_print = "" + for i in range(self.row): + for j in range(self.col): + if (i, j) == self.dest: + to_print += "101 " + else: + to_print += str(U[i, j]) + " " + to_print += "\n" + print(to_print) + print('------') + + def solve(self): + U = self.cal_util() + # self.prettyPrint(U) + pi = dict() + for s in self.states: + up_util = sum([p * U[_s] for (p, _s) in self.T(s, orientation[3])]) + down_util = sum([p * U[_s] for (p, _s) in self.T(s, orientation[1])]) + left_util = sum([p * U[_s] for (p, _s) in self.T(s, orientation[2])]) + right_util = sum([p * U[_s] for (p, _s) in self.T(s, orientation[0])]) + curr_max = max(up_util, down_util, left_util, right_util) + if curr_max == up_util: + pi[s] = orientation[3] + elif curr_max == right_util: + pi[s] = orientation[0] + elif curr_max == down_util: + pi[s] = orientation[1] + elif curr_max == left_util: + pi[s] = orientation[2] + return self.to_grid(pi) + + def to_grid(self, pi): + grid = [[None for _ in range(self.row)] for _ in range(self.col)] + for x in (range(self.row)): + for y in (range(self.col)): + if (x, y) in self.obstacles: + grid[y][x] = 'o' + elif (x, y) == self.dest: + grid[y][x] = '.' + else: + mapping = {(1, 0): '>', (0, 1): 'v', (-1, 0): '<', (0, -1): '^'} + grid[y][x] = mapping[pi[(x, y)]] + with open(os.path.join(__location__, 'output.txt'), 'w') as outfile: + for row in grid: + for e in row: + outfile.write(e) + outfile.write('\n') + + def cal_util(self): + _U = dict([(s, 0) for s in self.states]) + T, gamma, epsilon = self.T, 0.9, 0.1 + while True: + U = _U.copy() + delta = 0 + for s in self.states: + if s == self.dest: continue + reward = self.reward[s[0], s[1]] + _U[s] = reward + gamma * max([sum([p * U[s1] for (p, s1) in T(s, a)]) + for a in orientation]) + delta = max(delta, abs(_U[s] - U[s])) + if delta < epsilon * (1 - gamma) / gamma: + return U + + def T(self, state, action): + def go(state, direction): + curr = (state[0] + direction[0], state[1] + direction[1]) + return curr if curr in self.states else state + if action == None: + return [(0, 0, state)] + else: + # right, down, left, up + # left 2 -> back -> right 0 + # left 2 -> right -> up 3 + # left 2 -> left -> down 1 + + # right 0 -> back -> left 2 + # right 0 -> right -> down 1 + # right 0 -> left -> up 3 + + # up 3 -> back -> down 1 + # up 3 -> right -> right 0 + # up 3 -> left -> left 2 + + # down 1 -> back -> up 3 + # down 1 -> right -> left 2 + # down 1 -> left -> right 0 + right = orientation[(orientation.index(action) + 1) % len(orientation)] + left = orientation[orientation.index(action) - 1] # -1 = 3 + back = orientation[(orientation.index(action) + 2) % len(orientation)] + return [(0.7, go(state, action)), + (0.1, go(state, right)), + (0.1, go(state, left)), + (0.1, go(state, back))] + +def main(): + with open(os.path.join(__location__, test_path + 'input-3.txt'), 'r') as infile: + grid_size = int(infile.readline()) + num_obstacles = int(infile.readline()) + obstacles = list() + dest = None + for i, line in enumerate(infile): + coords = line.strip().split(",") + x, y = int(coords[0]), int(coords[1]) + if i == num_obstacles: + dest = (x, y) + else: + obstacles.append((x, y)) + # print('grid size is: {}\n' + # 'num of obstacles is: {}\n' + # 'obstacles are:\n {}\n' + # 'dest is: {}'.format( + # grid_size, + # num_obstacles, + # obstacles, + # dest)) + solver = Solver(grid_size, obstacles, dest) + solver.solve() +main() +