├── .gitignore ├── LICENSE ├── README.md ├── experiments ├── week01-web1 │ ├── README.md │ ├── lab │ │ ├── css │ │ │ ├── commons.css │ │ │ └── menu.css │ │ ├── img │ │ │ ├── icpc_logo.png │ │ │ └── selfie2.png │ │ ├── index.html │ │ ├── interests.html │ │ ├── main.html │ │ ├── menu.html │ │ └── timetable.html │ └── paper │ │ ├── images │ │ ├── preview-2-1.png │ │ ├── preview-2-2.png │ │ ├── preview-2-3.png │ │ └── web-html.png │ │ ├── inc-sources │ │ ├── source-2-1.html │ │ ├── source-2-2.html │ │ └── source-2-3.html │ │ ├── web-1-post.pdf │ │ ├── web-1-post.tex │ │ ├── web-1-pre.pdf │ │ └── web-1-pre.tex ├── week01-web2 │ ├── README.md │ ├── homework │ │ ├── Board_main.php │ │ ├── Board_read.php │ │ ├── Board_write.php │ │ └── Data.txt │ ├── lab │ │ ├── counter.txt │ │ ├── img │ │ │ ├── 0.JPG │ │ │ ├── 1.JPG │ │ │ ├── 2.JPG │ │ │ ├── 3.JPG │ │ │ ├── 4.JPG │ │ │ ├── 5.JPG │ │ │ ├── 6.JPG │ │ │ ├── 7.JPG │ │ │ ├── 8.JPG │ │ │ └── 9.JPG │ │ └── index.php │ └── paper │ │ ├── images │ │ ├── preview-3-1.png │ │ ├── preview-3-2.png │ │ └── preview-3-3.png │ │ ├── inc-sources │ │ ├── source-3-1.php │ │ ├── source-3-2.php │ │ ├── source-3-3.php │ │ └── source-web2.php │ │ ├── web-2-post.pdf │ │ ├── web-2-post.tex │ │ ├── web-2-pre.pdf │ │ └── web-2-pre.tex ├── week02-web3 │ ├── README.md │ ├── homework │ │ ├── 1.gif │ │ ├── 10.gif │ │ ├── 11.gif │ │ ├── 12.gif │ │ ├── 13.gif │ │ ├── 14.gif │ │ ├── 15.gif │ │ ├── 16.gif │ │ ├── 2.gif │ │ ├── 3.gif │ │ ├── 4.gif │ │ ├── 5.gif │ │ ├── 6.gif │ │ ├── 7.gif │ │ ├── 8.gif │ │ ├── 9.gif │ │ └── puzzle.html │ ├── lab │ │ ├── images │ │ │ ├── 0.jpg │ │ │ ├── 1.jpg │ │ │ ├── 2.jpg │ │ │ ├── 3.jpg │ │ │ ├── 4.jpg │ │ │ ├── 5.jpg │ │ │ ├── 6.jpg │ │ │ ├── 7.jpg │ │ │ ├── 8.jpg │ │ │ └── 9.jpg │ │ └── index.html │ └── paper │ │ ├── inc-sources │ │ └── source-web3.html │ │ ├── web-3-post.pdf │ │ ├── web-3-post.tex │ │ ├── web-3-pre.pdf │ │ └── web-3-pre.tex ├── week03-unix1 │ ├── README.md │ ├── homework │ │ ├── data │ │ ├── display.awk │ │ ├── phone │ │ └── utol.sh │ ├── lab │ │ ├── data │ │ ├── display.awk │ │ └── phone │ └── paper │ │ ├── inc-sources │ │ ├── display.awk │ │ ├── phone │ │ └── unix-1-pre.tex │ │ ├── unix-1-post.pdf │ │ ├── unix-1-post.tex │ │ ├── unix-1-pre.pdf │ │ └── unix-1-pre.tex ├── week04-unix2 │ ├── README.md │ ├── homework │ │ ├── .idea │ │ │ ├── encodings.xml │ │ │ ├── homework.iml │ │ │ ├── misc.xml │ │ │ ├── modules.xml │ │ │ ├── vcs.xml │ │ │ └── workspace.xml │ │ ├── Makefile │ │ ├── header.h │ │ ├── io.c │ │ ├── main.c │ │ └── solve.c │ ├── lab │ │ ├── Header.h │ │ ├── Output.cpp │ │ ├── String_Manipulation.cpp │ │ ├── build.sh │ │ └── main.cpp │ └── paper │ │ ├── unix-2-post.pdf │ │ ├── unix-2-post.tex │ │ ├── unix-2-pre.pdf │ │ └── unix-2-pre.tex ├── week05-cpp1 │ ├── README.md │ ├── homework │ │ ├── Makefile │ │ ├── Str.cpp │ │ ├── Str.h │ │ ├── Str.o │ │ ├── main │ │ ├── main.cpp │ │ └── main.o │ ├── lab │ │ ├── Array.cpp │ │ ├── Array.h │ │ ├── Makefile │ │ ├── RangeArray.cpp │ │ ├── RangeArray.h │ │ └── main.cpp │ └── paper │ │ ├── cpp-1-post.pdf │ │ ├── cpp-1-post.tex │ │ ├── cpp-1-pre.pdf │ │ └── cpp-1-pre.tex ├── week06-cpp2 │ ├── README.md │ ├── homework │ │ ├── Makefile │ │ ├── array.h │ │ ├── growablearray.h │ │ ├── main │ │ ├── main.cpp │ │ └── main.o │ ├── lab │ │ ├── LinkedList.h │ │ ├── Makefile │ │ ├── Stack.h │ │ └── main.cpp │ └── paper │ │ ├── cpp-2-post.pdf │ │ ├── cpp-2-post.tex │ │ ├── cpp-2-pre.pdf │ │ └── cpp-2-pre.tex └── week08-win3 │ ├── README.md │ ├── homework │ ├── ReadMe.txt │ ├── Solver.cpp │ ├── Solver.h │ ├── TreeCheck.aps │ ├── TreeCheck.cpp │ ├── TreeCheck.h │ ├── TreeCheck.rc │ ├── TreeCheck.sln │ ├── TreeCheck.suo │ ├── TreeCheck.v11.suo │ ├── TreeCheck.vcxproj │ ├── TreeCheck.vcxproj.filters │ ├── TreeCheck.vcxproj.user │ ├── TreeCheckDlg.cpp │ ├── TreeCheckDlg.h │ ├── data1.txt │ ├── res │ │ ├── TreeCheck.ico │ │ └── TreeCheck.rc2 │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h │ ├── lab │ ├── Input.txt │ ├── MainFrm.cpp │ ├── MainFrm.h │ ├── ReadMe.txt │ ├── UserImages.bmp │ ├── Waterfall.aps │ ├── Waterfall.cpp │ ├── Waterfall.h │ ├── Waterfall.rc │ ├── Waterfall.sln │ ├── Waterfall.suo │ ├── Waterfall.v11.suo │ ├── Waterfall.vcxproj │ ├── Waterfall.vcxproj.filters │ ├── Waterfall.vcxproj.user │ ├── WaterfallDoc.cpp │ ├── WaterfallDoc.h │ ├── WaterfallView.cpp │ ├── WaterfallView.h │ ├── define.h │ ├── mylist.cpp │ ├── mylist.h │ ├── res │ │ ├── Toolbar.bmp │ │ ├── Toolbar256.bmp │ │ ├── Waterfall.ico │ │ ├── Waterfall.rc2 │ │ └── WaterfallDoc.ico │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── waterfallsolver.cpp │ └── waterfallsolver.h │ └── paper │ ├── win-3-post.pdf │ ├── win-3-post.tex │ ├── win-3-pre.pdf │ └── win-3-pre.tex ├── final ├── final-1.cpp └── final-2.cpp ├── header.tex ├── llncs.cls ├── project-maze ├── README.md ├── code │ ├── data │ │ ├── maze0.maz │ │ ├── maze1.maz │ │ ├── maze2.maz │ │ ├── maze3.maz │ │ ├── maze4.maz │ │ ├── maze5.maz │ │ └── maze6.maz │ ├── main │ │ ├── Example │ │ │ ├── Example.cpp │ │ │ └── Example.h │ │ ├── ExternDoc.cpp │ │ ├── ExternDoc.h │ │ ├── ExternView.cpp │ │ ├── ExternView.h │ │ ├── Graphics │ │ │ ├── Clipping.cpp │ │ │ ├── Clipping.h │ │ │ ├── DrawFunc.cpp │ │ │ ├── DrawFunc.h │ │ │ └── Graphics_DS.h │ │ ├── MFC_Main.aps │ │ ├── MFC_Main.clw │ │ ├── MFC_Main.cpp │ │ ├── MFC_Main.h │ │ ├── MFC_Main.plg │ │ ├── MFC_Main.rc │ │ ├── MFC_Main.sln │ │ ├── MFC_Main.vcproj.user │ │ ├── MFC_Main.vcxproj │ │ ├── MFC_Main.vcxproj.filters │ │ ├── MFC_Main.vcxproj.user │ │ ├── MFC_Main.vcxproj_ │ │ ├── MFC_MainDoc.cpp │ │ ├── MFC_MainDoc.h │ │ ├── MFC_MainView.cpp │ │ ├── MFC_MainView.h │ │ ├── MainFrm.cpp │ │ ├── MainFrm.h │ │ ├── ReadMe.txt │ │ ├── StdAfx.cpp │ │ ├── StdAfx.h │ │ ├── UI │ │ │ ├── MsgView.cpp │ │ │ ├── MsgView.h │ │ │ ├── RubberBand.cpp │ │ │ ├── RubberBand.h │ │ │ ├── Scroll.cpp │ │ │ ├── Scroll.h │ │ │ ├── Zoom.cpp │ │ │ └── Zoom.h │ │ ├── UpgradeLog.XML │ │ ├── UpgradeLog2.XML │ │ ├── UpgradeLog3.XML │ │ ├── UpgradeLog4.XML │ │ ├── User Code │ │ │ └── usercode.cpp │ │ ├── Util │ │ │ ├── Math.cpp │ │ │ ├── Math.h │ │ │ ├── StringTokenizer.cpp │ │ │ └── StringTokenizer.h │ │ ├── _UpgradeReport_Files │ │ │ ├── UpgradeReport.css │ │ │ ├── UpgradeReport.xslt │ │ │ ├── UpgradeReport_Minus.gif │ │ │ └── UpgradeReport_Plus.gif │ │ ├── res │ │ │ ├── MFC_Main.ico │ │ │ ├── MFC_Main.rc2 │ │ │ ├── MFC_MainDoc.ico │ │ │ ├── Toolbar.bmp │ │ │ └── zoom.cur │ │ ├── resource.h │ │ ├── test.dat │ │ └── test2.dat │ └── snippets │ │ ├── generate_imperfect_maze.c │ │ └── generate_perfect_maze.c └── paper │ ├── report │ ├── design-report.pdf │ ├── design-report.tex │ ├── inc-images │ │ ├── screenshot0.png │ │ └── screenshot1.png │ ├── inc-sections │ │ ├── 2-1.tex │ │ ├── 2-2.tex │ │ ├── 2-3-week1.tex │ │ ├── 2-3-week2.tex │ │ ├── 2-3-week3.tex │ │ ├── 2-4.tex │ │ ├── 2-5.tex │ │ ├── 2-6.tex │ │ └── 3-1.tex │ └── inc-sources │ │ ├── MainDoc.cpp │ │ └── usercode.cpp │ ├── week12 │ ├── maze-1-post.pdf │ ├── maze-1-post.tex │ ├── maze-1-pre.pdf │ └── maze-1-pre.tex │ ├── week13 │ ├── maze-2-post.pdf │ ├── maze-2-post.tex │ ├── maze-2-pre.pdf │ └── maze-2-pre.tex │ └── week14 │ ├── maze-3-post.pdf │ ├── maze-3-post.tex │ ├── maze-3-pre.pdf │ └── maze-3-pre.tex └── project-tetris ├── README.md ├── code ├── decision_tree.c ├── decision_tree.h ├── makefile ├── ordered_list.c ├── ordered_list.h ├── queue.c ├── queue.h ├── rank.txt ├── tetris.c └── tetris.h └── paper ├── experiment-result.xlsx ├── report ├── design-report.pdf ├── design-report.tex ├── inc-images │ ├── screenshot-best.png │ ├── screenshot0.png │ ├── screenshot1.png │ ├── screenshot2.png │ ├── screenshot3.png │ └── screenshot4.png ├── inc-sections │ ├── 2-1.tex │ ├── 2-2.tex │ ├── 2-3-week1.tex │ ├── 2-3-week2.tex │ ├── 2-3-week3.tex │ ├── 2-4-java.tex │ ├── 2-4.tex │ ├── 2-5.tex │ ├── 2-6.tex │ └── 3-1.tex ├── inc-sources-java │ ├── TetrisJNI.java │ ├── build.gradle │ ├── constraints.kt │ ├── main.kt │ └── result.kt └── inc-sources │ ├── decision-tree.c │ ├── decision-tree.h │ ├── makefile │ ├── ordered-list.c │ ├── ordered-list.h │ ├── queue.c │ ├── queue.h │ ├── rank.txt │ ├── tetris.c │ └── tetris.h ├── week09 ├── images │ ├── colors256.png │ └── colors8.png ├── inc-sources │ ├── tetris-week09-experiment.c │ └── tetris-week09-homework.c ├── tetris-1-post.pdf ├── tetris-1-post.tex ├── tetris-1-pre.pdf └── tetris-1-pre.tex ├── week10 ├── tetris-2-post.pdf ├── tetris-2-post.tex ├── tetris-2-pre.pdf └── tetris-2-pre.tex └── week11 ├── tetris-3-post.pdf ├── tetris-3-post.tex ├── tetris-3-pre.pdf └── tetris-3-pre.tex /README.md: -------------------------------------------------------------------------------- 1 | # 컴퓨터공학 설계 및 실험 I 2 | 3 | CSE3013 - Computer Science and Engineering Laboratory I 4 | 5 | 2019년 1학기 / 장형수 교수님 6 | 7 | - 회사 등에서 실제로 사용되는 기술들을 다뤄봅니다. 8 | - 템플릿 코드가 주어지고 그 위에 구현하는 일이 잦기 때문에 컨벤션이 뒤죽박죽이거나 문법이 낡은 경우들도 있으니 유의하시기 바랍니다. 9 | 10 | - 1-8주차: [실험](experiments) 11 | - 1주차: [HTML](experiments/week01-web1), [PHP](experiments/week01-web2) 12 | - 2주차: [Javascript](experiments/week02-web3) 13 | - 3주차: [UNIX Shell Script / AWK](experiments/week03-unix1) 14 | - 4주차: [C / Make](experiments/week04-unix2) 15 | - 5주차: [C++ - OOP](experiments/week05-cpp1) 16 | - 6주차: [C++ - 다형성](experiments/week06-cpp2) 17 | - 8주차: [MFC](experiments/week08-win3) 18 | 19 | - 9-11주차: [테트리스 프로젝트](project-tetris) 20 | 21 | - 12-14주차: [미로 프로젝트](project-maze) 22 | 23 | - [기말 코드](final) (문제 미포함) 24 | -------------------------------------------------------------------------------- /experiments/week01-web1/README.md: -------------------------------------------------------------------------------- 1 | # 1주차: HTML 2 | 3 | - [실습 코드](lab) 4 | - [예비 보고서](paper/web-1-pre.pdf) 5 | - [결과 보고서](paper/web-1-post.pdf) 6 | 7 | ## 실습 8 | 9 | `` 태그를 이용해 HTML로 홈페이지를 만들어 봅니다. 10 | 11 | * (주: `` 테그는 이제 표준이 아니므로 실제 웹 페이지를 만드실 때는 사용하지 마시기 바랍니다) -------------------------------------------------------------------------------- /experiments/week01-web1/lab/css/commons.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | -webkit-font-smoothing: antialiased; 4 | -moz-osx-font-smoothing: grayscale; 5 | } 6 | 7 | html { 8 | font-family: 'Muli', 'Noto Sans KR', 'Noto Sans JP', 'NanumBarunGothic', 'NanumGothic', 'Malgun Gothic', sans-serif; 9 | font-weight: 400; 10 | 11 | -ms-text-size-adjust: 100%; 12 | -webkit-text-size-adjust: 100%; 13 | margin: 0; 14 | padding: 0; 15 | width: 100%; 16 | overflow-x: hidden; 17 | } 18 | 19 | body { 20 | margin: 0; 21 | padding: 0; 22 | width: 100%; 23 | overflow-x: hidden; 24 | } 25 | 26 | b { 27 | font-weight: 700; 28 | } 29 | 30 | strike { 31 | opacity: 0.5; 32 | } 33 | 34 | .contents { 35 | width: 100%; 36 | max-width: 1200px; 37 | margin: 0 auto; 38 | padding: 32px; 39 | } 40 | 41 | .contents a { 42 | color: #ff7784; 43 | text-decoration: none; 44 | } 45 | 46 | h1 { 47 | letter-spacing: -1.5px; 48 | } 49 | 50 | span.subtitle { 51 | font-weight: bold; 52 | } 53 | 54 | .selfie { 55 | width: 250px; 56 | height: 250px; 57 | float: right; 58 | } 59 | 60 | .right { 61 | height: 200px; 62 | float: right; 63 | } 64 | 65 | p.hr { 66 | margin: 16px 0; 67 | height: 0; 68 | width: 100%; 69 | border-bottom: 1px dashed #ddd; 70 | } 71 | 72 | th, td { 73 | padding: 8px; 74 | border-bottom: 1px solid #ddd; 75 | vertical-align: top; 76 | } 77 | 78 | table.time_table { 79 | width: 100%; 80 | border-spacing: 0; 81 | border-collapse: collapse; 82 | } 83 | 84 | table.time_table tr { 85 | border-bottom: 1px solid #ddd; 86 | } 87 | 88 | table.time_table tr th:first-of-type, 89 | table.time_table tr td:first-of-type { 90 | border-right: 1px solid #ddd; 91 | vertical-align: top; 92 | } 93 | 94 | tr.time_row { 95 | height: 100px; 96 | } 97 | 98 | .tt_class_1 { 99 | background: #ff7784; 100 | font-weight: bold; 101 | } 102 | 103 | .tt_class_2 { 104 | background: #e56b76; 105 | font-weight: bold; 106 | } 107 | 108 | .tt_class_3 { 109 | background: #ff8490; 110 | font-weight: bold; 111 | } 112 | 113 | .tt_class_4 { 114 | background: #ffadb5; 115 | font-weight: bold; 116 | } 117 | 118 | .tt_class_5 { 119 | background: #ff929c; 120 | font-weight: bold; 121 | } 122 | 123 | .tt_class_6 { 124 | background: #ff9fa8; 125 | font-weight: bold; 126 | } -------------------------------------------------------------------------------- /experiments/week01-web1/lab/css/menu.css: -------------------------------------------------------------------------------- 1 | html, 2 | head { 3 | width: 100%; 4 | height: 100%; 5 | overflow-y: hidden; 6 | background: #111111; 7 | } 8 | 9 | body { 10 | width: 100%; 11 | max-width: 1200px; 12 | height: 100%; 13 | color: #fff; 14 | padding: 32px; 15 | font-weight: bold; 16 | overflow-y: hidden; 17 | margin: 0 auto; 18 | } 19 | 20 | div.menu { 21 | position: relative; 22 | width: 100%; 23 | height: 100%; 24 | overflow-y: hidden; 25 | } 26 | 27 | div.caption { 28 | position: absolute; 29 | top: 0; 30 | left: 0; 31 | font-size: 2rem; 32 | font-weight: bold; 33 | } 34 | 35 | ul.menu_item_container { 36 | position: absolute; 37 | right: 0; 38 | bottom: 0; 39 | } 40 | 41 | ul.menu_item_container a { 42 | color: #fff; 43 | } 44 | 45 | ul.menu_item_container li { 46 | display: inline-block; 47 | list-style: none; 48 | margin-left: 8px; 49 | font-weight: bold; 50 | } -------------------------------------------------------------------------------- /experiments/week01-web1/lab/img/icpc_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web1/lab/img/icpc_logo.png -------------------------------------------------------------------------------- /experiments/week01-web1/lab/img/selfie2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web1/lab/img/selfie2.png -------------------------------------------------------------------------------- /experiments/week01-web1/lab/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Suhyun Park 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /experiments/week01-web1/lab/menu.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Menu 11 | 12 | 13 | 23 | 24 | -------------------------------------------------------------------------------- /experiments/week01-web1/paper/images/preview-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web1/paper/images/preview-2-1.png -------------------------------------------------------------------------------- /experiments/week01-web1/paper/images/preview-2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web1/paper/images/preview-2-2.png -------------------------------------------------------------------------------- /experiments/week01-web1/paper/images/preview-2-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web1/paper/images/preview-2-3.png -------------------------------------------------------------------------------- /experiments/week01-web1/paper/images/web-html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web1/paper/images/web-html.png -------------------------------------------------------------------------------- /experiments/week01-web1/paper/inc-sources/source-2-1.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /experiments/week01-web1/paper/inc-sources/source-2-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
testtesttest
testtest
test
-------------------------------------------------------------------------------- /experiments/week01-web1/paper/inc-sources/source-2-3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /experiments/week01-web1/paper/web-1-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web1/paper/web-1-post.pdf -------------------------------------------------------------------------------- /experiments/week01-web1/paper/web-1-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web1/paper/web-1-pre.pdf -------------------------------------------------------------------------------- /experiments/week01-web1/paper/web-1-pre.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | 3 | \begin{document} 4 | 5 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline WEB-1 예비 보고서} 6 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 7 | \institute{서강대학교 컴퓨터공학과} 8 | \maketitle 9 | 10 | \section{목적} 11 | 실험 내용의 기초가 되는 HTML 문법을 미리 숙지하여 본 실험에 임할 수 있도록 한다. 12 | 13 | \section{예비 학습} 14 | 15 | \subsection{문자 및 조판} 16 | 17 | \begin{multicols}{2} 18 | \begin{Figure} 19 | \includegraphics[width=\linewidth]{preview-2-1} 20 | \label{fig:preview-2-1} 21 | \end{Figure} 22 | \columnbreak 23 | \inputminted[xleftmargin=\parindent,linenos]{html}{inc-sources/source-2-1.html} 24 | \end{multicols} 25 | 26 | \subsection{테이블} 27 | 28 | \begin{multicols}{2} 29 | \begin{Figure} 30 | \includegraphics[width=\linewidth]{preview-2-2} 31 | \label{fig:preview-2-2} 32 | \end{Figure} 33 | \columnbreak 34 | \inputminted[xleftmargin=\parindent,linenos]{html}{inc-sources/source-2-2.html} 35 | \end{multicols} 36 | 37 | \subsection{프레임} 38 | 39 | \begin{multicols}{2} 40 | \begin{Figure} 41 | \includegraphics[width=\linewidth]{preview-2-3} 42 | \label{fig:preview-2-3} 43 | \end{Figure} 44 | \columnbreak 45 | \inputminted[xleftmargin=\parindent,linenos]{html}{inc-sources/source-2-3.html} 46 | \end{multicols} 47 | 48 | \section{보충 학습} 49 | 50 | HTML, CSS, JavaScript는 현대 웹을 이루는 대표적인 기술들이다. HTML(Hypertext Markup Language)은 웹 사이트의 구조를 정의하는 마크업 언어이고, CSS(Cascading Stylesheet)는 웹 사이트의 외관을 정의하는 스타일시트이다. JavaScript는 스크립트 언어로 그 사용이 웹에 국한되어 있지는 않으나, 웹에서는 유저와의 상호작용, 애니메이션, 서버와의 통신 등 다양한 일을 담당한다. 51 | 52 | \textbf{브라우저 엔진}은 이 파일들을 사용자가 읽을 수 있는 형태로 렌더해 주는 프로그램을 일컫는다. Firefox와 Opera 브라우저가 사용하는 \textbf{Gecko}, Chrome이나 Safari 등의 브라우저가 사용하는 \textbf{WebKit}, 그리고 지금은 지원이 종료된 Internet Explorer가 사용하는 \textbf{Trident} 등이 대표적 브라우저 엔진이다. 53 | 54 | 같은 웹 사이트라면 어떤 사용자에게나 같은 화면을 보여주는 것이 이상적이겠지만, 브라우저 엔진마다 HTML, CSS, JS 각각을 해석하는 방법이 조금씩 다르다. 이런 이유로 엔진마다 사용자에게 렌더되는 내용을 일관적으로 보이게 하기 위해 만들어진 것이 웹 언어 \textbf{표준}이다. HTML과 CSS는 \textbf{W3C}(World Wide Web Consortium)에 의해 표준화되어 있고, JavaScript는 ECMA International의 \textbf{ECMAScript} 표준을 따른다. 브라우저 엔진들은 이 표준에 명세되어 있는 항목들을 구현해야 한다. 55 | 56 | 최근 들어 특히 외국 사이트에서 Internet Explorer에서만 정상적으로 표시되지 않는 사이트들을 종종 볼 수 있게 되었다. 이는 IE와 IE의 엔진인 Trident에 대한 개발사 Microsoft의 지원이 종료되면서, IE가 더 이상 최신 표준을 지원하지 않게 되었기 때문이다. 현대 브라우저 엔진들인 Gecko와 WebKit은 HTML5, CSS3, ECMAScript 6 (ES6) 표준을 대부분 지키도록 구현되어 있으나 Trident는 HTML 4.01과 ES5 정도만 구현되어 있는 상태로 머물러 있다. 57 | 58 | 브라우저 엔진마다 갖고 있는 \textbf{독자 표준}도 있고, 독자 표준이 실제 표준이 되는 경우도 있다. 가령 CSS에서 요소의 변환을 의미하는 속성 \texttt{transform}은 W3C에 의해 표준으로 인정되기 전에 WebKit 등 일부 엔진에서만 \texttt{-webkit-transform}과 같은 형태로 사용할 수 있었다. 또한 현재 요소 뒤에 있는 모든 요소에 필터를 적용하는 \texttt{-webkit-backdrop-filter}와 같은 속성도 있다. WebKit은 Apple의 주도로 개발되고 있는데, \texttt{-webkit-backdrop-filter}로 뒤의 요소들에 전부 \texttt{blur()} 효과를 주면 Apple의 대표 운영체제 macOS의 디자인 패턴을 쉽게 구현할 수 있기 때문이라고 추측된다. 현재 \texttt{-webkit-backdrop-filter}는 W3C Filter Effects Module Level 2 표준으로 제안되어 있다. 59 | 60 | \begin{minted}{html} 61 | 62 | \end{minted} 63 | 64 | \end{document} 65 | -------------------------------------------------------------------------------- /experiments/week01-web2/README.md: -------------------------------------------------------------------------------- 1 | # 1주차: PHP 2 | 3 | - [실습 코드](lab) 4 | - [과제 코드](homework) 5 | - [예비 보고서](paper/web-2-pre.pdf) 6 | - [결과 보고서](paper/web-2-post.pdf) 7 | 8 | ## 실습 9 | 10 | 방문자 수 카운터를 구현해 봅니다. 11 | 12 | ## 과제 13 | 14 | 간단한 게시판 시스템을 구현해 봅니다. -------------------------------------------------------------------------------- /experiments/week01-web2/homework/Board_main.php: -------------------------------------------------------------------------------- 1 | is not interpreted by PHP; thus making 4 | it render like plain HTML. So it's basically similar with echo() 5 | but without interpretation. 6 | - Starting php block with 12 | 13 | 14 | 15 | 16 | 17 | 18 | BBS 19 | 20 | 21 | 게시판 쓰기
22 | 게시판 읽기
23 | 24 | -------------------------------------------------------------------------------- /experiments/week01-web2/homework/Board_read.php: -------------------------------------------------------------------------------- 1 | is not interpreted by PHP; thus making 4 | it render like plain HTML. So it's basically similar with echo() 5 | but without interpretation. 6 | - Starting php block with 20 | 21 | 22 | 23 | 24 | 25 | 26 | BBS 27 | 28 | 29 |

게시판 읽기



30 | 31 | 32 | 33 | 39 | 40 |
34 | 38 |
41 | 42 | 되돌아 가기 43 | 44 | -------------------------------------------------------------------------------- /experiments/week01-web2/homework/Board_write.php: -------------------------------------------------------------------------------- 1 | is not interpreted by PHP; thus making 4 | it render like plain HTML. So it's basically similar with echo() 5 | but without interpretation. 6 | - Starting php block with 28 | 29 | 30 | 31 | 32 | 33 | 34 | BBS 35 | 36 | 37 |

게시판 쓰기



38 | 39 |
40 | 41 |
42 | 43 | 44 |
45 | 46 |
47 | 되돌아 가기 48 | 49 | -------------------------------------------------------------------------------- /experiments/week01-web2/homework/Data.txt: -------------------------------------------------------------------------------- 1 | Sample text -------------------------------------------------------------------------------- /experiments/week01-web2/lab/counter.txt: -------------------------------------------------------------------------------- 1 | 0 -------------------------------------------------------------------------------- /experiments/week01-web2/lab/img/0.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/lab/img/0.JPG -------------------------------------------------------------------------------- /experiments/week01-web2/lab/img/1.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/lab/img/1.JPG -------------------------------------------------------------------------------- /experiments/week01-web2/lab/img/2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/lab/img/2.JPG -------------------------------------------------------------------------------- /experiments/week01-web2/lab/img/3.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/lab/img/3.JPG -------------------------------------------------------------------------------- /experiments/week01-web2/lab/img/4.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/lab/img/4.JPG -------------------------------------------------------------------------------- /experiments/week01-web2/lab/img/5.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/lab/img/5.JPG -------------------------------------------------------------------------------- /experiments/week01-web2/lab/img/6.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/lab/img/6.JPG -------------------------------------------------------------------------------- /experiments/week01-web2/lab/img/7.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/lab/img/7.JPG -------------------------------------------------------------------------------- /experiments/week01-web2/lab/img/8.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/lab/img/8.JPG -------------------------------------------------------------------------------- /experiments/week01-web2/lab/img/9.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/lab/img/9.JPG -------------------------------------------------------------------------------- /experiments/week01-web2/lab/index.php: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | PHP Counter 32 | 33 | 34 | "); 39 | } 40 | ?> 41 | 42 | -------------------------------------------------------------------------------- /experiments/week01-web2/paper/images/preview-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/paper/images/preview-3-1.png -------------------------------------------------------------------------------- /experiments/week01-web2/paper/images/preview-3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/paper/images/preview-3-2.png -------------------------------------------------------------------------------- /experiments/week01-web2/paper/images/preview-3-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/paper/images/preview-3-3.png -------------------------------------------------------------------------------- /experiments/week01-web2/paper/inc-sources/source-3-1.php: -------------------------------------------------------------------------------- 1 | "); 4 | 5 | $hello_world = "Hello World"; 6 | echo($hello_world); 7 | ?> -------------------------------------------------------------------------------- /experiments/week01-web2/paper/inc-sources/source-3-2.php: -------------------------------------------------------------------------------- 1 | "); 14 | echo("\$a + \$b = "); 15 | echo(add($a, $b) . "
"); 16 | echo("\$a - \$b = "); 17 | echo(sub($a, $b) . "
"); 18 | ?> -------------------------------------------------------------------------------- /experiments/week01-web2/paper/inc-sources/source-3-3.php: -------------------------------------------------------------------------------- 1 | "); 3 | for ($i = 1; $i <= 9; $i++) { 4 | echo(""); 5 | for ($j = 1; $j <= 9; $j++) echo(" $i x $j = " . $i * $j . ""); 6 | echo(""); 7 | } 8 | echo(""); 9 | ?> -------------------------------------------------------------------------------- /experiments/week01-web2/paper/inc-sources/source-web2.php: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | PHP Counter 32 | 33 | 34 | "); 39 | } 40 | ?> 41 | 42 | -------------------------------------------------------------------------------- /experiments/week01-web2/paper/web-2-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/paper/web-2-post.pdf -------------------------------------------------------------------------------- /experiments/week01-web2/paper/web-2-post.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | 3 | \begin{document} 4 | 5 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline WEB-2 결과 보고서} 6 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 7 | \institute{서강대학교 컴퓨터공학과} 8 | \maketitle 9 | 10 | \section{목적} 11 | 실습 과정에 있는 카운터 프로그램을 완성하고, 배운 것을 바탕으로 간단한 게시판을 생성하여 본다. 12 | 13 | \section{소스 코드} 14 | 15 | \inputminted[xleftmargin=\parindent,linenos]{php}{inc-sources/source-web2.php} 16 | 17 | \end{document} 18 | -------------------------------------------------------------------------------- /experiments/week01-web2/paper/web-2-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week01-web2/paper/web-2-pre.pdf -------------------------------------------------------------------------------- /experiments/week01-web2/paper/web-2-pre.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | 3 | \begin{document} 4 | 5 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline WEB-2 예비 보고서} 6 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 7 | \institute{서강대학교 컴퓨터공학과} 8 | \maketitle 9 | 10 | \section{목적} 11 | PHP의 기본 문법과 실험을 수행할 수 있는 배경 지식을 공부한다. 12 | 13 | \section{문제 풀이} 14 | 15 | \subsection{PHP 환경변수 값 알아보기} 16 | 17 | \begin{tabular}{ l | l } 18 | \hline 19 | 변수 이름 & 값 \\ 20 | \hline 21 | \texttt{\$\_SERVER["PHP\_SELF"]} & 현재 실행 중인 스크립트의 파일명 \\ 22 | \texttt{\$\_SERVER["SERVER\_NAME"]} & 호스트 서버 이름 \\ 23 | \texttt{\$\_SERVER["SCRIPT\_FILENAME"]} & 현재 실행되고 있는 스크립트의 절대 주소 \\ 24 | \texttt{\$\_SERVER["SERVER\_SOFTWARE"]} & 서버 증명 문자열 \\ 25 | \texttt{\$\_SERVER["SERVER\_ADDR"]} & 호스트 서버 IP \\ 26 | \texttt{\$\_SERVER["SERVER\_PORT"]} & 커뮤니케이션을 위해 사용되는 포트 \\ 27 | \texttt{\$\_SERVER["SERVER\_PROTOCOL"]} & 프로토콜의 이름과 버전 \\ 28 | \hline 29 | \end{tabular} 30 | 31 | \newpage 32 | \subsection{PHP 프로그래밍의 기초 문법} 33 | 34 | \begin{multicols}{2} 35 | \begin{Figure} 36 | \includegraphics[width=\linewidth]{preview-3-1} 37 | \label{fig:preview-3-1} 38 | \end{Figure} 39 | \columnbreak 40 | \begin{minipage}{\columnwidth} 41 | \inputminted[xleftmargin=\parindent,linenos]{php}{inc-sources/source-3-1.php} 42 | \end{minipage} 43 | \end{multicols} 44 | 45 | \subsection{PHP 프로그래밍의 함수} 46 | 47 | \begin{multicols}{2} 48 | \begin{Figure} 49 | \includegraphics[width=\linewidth]{preview-3-2} 50 | \label{fig:preview-3-2} 51 | \end{Figure} 52 | \columnbreak 53 | \begin{minipage}{\columnwidth} 54 | \inputminted[xleftmargin=\parindent,linenos]{php}{inc-sources/source-3-2.php} 55 | \end{minipage} 56 | \end{multicols} 57 | 58 | \subsection{PHP 프로그래밍의 응용} 59 | 60 | \begin{Figure} 61 | \includegraphics[width=\linewidth]{preview-3-3} 62 | \label{fig:preview-3-3} 63 | \end{Figure} 64 | 65 | \inputminted[xleftmargin=\parindent,linenos]{php}{inc-sources/source-3-3.php} 66 | 67 | \end{document} 68 | -------------------------------------------------------------------------------- /experiments/week02-web3/README.md: -------------------------------------------------------------------------------- 1 | # 2주차: Javascript 2 | 3 | - [실습 코드](lab) 4 | - [과제 코드](homework) 5 | - [예비 보고서](paper/web-3-pre.pdf) 6 | - [결과 보고서](paper/web-3-post.pdf) 7 | 8 | ## 실습 9 | 10 | 이미지 갤러리를 구현해 봅니다. 11 | * (주: `
` 테그와 `bgcolor`, `border` 같은 속성들은 이제 표준이 아니므로 실제 웹 페이지를 만드실 때는 사용하지 마시기 바랍니다) 12 | 13 | ## 과제 14 | 15 | 16 숫자 퍼즐을 구현해 봅니다. -------------------------------------------------------------------------------- /experiments/week02-web3/homework/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/1.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/10.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/11.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/12.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/13.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/14.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/15.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/16.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/2.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/3.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/4.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/5.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/6.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/7.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/8.gif -------------------------------------------------------------------------------- /experiments/week02-web3/homework/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/homework/9.gif -------------------------------------------------------------------------------- /experiments/week02-web3/lab/images/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/lab/images/0.jpg -------------------------------------------------------------------------------- /experiments/week02-web3/lab/images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/lab/images/1.jpg -------------------------------------------------------------------------------- /experiments/week02-web3/lab/images/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/lab/images/2.jpg -------------------------------------------------------------------------------- /experiments/week02-web3/lab/images/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/lab/images/3.jpg -------------------------------------------------------------------------------- /experiments/week02-web3/lab/images/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/lab/images/4.jpg -------------------------------------------------------------------------------- /experiments/week02-web3/lab/images/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/lab/images/5.jpg -------------------------------------------------------------------------------- /experiments/week02-web3/lab/images/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/lab/images/6.jpg -------------------------------------------------------------------------------- /experiments/week02-web3/lab/images/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/lab/images/7.jpg -------------------------------------------------------------------------------- /experiments/week02-web3/lab/images/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/lab/images/8.jpg -------------------------------------------------------------------------------- /experiments/week02-web3/lab/images/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/lab/images/9.jpg -------------------------------------------------------------------------------- /experiments/week02-web3/lab/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | ++ 자. 바. 스. 크. 립. 트 ++ 4 | 5 | 6 |
7 | 8 | 9 | 13 | 14 | 15 | 48 | 49 |
10 | 11 | 12 |
16 |
17 | 43 | 44 | 45 | 46 |
47 |
50 |
51 | 52 | 53 | -------------------------------------------------------------------------------- /experiments/week02-web3/paper/web-3-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/paper/web-3-post.pdf -------------------------------------------------------------------------------- /experiments/week02-web3/paper/web-3-post.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | 3 | \begin{document} 4 | 5 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline WEB-3 결과 보고서} 6 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 7 | \institute{서강대학교 컴퓨터공학과} 8 | \maketitle 9 | 10 | \section{소스 코드} 11 | 이 코드는 https://shiftpsh.com/web3/ 에서 실행시켜 볼 수 있다. 12 | 13 | \inputminted[xleftmargin=\parindent,breaklines,linenos]{html}{inc-sources/source-web3.html} 14 | 15 | \end{document} 16 | -------------------------------------------------------------------------------- /experiments/week02-web3/paper/web-3-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week02-web3/paper/web-3-pre.pdf -------------------------------------------------------------------------------- /experiments/week02-web3/paper/web-3-pre.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | 3 | \begin{document} 4 | 5 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline WEB-3 예비 보고서} 6 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 7 | \institute{서강대학교 컴퓨터공학과} 8 | \maketitle 9 | 10 | \section{DOM} 11 | \textbf{DOM}(Document Object Model)은 객체 지향 모듈로서, HTML, XHTML, XML 등의 문서를 트리 구조로 표현한다. 트리에서 모든 노드는 문서의 구성 요소를 의미하고, \textbf{DOM 메서드}는 이 트리와 트리 각각의 노드에 접근하고 수정할 수 있게 해 준다. 12 | 13 | 많은 브라우저 엔진이 웹 페이지를 렌더하기 위해 DOM 구조를 사용한다. 이 경우 DOM 트리의 루트 노드는 \textbf{문서 오브젝트}(Document Object)가 된다. 브라우저는 HTML을 다운로드하고 로컬 메모리에 로드해 둔 후 이를 파싱해 스크린에 렌더한다. 14 | 15 | 웹 페이지가 로드되면 브라우저는 페이지의 DOM을 생성한다. DOM은 JavaScript와 페이지 사이의 상호작용을 매개할 수 있으며, 다음과 같은 항목들을 가능하게 한다. 16 | \begin{itemize} 17 | \item HTML 요소와 속성을 전부 제어할 수 있다. HTML 요소들을 새로 추가하고, 수정하고, 삭제하는 것이 가능하다. 18 | \item 페이지의 CSS 스타일시트를 제어할 수 있다. 19 | \item 유저와 페이지 사이에 일어나는 모든 상호작용(클릭, 스크롤, 창 크기 조정 등)에 반응할 수 있다. 20 | \item 페이지 내에서 새로운 상호작용 이벤트를 만들 수 있다. 예를 들어 특정 HTML 요소를 클릭하는 상호작용을 시뮬레이션할 수 있다. 21 | \end{itemize} 22 | DOM의 이런 이점 덕분에 JavaScript는 동적인 웹 사이트를 만들 때 자주 사용된다. 23 | 24 | \end{document} 25 | -------------------------------------------------------------------------------- /experiments/week03-unix1/README.md: -------------------------------------------------------------------------------- 1 | # 3주차: UNIX Shell Script / AWK 2 | 3 | - [실습 코드](lab) 4 | - [과제 코드](homework) 5 | - [예비 보고서](paper/unix-1-pre.pdf) 6 | - [결과 보고서](paper/unix-1-post.pdf) 7 | 8 | ## 실습 9 | 10 | 전화번호부를 쿼리하는 쉘 스크립트를 작성해 봅니다. 11 | 12 | ## 과제 13 | 14 | 실습에서 작성한 쉘 스크립트는 입력한 키워드 중 하나 이상을 포함하는 항목들을 검색하는 스크립트였는데, 이를 입력한 키워드 전부를 포함하는 항목들을 검색하도록 바꿔 봅니다. -------------------------------------------------------------------------------- /experiments/week03-unix1/homework/data: -------------------------------------------------------------------------------- 1 | 문재인|서울특별시 종로구 세종로 1|02-730-5800 2 | 박원순|서울특별시 중구 세종대로 110|02-120 3 | 홍길동|서울시 마포구 신수동 서강대학교 AS관 301호|02-705-2665 4 | 박문수|서울시 서대문구 신촌동 연세대학교 연구관 102호|02-708-4678 5 | Andrew|경기도 의정부시 호원동 23-12번지|031-827-7842 -------------------------------------------------------------------------------- /experiments/week03-unix1/homework/display.awk: -------------------------------------------------------------------------------- 1 | BEGIN{FS="|"} 2 | {print "---------------->";} 3 | {print "name : "$1;} 4 | {print "address : "$2;} 5 | {print "phone : "$3;} 6 | {print "<----------------";} 7 | 8 | -------------------------------------------------------------------------------- /experiments/week03-unix1/homework/phone: -------------------------------------------------------------------------------- 1 | # If no arguments are given: 2 | if [ $# -eq 0 ]; then 3 | echo "Usage: phone searchfor [...searchfor]" 4 | echo "(You didn't tell me what you want to search for.)" 5 | exit 0 6 | fi 7 | 8 | # Pipeline all commands 9 | command="egrep $1 data" 10 | for arg in "${@:2}"; do 11 | command="$command | egrep $arg" 12 | done 13 | 14 | # Print results 15 | eval "$command | awk -f display.awk" 16 | exit 0 17 | -------------------------------------------------------------------------------- /experiments/week03-unix1/homework/utol.sh: -------------------------------------------------------------------------------- 1 | echo "Working directory:" 2 | read dir # Read directory from user 3 | 4 | if [ $dir ] # If input is given: 5 | then 6 | cd $dir # Move to given directory 7 | if [ $? -ne 0 ] # If cd fails: exit 8 | then 9 | echo "Error: Cannot access directory, check permissions" 10 | exit 0 11 | fi 12 | fi 13 | 14 | for file in * # Loop for all files/directories in dir 15 | do 16 | if [ -f $file ] # If $file is file 17 | then 18 | mv $file `echo $file | tr '[A-Z][a-z]' '[a-z][A-Z]'` 19 | fi 20 | done -------------------------------------------------------------------------------- /experiments/week03-unix1/lab/data: -------------------------------------------------------------------------------- 1 | 문재인|서울특별시 종로구 세종로 1|02-730-5800 2 | 박원순|서울특별시 중구 세종대로 110|02-120 3 | 홍길동|서울시 마포구 신수동 서강대학교 AS관 301호|02-705-2665 4 | 박문수|서울시 서대문구 신촌동 연세대학교 연구관 102호|02-708-4678 5 | Andrew|경기도 의정부시 호원동 23-12번지|031-827-7842 -------------------------------------------------------------------------------- /experiments/week03-unix1/lab/display.awk: -------------------------------------------------------------------------------- 1 | BEGIN{FS="|"} 2 | {print "---------------->";} 3 | {print "name : "$1;} 4 | {print "address : "$2;} 5 | {print "phone : "$3;} 6 | {print "<----------------";} 7 | 8 | -------------------------------------------------------------------------------- /experiments/week03-unix1/lab/phone: -------------------------------------------------------------------------------- 1 | # If no arguments are given: 2 | if [ $# -eq 0 ]; then 3 | echo "Usage: phone searchfor [...searchfor]" 4 | echo "(You didn't tell me what you want to search for.)" 5 | exit 0 6 | fi 7 | 8 | # Concatenate all arguments by delimiter '|' 9 | query=$1 10 | for arg in "${@:2}"; do 11 | query=$query\|$arg 12 | done 13 | 14 | # Print results 15 | eval 'egrep "($query)" data | awk -f display.awk' 16 | exit 0 17 | -------------------------------------------------------------------------------- /experiments/week03-unix1/paper/inc-sources/display.awk: -------------------------------------------------------------------------------- 1 | BEGIN{FS="|"} 2 | {print "---------------->";} 3 | {print "name : "$1;} 4 | {print "address : "$2;} 5 | {print "phone : "$3;} 6 | {print "<----------------";} 7 | 8 | -------------------------------------------------------------------------------- /experiments/week03-unix1/paper/inc-sources/phone: -------------------------------------------------------------------------------- 1 | # If no arguments are given: 2 | if [ $# -eq 0 ]; then 3 | echo "Usage: phone searchfor [...searchfor]" 4 | echo "(You didn't tell me what you want to search for.)" 5 | exit 0 6 | fi 7 | 8 | # Pipeline all commands 9 | command="egrep $1 data" 10 | for arg in "${@:2}"; do 11 | command="$command | egrep $arg" 12 | done 13 | 14 | # Print results 15 | eval "$command | awk -f display.awk" 16 | exit 0 17 | -------------------------------------------------------------------------------- /experiments/week03-unix1/paper/unix-1-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week03-unix1/paper/unix-1-post.pdf -------------------------------------------------------------------------------- /experiments/week03-unix1/paper/unix-1-post.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | 3 | \begin{document} 4 | 5 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline UNIX-1 결과 보고서} 6 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 7 | \institute{서강대학교 컴퓨터공학과} 8 | \maketitle 9 | 10 | \section{소스 코드} 11 | \textbf{phone} 12 | \inputminted[xleftmargin=\parindent,breaklines,linenos]{shell}{inc-sources/phone} 13 | 14 | \textbf{display.awk} 15 | \inputminted[xleftmargin=\parindent,breaklines,linenos]{awk}{inc-sources/display.awk} 16 | 17 | \section{and, or 동시 지원} 18 | 1번째 argument에 and 혹은 or를 명시하는 옵션을 달아 다음과 같은 명령어 구조를 사용할 수 있을 것이다. 19 | 20 | \begin{minted}[xleftmargin=\parindent,breaklines,linenos]{shell} 21 | ./phone [-and|-or] [queries...] 22 | \end{minted} 23 | 24 | 25 | 그러면 스크립트에서 1번째 인자에 따라 and-mode와 or-mode 중 하나를 선택해 실행할 수 있을 것이다. \texttt{if}-\texttt{elif}-\texttt{else}-\texttt{fi} 컨트롤 플로우를 사용하면 된다. 따라서 다음과 같은 코드 구조를 생각할 수 있다. 26 | 27 | \begin{minted}[xleftmargin=\parindent,breaklines,linenos]{shell} 28 | if [ $1='-and']; then 29 | # and-mode 30 | elif [ $1='-or' ]; then 31 | # or-mode 32 | else 33 | # error handling 34 | fi 35 | \end{minted} 36 | 37 | \end{document} 38 | -------------------------------------------------------------------------------- /experiments/week03-unix1/paper/unix-1-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week03-unix1/paper/unix-1-pre.pdf -------------------------------------------------------------------------------- /experiments/week04-unix2/README.md: -------------------------------------------------------------------------------- 1 | # 4주차: C / Make 2 | 3 | - [실습 코드](lab) 4 | - [과제 코드](homework) 5 | - [예비 보고서](paper/unix-2-pre.pdf) 6 | - [결과 보고서](paper/unix-2-post.pdf) 7 | 8 | ## 실습 9 | 10 | 문단을 입력받으면 이를 특정 너비로 잘 정렬시켜 주는 프로그램을 작성해 봅니다. 11 | 12 | ## 과제 13 | 14 | [프로그래밍 문제](https://www.acmicpc.net/problem/1019)를 해결해 봅니다. -------------------------------------------------------------------------------- /experiments/week04-unix2/homework/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /experiments/week04-unix2/homework/.idea/homework.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /experiments/week04-unix2/homework/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /experiments/week04-unix2/homework/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /experiments/week04-unix2/homework/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /experiments/week04-unix2/homework/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | CFLAGS = -g -O3 -w 3 | 4 | INCLUDES = 5 | OBJS = main.o solve.o io.o 6 | 7 | TARGET = main 8 | 9 | all: $(TARGET) 10 | 11 | $(TARGET): $(OBJS) 12 | $(CC) $(CFLAGS) $(INCLUDES) -o $(TARGET) $(OBJS) 13 | 14 | .c.o: 15 | $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ 16 | 17 | clean: 18 | rm $(OBJS) $(TARGET) 19 | 20 | -------------------------------------------------------------------------------- /experiments/week04-unix2/homework/header.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int readint(); 6 | void printarr(int *arr, int n); 7 | 8 | int pow10(int a); 9 | void calc(int prefix, int size, int *count); 10 | void solve(int n); -------------------------------------------------------------------------------- /experiments/week04-unix2/homework/io.c: -------------------------------------------------------------------------------- 1 | #include "header.h" 2 | 3 | int readint() { 4 | int x; 5 | scanf("%d", &x); 6 | return x; 7 | } 8 | 9 | void printarr(int *arr, int n) { 10 | for (int i = 0; i < n; i++) { 11 | printf("%d ", arr[i]); 12 | } 13 | printf("\n"); 14 | } -------------------------------------------------------------------------------- /experiments/week04-unix2/homework/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define MAXH 100 6 | #define MAXW 100 7 | 8 | enum { 9 | N, E, W, S 10 | }; 11 | 12 | char visit_flag[MAXH][MAXW]; 13 | char horizontal_route[MAXH][MAXW - 1]; 14 | char vertical_route[MAXH - 1][MAXW]; 15 | 16 | int adjacent(int possible_dirs[], int x, int y, int h, int w) { 17 | int possible_dir_count = 0; 18 | 19 | if (y > 0 && visit_flag[y - 1][x] == 0) possible_dirs[possible_dir_count++] = N; 20 | if (x < w - 1 && visit_flag[y][x + 1] == 0) possible_dirs[possible_dir_count++] = E; 21 | if (x > 0 && visit_flag[y][x - 1] == 0) possible_dirs[possible_dir_count++] = W; 22 | if (y < h - 1 && visit_flag[y + 1][x] == 0) possible_dirs[possible_dir_count++] = S; 23 | 24 | return possible_dir_count; 25 | } 26 | 27 | void dfs(int x, int y, int h, int w) { 28 | int possible_dirs[4]; 29 | int possible_dir_count = adjacent(possible_dirs, x, y, h, w); 30 | 31 | visit_flag[y][x] = 1; 32 | 33 | while (possible_dir_count) { 34 | int random_dir = rand() % possible_dir_count; 35 | 36 | switch (possible_dirs[random_dir]) { 37 | case N: 38 | vertical_route[y - 1][x] = 1; 39 | dfs(x, y - 1, h, w); 40 | break; 41 | case E: 42 | horizontal_route[y][x] = 1; 43 | dfs(x + 1, y, h, w); 44 | break; 45 | case S: 46 | vertical_route[y][x] = 1; 47 | dfs(x, y + 1, h, w); 48 | break; 49 | case W: 50 | horizontal_route[y][x - 1] = 1; 51 | dfs(x - 1, y, h, w); 52 | break; 53 | } 54 | 55 | possible_dir_count = adjacent(possible_dirs, x, y, h, w); 56 | } 57 | } 58 | 59 | void printMaze(int h, int w) { 60 | for (int x = 0; x < w; x++) { 61 | putchar('+'); 62 | putchar('-'); 63 | } 64 | putchar('+'); 65 | putchar('\n'); 66 | for (int y = 0; y < h; y++) { 67 | putchar('|'); 68 | for (int x = 0; x < w; x++) { 69 | putchar(' '); 70 | putchar(x < w - 1 && horizontal_route[y][x] ? ' ' : '|'); 71 | } 72 | putchar('\n'); 73 | putchar('+'); 74 | for (int x = 0; x < w; x++) { 75 | putchar(y < h - 1 && vertical_route[y][x] ? ' ' : '-'); 76 | putchar('+'); 77 | } 78 | putchar('\n'); 79 | } 80 | } 81 | 82 | int main() { 83 | srand(time(NULL)); 84 | 85 | int h, w; 86 | scanf("%d%d", &h, &w); 87 | 88 | dfs(0, 0, h, w); 89 | printMaze(h, w); 90 | 91 | return 0; 92 | } -------------------------------------------------------------------------------- /experiments/week04-unix2/homework/solve.c: -------------------------------------------------------------------------------- 1 | #include "header.h" 2 | 3 | int pow10(int a) { 4 | int p = 1; 5 | while (a--) { 6 | p *= 10; 7 | } 8 | return p; 9 | } 10 | 11 | void calc(int prefix, int size, int *count) { 12 | if (prefix == 0) { 13 | if (size == 0) 14 | return; 15 | for (int i = 0; i < 10; i++) 16 | count[i] += size * pow10(size - 1); 17 | for (int i = 1; i < size; i++) { 18 | count[0] -= 9 * pow10(size - 1 - i) * i; 19 | } 20 | count[0] -= size; 21 | } else { 22 | while (prefix) { 23 | count[prefix % 10] += pow10(size); 24 | prefix /= 10; 25 | } 26 | if (size == 0) 27 | return; 28 | for (int i = 0; i < 10; i++) 29 | count[i] += size * pow10(size - 1); 30 | } 31 | } 32 | 33 | void solve(int n) { 34 | int *count = (int*) calloc(10, sizeof(int)); 35 | 36 | n++; 37 | int sum = 0; 38 | while (sum < n) { 39 | for (int i = 0;; i++) { 40 | if (sum + pow10(i) <= n) continue; 41 | calc(sum / pow10(i - 1), i - 1, count); 42 | sum += pow10(i - 1); 43 | break; 44 | } 45 | } 46 | 47 | printarr(count, 10); 48 | free(count); 49 | } -------------------------------------------------------------------------------- /experiments/week04-unix2/lab/Header.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define BNUM 256 6 | #define LIMIT 36 7 | 8 | void Remove_Blanks_At_The_End(char *line); 9 | void Print_Line(char *line, int *Count, int *B_Flag); 10 | void Get_Blanks_Chars(char *line, int Start, int *N_Blanks, int *N_Chars); 11 | -------------------------------------------------------------------------------- /experiments/week04-unix2/lab/Output.cpp: -------------------------------------------------------------------------------- 1 | #include "Header.h" 2 | 3 | void Print_Line(char *line, int *Count, int *B_Flag) { 4 | // [-] int i, N_Blanks, N_Chars, Start; 5 | // [+] Initialized uninitialized variable 6 | int i, N_Blanks, N_Chars, Start = 0; 7 | 8 | Get_Blanks_Chars(line, Start, &N_Blanks, &N_Chars); 9 | while (N_Chars != 0) { 10 | if ((*B_Flag == 1) && ((*Count + N_Chars + 1) <= LIMIT)) { 11 | /* In this part, N_Blanks == 0 in order that L1 and L2 should be 12 | * merged. "N_Blanks != 0" means that L2 is written at the next 13 | * line. 14 | */ 15 | if (N_Blanks != 0) { 16 | printf("Something Wrong!\n"); 17 | exit(-1); 18 | } 19 | putchar(' '); 20 | *B_Flag = 0; 21 | 22 | // [-] for (i = Start; i < Start + N_Chars - 1; i++) 23 | // [+] Termination condition fixed 24 | for (i = Start; i < Start + N_Chars; i++) { 25 | putchar(line[i]); 26 | } 27 | 28 | Start = Start + N_Chars; 29 | *Count = *Count + N_Chars + 1; 30 | Get_Blanks_Chars(line, Start, &N_Blanks, &N_Chars); 31 | } else if ((*Count + N_Blanks + N_Chars) <= LIMIT) { 32 | // [-] for (i = Start; i < Start + N_Blanks + N_Chars - 1; i++) 33 | // [+] Termination condition fixed 34 | for (i = Start; i < Start + N_Blanks + N_Chars; i++) { 35 | putchar(line[i]); 36 | } 37 | 38 | Start = Start + N_Blanks + N_Chars; 39 | *Count = *Count + N_Blanks + N_Chars; 40 | Get_Blanks_Chars(line, Start, &N_Blanks, &N_Chars); 41 | } else { 42 | if (*Count == 0) { 43 | // [-] for (i = Start; i < Start + N_Blanks + N_Chars - 1; i++) 44 | // [+] Termination condition fixed 45 | for (i = Start; i < Start + N_Blanks + N_Chars; i++) { 46 | putchar(line[i]); 47 | } 48 | 49 | Start = Start + N_Blanks + N_Chars; 50 | putchar('\n'); 51 | Get_Blanks_Chars(line, Start, &N_Blanks, &N_Chars); 52 | // [+] Logic fixed 53 | Start = Start + N_Blanks; 54 | } else { 55 | putchar('\n'); 56 | *B_Flag = 0; 57 | // [-] for (i = Start + N_Blanks; i < Start + N_Blanks + N_Chars - 1; i++) 58 | // [+] Logic fixed 59 | for (i = Start + N_Blanks; i < Start + N_Blanks + N_Chars; i++) { 60 | putchar(line[i]); 61 | } 62 | 63 | Start = Start + N_Blanks + N_Chars; 64 | *Count = N_Chars; 65 | Get_Blanks_Chars(line, Start, &N_Blanks, &N_Chars); 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /experiments/week04-unix2/lab/String_Manipulation.cpp: -------------------------------------------------------------------------------- 1 | #include "Header.h" 2 | 3 | void Remove_Blanks_At_The_End(char *line) { 4 | int i, k, newline_flag = 0; 5 | 6 | for (k = 0;; k++) { 7 | if (line[k] == '\n') { 8 | newline_flag = 1; 9 | break; 10 | } else if (line[k] == '\0') { 11 | break; 12 | } 13 | } 14 | 15 | // [-] for (i = k; i >= 0; i--) 16 | // [+] Starting index fixed 17 | for (i = k - 1; i >= 0; i--) { 18 | if (line[i] != ' ') { 19 | break; 20 | } 21 | } 22 | 23 | if (newline_flag == 1) { 24 | // [-] line[i] = '\n'; 25 | // [-] line[i + 1] = '\0'; 26 | // [+] Algorithm fixed 27 | line[i + 1] = '\n'; 28 | line[i + 2] = '\0'; 29 | } else { 30 | // [-] line[i] = '\0'; 31 | // [+] Algorithm fixed 32 | line[i + 1] = '\0'; 33 | } 34 | } 35 | 36 | void Get_Blanks_Chars(char *line, int Start, int *N_Blanks, int *N_Chars) { 37 | // [-] int i, blank_flag; 38 | // [+] Initialized uninitialized variable; 39 | int i, blank_flag = 0; 40 | 41 | // [+] Initialization 42 | *N_Blanks = 0, *N_Chars = 0; 43 | 44 | for (i = Start;; i++) { 45 | if ((line[i] == '\n') || (line[i] == '\0')) { 46 | break; 47 | } else if (line[i] == ' ') { 48 | if (blank_flag == 0) { 49 | ++(*N_Blanks); 50 | } else { 51 | break; 52 | } 53 | } else { 54 | blank_flag = 1; 55 | ++(*N_Chars); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /experiments/week04-unix2/lab/build.sh: -------------------------------------------------------------------------------- 1 | echo "===================================" 2 | echo "$ make clean" 3 | echo "===================================" 4 | make clean 5 | 6 | echo "===================================" 7 | echo "$ make" 8 | echo "===================================" 9 | make 10 | 11 | echo "===================================" 12 | echo "$ ./main text.txt" 13 | echo "===================================" 14 | ./main test.txt 15 | 16 | echo "===================================" 17 | echo "$ ./main text.txt > result.txt" 18 | echo "===================================" 19 | ./main test.txt > result.txt 20 | 21 | echo "===================================" 22 | echo "$ cat result.txt" 23 | echo "===================================" 24 | cat result.txt 25 | 26 | echo "===================================" 27 | echo " End of script" 28 | echo "===================================" 29 | -------------------------------------------------------------------------------- /experiments/week04-unix2/lab/main.cpp: -------------------------------------------------------------------------------- 1 | #include "Header.h" 2 | 3 | int main(int argc, char *argv[]) { 4 | FILE *fp; 5 | char *line1, *line2, *tmpline; 6 | // [-] int Count, Blanks = 0; 7 | // [+] Initialized uninitialized variable 8 | int Count = 0, Blanks = 0; 9 | int i, B_Flag = 0, B_Line = 0; 10 | 11 | if (argc != 2) { 12 | // [-] printf("Usuage: fmt filename | > outfile\n"); 13 | // [+] Fix typo 14 | printf("Usage: fmt filename | > outfile\n"); 15 | } 16 | fp = fopen(argv[1], "r"); 17 | if (fp == NULL) { 18 | printf("File open error.\n"); 19 | return 0; 20 | } 21 | line1 = (char *)malloc(BNUM * sizeof(char)); 22 | line2 = (char *)malloc(BNUM * sizeof(char)); 23 | if (line1 == NULL || line2 == NULL) { 24 | printf("Memory allocation error\n"); 25 | exit(-1); 26 | } 27 | 28 | if (fgets(line1, BNUM, fp) == NULL) { 29 | // empty file, just return 30 | return 0; 31 | } 32 | Remove_Blanks_At_The_End(line1); 33 | if (line1[0] == '\n') { 34 | putchar('\n'); 35 | } 36 | Count = 0; 37 | while (1) { 38 | if (B_Line == 0) { 39 | Print_Line(line1, &Count, &B_Flag); 40 | } else { 41 | B_Line = 0; 42 | } 43 | if (Count != 0) { 44 | B_Flag = 1; 45 | } 46 | if (fgets(line2, BNUM, fp) == NULL) { 47 | break; // EOF. Exit the while loop 48 | } 49 | Remove_Blanks_At_The_End(line2); 50 | if (line2[0] == ' ' && Count != 0) { 51 | putchar('\n'); 52 | B_Flag = 0; 53 | Count = 0; 54 | } else if (line2[0] == '\n') { 55 | if (B_Flag == 1) { 56 | putchar('\n'); 57 | B_Flag = 0; 58 | } 59 | putchar('\n'); 60 | B_Line = 1; 61 | Count = 0; 62 | } 63 | tmpline = line1; 64 | line1 = line2; 65 | line2 = tmpline; 66 | } 67 | if (line1[0] != '\n') { 68 | // if the last line is not empty line, 69 | // check if the last char is '\n' and ouput it if it is. 70 | for (i = 0;; i++) { 71 | if ((line1[i] == '\n') || (line1[i] == '\0')) { 72 | break; 73 | } 74 | } 75 | if (line1[i] == '\n') { 76 | putchar('\n'); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /experiments/week04-unix2/paper/unix-2-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week04-unix2/paper/unix-2-post.pdf -------------------------------------------------------------------------------- /experiments/week04-unix2/paper/unix-2-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week04-unix2/paper/unix-2-pre.pdf -------------------------------------------------------------------------------- /experiments/week05-cpp1/README.md: -------------------------------------------------------------------------------- 1 | # 5주차: C++ - OOP 2 | 3 | - [실습 코드](lab) 4 | - [과제 코드](homework) 5 | - [예비 보고서](paper/cpp-1-pre.pdf) 6 | - [결과 보고서](paper/cpp-1-post.pdf) 7 | 8 | ## 실습 9 | 10 | 인덱스 범위를 설정할 수 있는 배열 클래스 RangeArray를 구현해 봅니다. 11 | 12 | ## 과제 13 | 14 | 문자열 클래스 Str를 구현해 봅니다. -------------------------------------------------------------------------------- /experiments/week05-cpp1/homework/Makefile: -------------------------------------------------------------------------------- 1 | OBJECTS = main.o Str.o 2 | SRC = main.cpp Str.cpp 3 | 4 | CC = g++ 5 | CPPFLAGS = -g -c 6 | 7 | TARGET = main 8 | 9 | $(TARGET): $(OBJECTS) Str.h 10 | $(CC) -o $(TARGET) $(OBJECTS) 11 | 12 | clean: 13 | rm $(OBJECTS) $(TARGET) 14 | 15 | -------------------------------------------------------------------------------- /experiments/week05-cpp1/homework/Str.cpp: -------------------------------------------------------------------------------- 1 | #include "Str.h" 2 | #include 3 | #include 4 | 5 | Str::Str(int length) { 6 | len = length; 7 | str = new char[len + 1]; 8 | str[0] = '\0'; 9 | } 10 | 11 | Str::Str(char* contents) { 12 | len = strlen(contents); 13 | 14 | str = new char[len + 1]; 15 | strcpy(str, contents); 16 | str[len] = '\0'; 17 | } 18 | 19 | Str::~Str() { 20 | delete []str; 21 | } 22 | 23 | int Str::length() { 24 | return len; 25 | } 26 | 27 | char *Str::contents() { 28 | return str; 29 | } 30 | 31 | int Str::compare(char *a) { 32 | return strcmp(str, a); 33 | } 34 | 35 | int Str::compare(Str &a) { 36 | return (*this).compare(a); 37 | } 38 | 39 | void Str::operator=(char *a) { 40 | if (a == 0) { // nullptr = 0 41 | len = 0; 42 | delete []str; 43 | str = new char[1]; 44 | str[0] = '\0'; 45 | return; 46 | } 47 | 48 | int a_len = strlen(a); 49 | 50 | if (len < a_len) { 51 | delete []str; 52 | str = new char[a_len + 1]; 53 | } 54 | 55 | len = a_len; 56 | 57 | strcpy(str, a); 58 | str[len] = '\0'; 59 | } 60 | 61 | void Str::operator=(Str &a) { 62 | (*this) = a.contents(); 63 | } -------------------------------------------------------------------------------- /experiments/week05-cpp1/homework/Str.h: -------------------------------------------------------------------------------- 1 | class Str { 2 | private: 3 | char *str; 4 | int len; 5 | 6 | public: 7 | Str(int leng); 8 | Str(char *neyong); 9 | ~Str(); 10 | int length(void); 11 | char *contents(void); 12 | int compare(class Str &a); 13 | int compare(char *a); 14 | void operator=(char *a); 15 | void operator=(class Str &a); 16 | }; -------------------------------------------------------------------------------- /experiments/week05-cpp1/homework/Str.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week05-cpp1/homework/Str.o -------------------------------------------------------------------------------- /experiments/week05-cpp1/homework/main: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week05-cpp1/homework/main -------------------------------------------------------------------------------- /experiments/week05-cpp1/homework/main.cpp: -------------------------------------------------------------------------------- 1 | #include "Str.h" 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | Str a("I'm a girl"); 8 | cout << a.contents(); 9 | a = "I'm a boy\n"; 10 | cout << a.contents(); 11 | cout << a.compare("I'm a a") << endl; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /experiments/week05-cpp1/homework/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week05-cpp1/homework/main.o -------------------------------------------------------------------------------- /experiments/week05-cpp1/lab/Array.cpp: -------------------------------------------------------------------------------- 1 | #include "Array.h" 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | Array::Array(int size) { 8 | if (size < 0) { 9 | cout << "Array bound error!" << endl; 10 | } else { 11 | data = new int[size]; 12 | len = size; 13 | } 14 | } 15 | 16 | Array::~Array() { 17 | delete[] data; 18 | } 19 | 20 | int Array::length() const { 21 | return len; 22 | } 23 | 24 | int &Array::operator[](int i) { 25 | static int undefined_var; 26 | 27 | if (0 <= i && i < len) { 28 | return data[i]; 29 | } else { 30 | cout << "Array bound error!" << endl; 31 | return undefined_var; 32 | } 33 | } 34 | 35 | int Array::operator[](int i) const { 36 | static int undefined_var; 37 | 38 | if (0 <= i && i < len) { 39 | return data[i]; 40 | } else { 41 | cout << "Array bound error!" << endl; 42 | return undefined_var; 43 | } 44 | } 45 | 46 | void Array::print() { 47 | int i; 48 | cout << "[ "; 49 | for (i = 0; i < len; i++) cout << data[i] << ' '; 50 | cout << "]"; 51 | cout << endl; 52 | } 53 | -------------------------------------------------------------------------------- /experiments/week05-cpp1/lab/Array.h: -------------------------------------------------------------------------------- 1 | #ifndef __ARRAY__ 2 | #define __ARRAY__ 3 | 4 | class Array { 5 | protected: 6 | int *data; 7 | int len; 8 | 9 | public: 10 | Array(int size); 11 | ~Array(); 12 | 13 | int length() const; 14 | 15 | int &operator[](int i); 16 | int operator[](int i) const; 17 | 18 | void print(); 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /experiments/week05-cpp1/lab/Makefile: -------------------------------------------------------------------------------- 1 | OBJECTS = main.o Array.o RangeArray.o 2 | SRC = main.cpp Array.cpp RangeArray.cpp 3 | 4 | CC = g++ 5 | CPPFLAGS = -g -c 6 | 7 | TARGET = main 8 | 9 | $(TARGET): $(OBJECTS) Array.h RangeArray.h 10 | $(CC) -o $(TARGET) $(OBJECTS) 11 | 12 | clean: 13 | rm $(OBJECTS) $(TARGET) 14 | 15 | -------------------------------------------------------------------------------- /experiments/week05-cpp1/lab/RangeArray.cpp: -------------------------------------------------------------------------------- 1 | #include "RangeArray.h" 2 | #include 3 | 4 | using namespace std; 5 | 6 | RangeArray::RangeArray(int i, int j) : Array(j - i + 1) { 7 | low = i; 8 | high = j; 9 | } 10 | 11 | RangeArray::~RangeArray() {} 12 | 13 | int RangeArray::baseValue() { 14 | return low; 15 | } 16 | 17 | int RangeArray::endValue() { 18 | return high; 19 | } 20 | 21 | int &RangeArray::operator[](int i) { 22 | return Array::operator[](i - low); 23 | } 24 | 25 | int RangeArray::operator[](int i) const { 26 | return Array::operator[](i - low); 27 | } 28 | -------------------------------------------------------------------------------- /experiments/week05-cpp1/lab/RangeArray.h: -------------------------------------------------------------------------------- 1 | #include "Array.h" 2 | 3 | class RangeArray : public Array { 4 | protected: 5 | int low; 6 | int high; 7 | 8 | public: 9 | RangeArray(int, int); 10 | ~RangeArray(); 11 | 12 | int baseValue(); 13 | int endValue(); 14 | 15 | int &operator[](int); 16 | int operator[](int) const; 17 | }; 18 | -------------------------------------------------------------------------------- /experiments/week05-cpp1/lab/main.cpp: -------------------------------------------------------------------------------- 1 | #include "Array.h" 2 | #include "RangeArray.h" 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main(void) { 8 | int i, x, y; 9 | 10 | Array a(10), b(5); 11 | for (i = 0; i < a.length(); i++) a[i] = i + 1; 12 | for (i = 0; i < b.length(); i++) b[i] = i * 2; 13 | 14 | cout << "a(10) "; 15 | a.print(); 16 | 17 | cout << "b(5) "; 18 | b.print(); 19 | 20 | cout << "a[-1] "; 21 | a[-1] = 7; 22 | 23 | x = a[0]; 24 | y = b[0]; 25 | 26 | cout << "a[0] =" << x << endl << "b[0] =" << y << endl; 27 | 28 | RangeArray c(-1, 3), d(3, 7); 29 | 30 | for (i = c.baseValue(); i <= c.endValue(); i++) c[i] = i * 3; 31 | for (i = d.baseValue(); i <= d.endValue(); i++) d[i] = i * 4; 32 | 33 | cout << "c(-1,3) "; 34 | c.print(); 35 | 36 | cout << "d(3,7) "; 37 | d.print(); 38 | 39 | cout << "c[-2] "; 40 | c[-2] = 3; 41 | 42 | x = c[-1]; 43 | y = d[3]; 44 | 45 | cout << "c[-1] = " << x << " d[3] = " << y << endl; 46 | } 47 | -------------------------------------------------------------------------------- /experiments/week05-cpp1/paper/cpp-1-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week05-cpp1/paper/cpp-1-post.pdf -------------------------------------------------------------------------------- /experiments/week05-cpp1/paper/cpp-1-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week05-cpp1/paper/cpp-1-pre.pdf -------------------------------------------------------------------------------- /experiments/week06-cpp2/README.md: -------------------------------------------------------------------------------- 1 | # 6주차: C++ - 다형성 2 | 3 | - [실습 코드](lab) 4 | - [과제 코드](homework) 5 | - [예비 보고서](paper/cpp-2-pre.pdf) 6 | - [결과 보고서](paper/cpp-2-post.pdf) 7 | 8 | ## 실습 9 | 10 | LinkedList와 Stack 클래스를 구현해 봅니다. 11 | 12 | ## 과제 13 | 14 | 동적 배열 클래스 GrowableArray를 구현해 봅니다. -------------------------------------------------------------------------------- /experiments/week06-cpp2/homework/Makefile: -------------------------------------------------------------------------------- 1 | OBJECTS = main.o 2 | SRC = main.cpp 3 | 4 | CC = g++ 5 | CPPFLAGS = -g -c 6 | 7 | TARGET = main 8 | 9 | $(TARGET): $(OBJECTS) array.h growablearray.h 10 | $(CC) -o $(TARGET) $(OBJECTS) 11 | 12 | clean: 13 | rm $(OBJECTS) $(TARGET) 14 | 15 | -------------------------------------------------------------------------------- /experiments/week06-cpp2/homework/array.h: -------------------------------------------------------------------------------- 1 | #ifndef __ARRAY__ 2 | #define __ARRAY__ 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | template class Array { 8 | protected: 9 | T *data; 10 | int len; 11 | 12 | public: 13 | Array(){}; 14 | Array(int size); 15 | ~Array(); 16 | 17 | int length() const; 18 | 19 | virtual T &operator[](int i); 20 | virtual T operator[](int i) const; 21 | 22 | void print(); 23 | }; 24 | 25 | template Array::Array(int size) { 26 | if (size < 0) { 27 | cerr << "Size cannot be less than 0." << endl; 28 | exit(-1); 29 | } 30 | 31 | data = new T[size]; 32 | 33 | if (data == NULL) { 34 | cerr << "Memory allocation failed" << endl; 35 | exit(-1); 36 | } 37 | 38 | len = size; 39 | } 40 | 41 | template Array::~Array() { delete[] data; } 42 | 43 | template int Array::length() const { return len; } 44 | 45 | template T &Array::operator[](int i) { 46 | static T __undefined__; 47 | if (0 <= i && i < len) { 48 | return data[i]; 49 | } else { 50 | cerr << "Array index out of bounds" << endl; 51 | return __undefined__; 52 | } 53 | } 54 | 55 | template T Array::operator[](int i) const { 56 | if (0 <= i && i < len) { 57 | return data[i]; 58 | } else { 59 | cerr << "Array index out of bounds" << endl; 60 | return 0; 61 | } 62 | } 63 | 64 | template void Array::print() { 65 | cout << '['; 66 | for (int i = 0; i < len; i++) { 67 | cout << ' ' << data[i]; 68 | } 69 | cout << " ]\n"; 70 | } 71 | 72 | #endif -------------------------------------------------------------------------------- /experiments/week06-cpp2/homework/growablearray.h: -------------------------------------------------------------------------------- 1 | #ifndef __GROWABLE_ARRAY_H__ 2 | #define __GROWABLE_ARRAY_H__ 3 | #include "array.h" 4 | using namespace std; 5 | 6 | template class GrowableArray : public Array { 7 | public: 8 | GrowableArray(int size); 9 | virtual T &operator[](int i); 10 | }; 11 | 12 | template GrowableArray::GrowableArray(int size) { 13 | if (size < 0) { 14 | cerr << "Size cannot be less than 0." << endl; 15 | exit(-1); 16 | } 17 | 18 | Array::data = new T[size]; 19 | 20 | if (Array::data == NULL) { 21 | cerr << "Memory allocation failed" << endl; 22 | exit(-1); 23 | } 24 | 25 | Array::len = size; 26 | } 27 | 28 | template T &GrowableArray::operator[](int i) { 29 | if (0 <= i && i < Array::len) { 30 | return Array::data[i]; 31 | } 32 | 33 | int new_length = i << 1; 34 | 35 | T *new_data = new T[new_length]; 36 | if (new_data == NULL) { 37 | cerr << "Memory allocation failed" << endl; 38 | exit(-1); 39 | } 40 | 41 | for (int i = 0; i < Array::len; i++) 42 | new_data[i] = Array::data[i]; 43 | for (int i = Array::len; i < new_length; i++) 44 | new_data[i] = 0; 45 | 46 | T *temp = Array::data; 47 | Array::data = new_data; 48 | Array::len = new_length; 49 | delete[] temp; 50 | 51 | return Array::data[i]; 52 | } 53 | 54 | #endif -------------------------------------------------------------------------------- /experiments/week06-cpp2/homework/main: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week06-cpp2/homework/main -------------------------------------------------------------------------------- /experiments/week06-cpp2/homework/main.cpp: -------------------------------------------------------------------------------- 1 | #include "array.h" 2 | #include "growablearray.h" 3 | #include 4 | using namespace std; 5 | 6 | int main() { 7 | int i; 8 | 9 | // GrowableArray test (int) 10 | cout << "GrowableArray Test" << endl; 11 | GrowableArray g(10); 12 | for (i = 0; i < g.length(); i++) 13 | g[i] = 2 * i + 3; 14 | cout << "g(10)"; 15 | g.print(); 16 | g[13] = 13; 17 | cout << "g(26)"; 18 | g.print(); 19 | 20 | // GrowableArray test (double) 21 | cout << "\nGrowableArray Test" << endl; 22 | GrowableArray dg(10); 23 | for (i = 0; i < dg.length(); i++) 24 | dg[i] = 2 * i + 3.14; 25 | cout << "dg(10)"; 26 | dg.print(); 27 | dg[13] = 13.31; 28 | cout << "dg(26)"; 29 | dg.print(); 30 | 31 | return 0; 32 | } -------------------------------------------------------------------------------- /experiments/week06-cpp2/homework/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week06-cpp2/homework/main.o -------------------------------------------------------------------------------- /experiments/week06-cpp2/lab/LinkedList.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINKEDLIST__ 2 | #define __LINKEDLIST__ 3 | 4 | #include 5 | 6 | using namespace std; 7 | 8 | /* 9 | ========== 10 | class Node 11 | ========== 12 | */ 13 | template class Node { 14 | public: 15 | T data; 16 | Node *link; 17 | Node(T element) { 18 | data = element; 19 | link = 0; 20 | } 21 | }; 22 | 23 | /* 24 | ================ 25 | class LinkedList 26 | ================ 27 | */ 28 | template class LinkedList { 29 | protected: 30 | Node *first; 31 | int current_size; 32 | 33 | public: 34 | LinkedList() { 35 | first = 0; 36 | current_size = 0; 37 | }; 38 | int GetSize() { return current_size; }; 39 | void Insert(T element); 40 | virtual bool Delete(T &element); 41 | void Print(); 42 | }; 43 | 44 | template void LinkedList::Insert(T element) { 45 | Node *newnode = new Node(element); 46 | newnode->link = first; 47 | first = newnode; 48 | current_size++; 49 | } 50 | 51 | // Deletes *last* element 52 | template bool LinkedList::Delete(T &element) { 53 | if (first == 0) return false; 54 | 55 | Node *current = first; 56 | Node *previous = 0; 57 | 58 | while (1) { 59 | if (current->link == 0) { 60 | if (previous) 61 | previous->link = current->link; 62 | else 63 | first = first->link; 64 | break; 65 | } 66 | previous = current; 67 | current = current->link; 68 | } 69 | 70 | element = current->data; 71 | delete current; 72 | 73 | current_size--; 74 | 75 | return true; 76 | } 77 | 78 | template void LinkedList::Print() { 79 | if (first == 0) return; 80 | 81 | Node *curr = first; 82 | int i = 0; 83 | while (i < current_size) { 84 | if (i) cout << "->"; 85 | i++; 86 | 87 | cout << "[" << i << "|" << curr->data << "]"; 88 | curr = curr->link; 89 | } 90 | cout << endl; 91 | } 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /experiments/week06-cpp2/lab/Makefile: -------------------------------------------------------------------------------- 1 | OBJECTS = main.o 2 | SRC = main.cpp 3 | 4 | CC = g++ 5 | CPPFLAGS = -g -c 6 | 7 | TARGET = main 8 | 9 | $(TARGET): $(OBJECTS) LinkedList.h Stack.h 10 | $(CC) -o $(TARGET) $(OBJECTS) 11 | 12 | clean: 13 | rm $(OBJECTS) $(TARGET) 14 | 15 | -------------------------------------------------------------------------------- /experiments/week06-cpp2/lab/Stack.h: -------------------------------------------------------------------------------- 1 | #ifndef __STACK__ 2 | #define __STACK__ 3 | 4 | #include "LinkedList.h" 5 | #include 6 | 7 | using namespace std; 8 | 9 | /* 10 | =========== 11 | class Stack 12 | =========== 13 | */ 14 | template class Stack : public LinkedList { 15 | public: 16 | bool Delete(T &element); 17 | }; 18 | 19 | // Deletes *first* element 20 | template bool Stack::Delete(T &element) { 21 | // If current size is 0, deletion fails 22 | if (LinkedList::current_size == 0) return false; 23 | 24 | Node* temp = LinkedList::first; 25 | LinkedList::first = LinkedList::first->link; 26 | element = temp->data; 27 | delete temp; 28 | LinkedList::current_size--; 29 | 30 | return true; 31 | } 32 | 33 | #endif -------------------------------------------------------------------------------- /experiments/week06-cpp2/paper/cpp-2-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week06-cpp2/paper/cpp-2-post.pdf -------------------------------------------------------------------------------- /experiments/week06-cpp2/paper/cpp-2-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week06-cpp2/paper/cpp-2-pre.pdf -------------------------------------------------------------------------------- /experiments/week08-win3/README.md: -------------------------------------------------------------------------------- 1 | # 8주차: MFC 2 | 3 | - [실습 코드](lab) 4 | - [과제 코드](homework) 5 | - [예비 보고서](paper/win-3-pre.pdf) 6 | - [결과 보고서](paper/win-3-post.pdf) 7 | 8 | ## 실습 9 | 10 | MFC를 이용해 물이 떨어지는 경로를 그리는 프로그램을 만들어 봅니다. 11 | 12 | ## 과제 13 | 14 | MFC를 이용해 어떤 그래프가 트리인지 아닌지를 체크하는 프로그램을 만들어 봅니다. -------------------------------------------------------------------------------- /experiments/week08-win3/homework/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/ReadMe.txt -------------------------------------------------------------------------------- /experiments/week08-win3/homework/Solver.h: -------------------------------------------------------------------------------- 1 | #ifndef _SOLVER_ 2 | #define _SOLVER_ 3 | 4 | extern void Read_File(const char* filename); 5 | extern char* Check_Tree(int tc); 6 | extern void Init(); 7 | extern void Error_Exit(char* s); 8 | 9 | extern int currCase; 10 | extern int cases; 11 | 12 | #endif -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheck.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/TreeCheck.aps -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheck.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/TreeCheck.cpp -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheck.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/TreeCheck.h -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheck.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/TreeCheck.rc -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheck.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TreeCheck", "TreeCheck.vcxproj", "{E20A7462-4BE2-4C67-B111-EE9844B1C27C}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {E20A7462-4BE2-4C67-B111-EE9844B1C27C}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {E20A7462-4BE2-4C67-B111-EE9844B1C27C}.Debug|Win32.Build.0 = Debug|Win32 14 | {E20A7462-4BE2-4C67-B111-EE9844B1C27C}.Release|Win32.ActiveCfg = Release|Win32 15 | {E20A7462-4BE2-4C67-B111-EE9844B1C27C}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheck.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/TreeCheck.suo -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheck.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/TreeCheck.v11.suo -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheck.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | Resource Files 21 | 22 | 23 | Resource Files 24 | 25 | 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | 61 | 62 | Resource Files 63 | 64 | 65 | -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheck.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheckDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/TreeCheckDlg.cpp -------------------------------------------------------------------------------- /experiments/week08-win3/homework/TreeCheckDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/TreeCheckDlg.h -------------------------------------------------------------------------------- /experiments/week08-win3/homework/data1.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 4 3 | 1 2 2 3 3 1 4 5 4 | 5 5 | 8 3 4 6 5 8 4 2 5 4 6 | 7 7 | 7 1 7 5 1 6 5 9 7 4 8 | 7 2 7 3 9 | 6 10 | 8 6 6 5 6 2 6 3 8 4 11 | 2 4 12 | -------------------------------------------------------------------------------- /experiments/week08-win3/homework/res/TreeCheck.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/res/TreeCheck.ico -------------------------------------------------------------------------------- /experiments/week08-win3/homework/res/TreeCheck.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/res/TreeCheck.rc2 -------------------------------------------------------------------------------- /experiments/week08-win3/homework/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/resource.h -------------------------------------------------------------------------------- /experiments/week08-win3/homework/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/stdafx.cpp -------------------------------------------------------------------------------- /experiments/week08-win3/homework/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/stdafx.h -------------------------------------------------------------------------------- /experiments/week08-win3/homework/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/homework/targetver.h -------------------------------------------------------------------------------- /experiments/week08-win3/lab/Input.txt: -------------------------------------------------------------------------------- 1 | 6 2 | 14 7 3 4 3 | 11 13 16 11 4 | 1 10 6 7 5 | 2 1 4 3 6 | 16 17 22 13 7 | 12 5 23 3 8 | 4 9 | 10 4 10 | 14 14 11 | 2 13 12 | 19 8 -------------------------------------------------------------------------------- /experiments/week08-win3/lab/MainFrm.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/MainFrm.cpp -------------------------------------------------------------------------------- /experiments/week08-win3/lab/MainFrm.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/MainFrm.h -------------------------------------------------------------------------------- /experiments/week08-win3/lab/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/ReadMe.txt -------------------------------------------------------------------------------- /experiments/week08-win3/lab/UserImages.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/UserImages.bmp -------------------------------------------------------------------------------- /experiments/week08-win3/lab/Waterfall.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/Waterfall.aps -------------------------------------------------------------------------------- /experiments/week08-win3/lab/Waterfall.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/Waterfall.cpp -------------------------------------------------------------------------------- /experiments/week08-win3/lab/Waterfall.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/Waterfall.h -------------------------------------------------------------------------------- /experiments/week08-win3/lab/Waterfall.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/Waterfall.rc -------------------------------------------------------------------------------- /experiments/week08-win3/lab/Waterfall.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Waterfall", "Waterfall.vcxproj", "{48939999-7A5B-4A76-BF1A-9E6C17B670AF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {48939999-7A5B-4A76-BF1A-9E6C17B670AF}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {48939999-7A5B-4A76-BF1A-9E6C17B670AF}.Debug|Win32.Build.0 = Debug|Win32 14 | {48939999-7A5B-4A76-BF1A-9E6C17B670AF}.Release|Win32.ActiveCfg = Release|Win32 15 | {48939999-7A5B-4A76-BF1A-9E6C17B670AF}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /experiments/week08-win3/lab/Waterfall.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/Waterfall.suo -------------------------------------------------------------------------------- /experiments/week08-win3/lab/Waterfall.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/Waterfall.v11.suo -------------------------------------------------------------------------------- /experiments/week08-win3/lab/Waterfall.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /experiments/week08-win3/lab/WaterfallDoc.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/WaterfallDoc.cpp -------------------------------------------------------------------------------- /experiments/week08-win3/lab/WaterfallDoc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/WaterfallDoc.h -------------------------------------------------------------------------------- /experiments/week08-win3/lab/WaterfallView.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/WaterfallView.cpp -------------------------------------------------------------------------------- /experiments/week08-win3/lab/WaterfallView.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/WaterfallView.h -------------------------------------------------------------------------------- /experiments/week08-win3/lab/define.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEFINE_H__ 2 | #define __DEFINE_H__ 3 | 4 | #define MAX 1024 5 | 6 | #define gXmin 100 7 | #define gYmin 100 8 | #define gXmax 600 9 | #define gYmax 500 10 | #define wWeight gXmax + gXmin 11 | #define wHeight gYmax + gYmin + gYmin/2 12 | 13 | #define lineSize 20 14 | #define cirsize 2 15 | 16 | typedef struct Line__{ 17 | int xl, yl, xr, yr; 18 | } Line; 19 | 20 | typedef struct Point__ { 21 | float x, y; 22 | } Point; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /experiments/week08-win3/lab/mylist.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "mylist.h" 3 | #include 4 | #include 5 | 6 | mylist::mylist(){ 7 | num = 0; 8 | head = prev_node = curr_node = NULL; 9 | } 10 | 11 | mylist::~mylist(){ 12 | move_first(); 13 | while(isEmpty()==false) del(); 14 | } 15 | 16 | bool mylist::isEmpty(void){ 17 | if(num==0) return true; 18 | return false; 19 | } 20 | 21 | void mylist::add(Point tpoint){ 22 | node *new_node, *temp; 23 | Point *temp_point; 24 | new_node=(node*)malloc(sizeof(node)); 25 | temp_point=(Point*)malloc(sizeof(Point)); 26 | temp_point->x = tpoint.x; 27 | temp_point->y = tpoint.y; 28 | 29 | new_node->point = temp_point; 30 | 31 | temp = head; 32 | head = new_node; 33 | new_node->next = temp; 34 | num++; 35 | } 36 | 37 | node* mylist::del(void){ 38 | node* temp; 39 | if(curr_node==NULL) 40 | return NULL; 41 | 42 | temp = curr_node; 43 | prev_node->next = curr_node->next; 44 | curr_node = curr_node->next; 45 | free(temp->point); 46 | free(temp); 47 | num--; 48 | return curr_node; 49 | } 50 | 51 | node* mylist::move_first(void){ 52 | prev_node = head; 53 | curr_node = head; 54 | return curr_node; 55 | } 56 | 57 | node* mylist::move_next(void){ 58 | if(curr_node == NULL) 59 | return NULL; 60 | prev_node = curr_node; 61 | curr_node = curr_node->next; 62 | return curr_node; 63 | } -------------------------------------------------------------------------------- /experiments/week08-win3/lab/mylist.h: -------------------------------------------------------------------------------- 1 | #ifndef __MYLIST_H__ 2 | #define __MYLIST_H__ 3 | 4 | #include "define.h" 5 | 6 | typedef struct node__ { 7 | Point* point; 8 | struct node__ *next; 9 | } node; 10 | 11 | class mylist { 12 | private: 13 | int num; 14 | node *head; 15 | node *prev_node; 16 | node *curr_node; 17 | 18 | protected: 19 | node* del(void); 20 | 21 | public: 22 | mylist(); 23 | virtual ~mylist(); 24 | 25 | bool isEmpty(); 26 | void add(Point tpoint); 27 | 28 | node* move_first(void); 29 | node* move_next(void); 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /experiments/week08-win3/lab/res/Toolbar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/res/Toolbar.bmp -------------------------------------------------------------------------------- /experiments/week08-win3/lab/res/Toolbar256.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/res/Toolbar256.bmp -------------------------------------------------------------------------------- /experiments/week08-win3/lab/res/Waterfall.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/res/Waterfall.ico -------------------------------------------------------------------------------- /experiments/week08-win3/lab/res/Waterfall.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/res/Waterfall.rc2 -------------------------------------------------------------------------------- /experiments/week08-win3/lab/res/WaterfallDoc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/res/WaterfallDoc.ico -------------------------------------------------------------------------------- /experiments/week08-win3/lab/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/resource.h -------------------------------------------------------------------------------- /experiments/week08-win3/lab/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/stdafx.cpp -------------------------------------------------------------------------------- /experiments/week08-win3/lab/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/stdafx.h -------------------------------------------------------------------------------- /experiments/week08-win3/lab/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/targetver.h -------------------------------------------------------------------------------- /experiments/week08-win3/lab/waterfallsolver.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/waterfallsolver.cpp -------------------------------------------------------------------------------- /experiments/week08-win3/lab/waterfallsolver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/lab/waterfallsolver.h -------------------------------------------------------------------------------- /experiments/week08-win3/paper/win-3-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/paper/win-3-post.pdf -------------------------------------------------------------------------------- /experiments/week08-win3/paper/win-3-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/experiments/week08-win3/paper/win-3-pre.pdf -------------------------------------------------------------------------------- /final/final-1.cpp: -------------------------------------------------------------------------------- 1 | #define _CRT_SECURE_NO_WARNINGS 2 | 3 | #include 4 | 5 | /* 6 | Suhyun Park (20181634) 7 | CSE Undergraduate, Sogang U 8 | 9 | Question 1. 10 | */ 11 | 12 | int dx[4] = { -1, 1, 0, 0 }; 13 | int dy[4] = { 0, 0, -1, 1 }; 14 | 15 | inline int dir(const char& c) { 16 | if (c == 'N') return 0; 17 | if (c == 'S') return 1; 18 | if (c == 'W') return 2; 19 | if (c == 'E') return 3; 20 | return 0; 21 | } 22 | 23 | bool visit[43][43]; 24 | 25 | int main() { 26 | int n; 27 | scanf("%d", &n); 28 | 29 | while (n--) { 30 | char move[82]; 31 | scanf("%s", move); 32 | 33 | for (int i = 0; i <= 42; i++) { 34 | for (int j = 0; j <= 42; j++) { 35 | visit[i][j] = false; 36 | } 37 | } 38 | 39 | int x = 21, y = 21; 40 | 41 | visit[x][y] = true; 42 | for (const char& c : move) { 43 | if (c == '.') break; 44 | int d = dir(c); 45 | x += dx[d]; 46 | y += dy[d]; 47 | visit[x][y] = true; 48 | } 49 | 50 | int cnt = 0; 51 | for (int i = 0; i <= 42; i++) { 52 | for (int j = 0; j <= 42; j++) { 53 | cnt += visit[i][j]; 54 | } 55 | } 56 | 57 | printf("%d\n", cnt); 58 | } 59 | 60 | return 0; 61 | } -------------------------------------------------------------------------------- /final/final-2.cpp: -------------------------------------------------------------------------------- 1 | #define _CRT_SECURE_NO_WARNINGS 2 | 3 | #include 4 | 5 | /* 6 | Suhyun Park (20181634) 7 | CSE Undergraduate, Sogang U 8 | 9 | Question 2. 10 | */ 11 | 12 | struct operation { 13 | char c; 14 | int x; 15 | }; 16 | 17 | int ord[128]; 18 | int stack[128], sidx; 19 | operation op[256]; 20 | int opidx; 21 | 22 | int main() { 23 | int tc; 24 | scanf("%d", &tc); 25 | 26 | for (int i = 1; i <= tc; i++) { 27 | printf("T%d\n", i); 28 | 29 | int n; 30 | scanf("%d", &n); 31 | sidx = 0; 32 | opidx = 0; 33 | 34 | for (int i = 0; i < n; i++) { 35 | scanf("%d", &ord[i]); 36 | } 37 | 38 | int oi = 0; 39 | for (int i = 1; i <= n; i++) { 40 | op[opidx].c = 'P'; 41 | op[opidx].x = i; 42 | opidx++; 43 | 44 | stack[sidx++] = i; 45 | while (sidx && ord[oi] == stack[sidx - 1]) { 46 | op[opidx].c = 'R'; 47 | op[opidx].x = stack[sidx - 1]; 48 | opidx++; 49 | sidx--; 50 | oi++; 51 | } 52 | } 53 | 54 | if (oi < n) { 55 | printf("impossible\n"); 56 | } 57 | else { 58 | for (int i = 0; i < opidx; i++) { 59 | printf("%c%d\n", op[i].c, op[i].x); 60 | } 61 | } 62 | } 63 | 64 | return 0; 65 | } -------------------------------------------------------------------------------- /header.tex: -------------------------------------------------------------------------------- 1 | \documentclass[runningheads]{../../../llncs} 2 | \usepackage[paperheight=295mm,paperwidth=210mm]{geometry} 3 | \usepackage{graphicx} 4 | \usepackage{import} 5 | \usepackage{kotex} 6 | \usepackage[dvipsnames]{xcolor} 7 | \usepackage{fancyvrb} 8 | \usepackage{listings} 9 | \usepackage{indentfirst} 10 | \usepackage{tabularx} 11 | \usepackage{underscore} 12 | \usepackage{multicol} 13 | \usepackage{enumitem} 14 | \usepackage{menukeys} 15 | \usepackage{amsmath} 16 | \usepackage{clrscode3e} % https://www.ctan.org/pkg/clrscode3e?lang=en 17 | \usepackage[numbers,square,super]{natbib} 18 | \usepackage{inconsolata} % Inconsolata 19 | \usepackage{mathptmx} % Times New Roman 20 | \usepackage{minted} 21 | \graphicspath{ {./images/} } 22 | \lstset{basicstyle=\footnotesize\ttfamily,breaklines=true} 23 | \renewcommand{\bibname}{참고문헌} 24 | \setlength{\parindent}{1em} 25 | \setlength{\parskip}{1em} 26 | \linespread{1.2} 27 | {\renewcommand{\arraystretch}{1.5}% 28 | \setlength{\tabcolsep}{0.5em}% 29 | \newenvironment{Figure} 30 | {\par\medskip\noindent\minipage{\linewidth}} 31 | {\endminipage\par\medskip} 32 | \newcommand{\translation}[1]{\textsuperscript{#1}} 33 | \newlist{algorithm}{enumerate}{10} 34 | \setlist[algorithm]{label*=\arabic*.} 35 | \setlist[algorithm,1]{label=\textbf{\arabic*}} 36 | \setlist[algorithm,2]{label=\textbf{\alph*}} 37 | \setlist[algorithm,3]{label=\textbf{\roman*}} 38 | \setlist[algorithm,4]{label=(\arabic*)} 39 | \setlist[algorithm,5]{label=(\alph*)} 40 | \setlist[algorithm,6]{label=(\roman*)} 41 | \makeatletter 42 | \renewcommand\NAT@citesuper[3]{\ifNAT@swa 43 | \if*#2*\else#2\NAT@spacechar\fi 44 | \unskip\kern\p@\textsuperscript{\NAT@@open#1\if*#3*\else,\NAT@spacechar#3\fi\NAT@@close}% 45 | \else #1\fi\endgroup} 46 | \makeatother -------------------------------------------------------------------------------- /project-maze/README.md: -------------------------------------------------------------------------------- 1 | # 12-14주차: 미로 프로젝트 2 | 3 | - [코드](code) 4 | - [설계 보고서](paper/report/design-report.pdf) 5 | - [1주차 예비 보고서](paper/week12/maze-1-pre.pdf) 6 | - [1주차 결과 보고서](paper/week12/maze-1-post.pdf) 7 | - [2주차 예비 보고서](paper/week13/maze-2-pre.pdf) 8 | - [2주차 결과 보고서](paper/week13/maze-2-post.pdf) 9 | - [3주차 예비 보고서](paper/week14/maze-3-pre.pdf) 10 | - [3주차 결과 보고서](paper/week14/maze-3-post.pdf) -------------------------------------------------------------------------------- /project-maze/code/data/maze0.maz: -------------------------------------------------------------------------------- 1 | +-+-+-+-+-+-+-+-+-+-+ 2 | | | | | | 3 | + + +-+-+-+ + +-+ + + 4 | | | | | | | 5 | + +-+ +-+ + +-+-+-+ + 6 | | | | | | | | 7 | + + +-+-+ + +-+-+-+-+ 8 | | | | | 9 | +-+-+ + +-+ +-+ + +-+ 10 | | | | | | | | 11 | +-+ +-+ + + +-+-+ +-+ 12 | | | | | | | | 13 | + + +-+ + +-+ +-+-+-+ 14 | | | | | | | 15 | +-+ + +-+ + + +-+ + + 16 | | | | | | | 17 | + + +-+-+ +-+ + +-+ + 18 | | | | | | | | | 19 | +-+ +-+ +-+ + +-+ + + 20 | | | | | 21 | +-+-+-+-+-+-+-+-+-+-+ -------------------------------------------------------------------------------- /project-maze/code/data/maze1.maz: -------------------------------------------------------------------------------- 1 | +-+-+-+-+-+-+-+-+-+-+ 2 | | | | | | | | | 3 | + + + +-+ + +-+ +-+ + 4 | | | | | | 5 | +-+-+-+ + + +-+-+ +-+ 6 | | | | | | | | 7 | +-+ + + +-+ +-+-+ + + 8 | | | | | | 9 | + + +-+ + + +-+-+ +-+ 10 | | | | | | | | 11 | +-+-+-+ + + +-+-+ +-+ 12 | | | | | | 13 | +-+ + +-+ +-+-+ + +-+ 14 | | | | | | | | | | 15 | + + + + + +-+ +-+ +-+ 16 | | | | | | | 17 | +-+-+ + +-+ + +-+ +-+ 18 | | | | | | 19 | + + + + +-+ + +-+-+-+ 20 | | | | | | | | 21 | +-+-+ + +-+ + +-+-+ + 22 | | | | 23 | + + +-+-+ + + +-+-+ + 24 | | | | | | | | | | 25 | + +-+-+ +-+-+ +-+ +-+ 26 | | | | | | | | 27 | +-+ + + +-+ +-+-+ +-+ 28 | | | | | 29 | +-+-+-+ +-+ +-+ + + + 30 | | | | | | | 31 | + +-+ +-+ +-+ + + +-+ 32 | | | | | | | 33 | +-+ + +-+ + + + + + + 34 | | | | | | | | | | 35 | +-+-+-+ +-+ + + + + + 36 | | | | | | | | | | 37 | +-+ + + + + +-+-+-+ + 38 | | | | | 39 | +-+-+ +-+ + +-+-+-+-+ 40 | | | | | 41 | +-+-+-+-+-+-+-+-+-+-+ -------------------------------------------------------------------------------- /project-maze/code/main/Example/Example.h: -------------------------------------------------------------------------------- 1 | #ifndef __EXAMPLE_H__ 2 | #define __EXAMPLE_H__ 3 | 4 | // primitive type 5 | #define DR_LINE 0 6 | #define DR_BOX 1 7 | #define DR_SOLIDBOX 2 8 | #define DR_HATCHBOX 3 9 | 10 | typedef struct EXAMPLE 11 | { 12 | short type; 13 | short hatch; 14 | int lineWidth; 15 | unsigned int lineColor; 16 | unsigned int fillColor; 17 | double xmin, ymin, xmax, ymax; 18 | EXAMPLE* next; 19 | } EXAMPLE; 20 | 21 | // global variable 22 | extern EXAMPLE* g_pHeader; 23 | extern double g_xMin, g_xMax, g_yMin, g_yMax; 24 | 25 | // function prototype 26 | extern bool loadExam(const char* pszFileName); 27 | extern void freeExam(); 28 | extern void changeColor(); 29 | extern bool saveExam(const char* pszFileName); 30 | 31 | #endif // __EXAMPLE_H__ -------------------------------------------------------------------------------- /project-maze/code/main/ExternDoc.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | 3 | CDocument* g_pDoc = NULL; 4 | 5 | void setDocument(CDocument* pDoc) 6 | { 7 | ASSERT(pDoc); 8 | g_pDoc = pDoc; 9 | } 10 | 11 | /************************************************************** 12 | * function : void setModifiedFlag(bool modified) 13 | * 14 | * argument : bool modified - true if data are modified; otherwise false 15 | * remark : call to check if data are modified 16 | **************************************************************/ 17 | void setModifiedFlag(bool modified) 18 | { 19 | g_pDoc->SetModifiedFlag(modified); 20 | } -------------------------------------------------------------------------------- /project-maze/code/main/ExternDoc.h: -------------------------------------------------------------------------------- 1 | #ifndef __EXTERN_DOC_H__ 2 | #define __EXTERN_DOC_H__ 3 | 4 | #include "StdAfx.h" 5 | 6 | extern void setDocument(CDocument* pDoc); 7 | extern void setModifiedFlag(bool modified); 8 | 9 | #endif // __EXTERN_DOC_H__ -------------------------------------------------------------------------------- /project-maze/code/main/ExternView.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | #include "StdAfx.h" 31 | #include "MFC_MainDoc.h" 32 | #include "MFC_MainView.h" 33 | 34 | CMFC_MainView* g_pView = NULL; -------------------------------------------------------------------------------- /project-maze/code/main/ExternView.h: -------------------------------------------------------------------------------- 1 | #ifndef __EXTERN_VIEW_H__ 2 | #define __EXTERN_VIEW_H__ 3 | 4 | #include "StdAfx.h" 5 | #include "MFC_MainDoc.h" 6 | #include "MFC_MainView.h" 7 | 8 | extern CMFC_MainView* g_pView; 9 | 10 | #endif // __EXTERN_VIEW_H__ -------------------------------------------------------------------------------- /project-maze/code/main/Graphics/Clipping.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/Graphics/Clipping.cpp -------------------------------------------------------------------------------- /project-maze/code/main/Graphics/Clipping.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | #ifndef __CLIPPING_H__ 30 | #define __CLIPPING_H__ 31 | 32 | #pragma warning(disable:4786) 33 | 34 | #include 35 | 36 | extern std::deque vec2; 37 | extern double minx, miny, maxx, maxy; 38 | 39 | extern bool ClipLine(double x1, double y1, double x2, double y2, double *xx1, double *yy1, double *xx2, double *yy2); 40 | extern bool ClipBox(double x1, double y1, double x2, double y2); 41 | extern void CheckBoxPos(long* dx1, long* dy1, long* dx2, long* dy2); 42 | extern int ClipPolygon(POINTDBL* inArr, int inLen); 43 | 44 | #endif // __CLIPPING_H__ -------------------------------------------------------------------------------- /project-maze/code/main/Graphics/DrawFunc.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/Graphics/DrawFunc.cpp -------------------------------------------------------------------------------- /project-maze/code/main/Graphics/Graphics_DS.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | #ifndef __GRAPHICS_DS_H__ 31 | #define __GRAPHICS_DS_H__ 32 | 33 | #define ALPHA_MAX 255 34 | #define ALPHA_MIN 0 35 | 36 | typedef struct POINTTDBL 37 | { 38 | double x, y; 39 | } POINTDBL; 40 | 41 | #endif // __GRAPHICS_DS_H__ -------------------------------------------------------------------------------- /project-maze/code/main/MFC_Main.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/MFC_Main.aps -------------------------------------------------------------------------------- /project-maze/code/main/MFC_Main.clw: -------------------------------------------------------------------------------- 1 | ; CLW file contains information for the MFC ClassWizard 2 | 3 | [General Info] 4 | Version=1 5 | LastClass=CMFC_MainView 6 | LastTemplate=CDialog 7 | NewFileInclude1=#include "stdafx.h" 8 | NewFileInclude2=#include "MFC_Main.h" 9 | LastPage=0 10 | 11 | ClassCount=5 12 | Class1=CMFC_MainApp 13 | Class2=CMFC_MainDoc 14 | Class3=CMFC_MainView 15 | Class4=CMainFrame 16 | 17 | ResourceCount=2 18 | Resource1=IDR_MAINFRAME 19 | Class5=CAboutDlg 20 | Resource2=IDD_ABOUTBOX 21 | 22 | [CLS:CMFC_MainApp] 23 | Type=0 24 | HeaderFile=MFC_Main.h 25 | ImplementationFile=MFC_Main.cpp 26 | Filter=N 27 | BaseClass=CWinApp 28 | VirtualFilter=AC 29 | LastObject=CMFC_MainApp 30 | 31 | [CLS:CMFC_MainDoc] 32 | Type=0 33 | HeaderFile=MFC_MainDoc.h 34 | ImplementationFile=MFC_MainDoc.cpp 35 | Filter=N 36 | BaseClass=CDocument 37 | VirtualFilter=DC 38 | LastObject=ID_FILE_CLOSE 39 | 40 | [CLS:CMFC_MainView] 41 | Type=0 42 | HeaderFile=MFC_MainView.h 43 | ImplementationFile=MFC_MainView.cpp 44 | Filter=C 45 | BaseClass=CView 46 | VirtualFilter=VWC 47 | LastObject=CMFC_MainView 48 | 49 | 50 | [CLS:CMainFrame] 51 | Type=0 52 | HeaderFile=MainFrm.h 53 | ImplementationFile=MainFrm.cpp 54 | Filter=T 55 | BaseClass=CFrameWnd 56 | VirtualFilter=fWC 57 | LastObject=ID_FILE_CLOSE 58 | 59 | 60 | 61 | 62 | [CLS:CAboutDlg] 63 | Type=0 64 | HeaderFile=MFC_Main.cpp 65 | ImplementationFile=MFC_Main.cpp 66 | Filter=D 67 | 68 | [DLG:IDD_ABOUTBOX] 69 | Type=1 70 | Class=CAboutDlg 71 | ControlCount=4 72 | Control1=IDC_STATIC,static,1342177283 73 | Control2=IDC_STATIC,static,1342308480 74 | Control3=IDC_STATIC,static,1342308352 75 | Control4=IDOK,button,1342373889 76 | 77 | [MNU:IDR_MAINFRAME] 78 | Type=1 79 | Class=CMainFrame 80 | Command1=ID_FILE_OPEN 81 | Command2=ID_FILE_SAVE 82 | Command3=ID_FILE_SAVE_AS 83 | Command4=ID_FILE_CLOSE 84 | Command5=ID_FILE_PRINT 85 | Command6=ID_FILE_PRINT_PREVIEW 86 | Command7=ID_FILE_PRINT_SETUP 87 | Command8=ID_FILE_MRU_FILE1 88 | Command9=ID_APP_EXIT 89 | Command10=ID_VIEW_FULLVIEW 90 | Command11=ID_VIEW_TOOLBAR 91 | Command12=ID_VIEW_STATUS_BAR 92 | Command13=ID_TOOLS_GO 93 | Command14=ID_APP_ABOUT 94 | CommandCount=14 95 | 96 | [ACL:IDR_MAINFRAME] 97 | Type=1 98 | Class=CMainFrame 99 | Command1=ID_FILE_NEW 100 | Command2=ID_FILE_OPEN 101 | Command3=ID_FILE_SAVE 102 | Command4=ID_FILE_PRINT 103 | Command5=ID_EDIT_UNDO 104 | Command6=ID_EDIT_CUT 105 | Command7=ID_EDIT_COPY 106 | Command8=ID_EDIT_PASTE 107 | Command9=ID_EDIT_UNDO 108 | Command10=ID_EDIT_CUT 109 | Command11=ID_EDIT_COPY 110 | Command12=ID_EDIT_PASTE 111 | Command13=ID_NEXT_PANE 112 | Command14=ID_PREV_PANE 113 | CommandCount=14 114 | 115 | [TB:IDR_MAINFRAME] 116 | Type=1 117 | Class=? 118 | Command1=ID_FILE_NEW 119 | Command2=ID_FILE_OPEN 120 | Command3=ID_FILE_SAVE 121 | Command4=ID_VIEW_FULLVIEW 122 | Command5=ID_VIEW_ZOOM 123 | Command6=ID_TOOLS_GO 124 | Command7=ID_FILE_PRINT 125 | Command8=ID_APP_ABOUT 126 | CommandCount=8 127 | 128 | -------------------------------------------------------------------------------- /project-maze/code/main/MFC_Main.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | // MFC_Main.h : main header file for the MFC_MAIN application 31 | // 32 | 33 | #if !defined(AFX_MFC_MAIN_H__E4156865_7D9E_11D4_8F2D_006097DCA644__INCLUDED_) 34 | #define AFX_MFC_MAIN_H__E4156865_7D9E_11D4_8F2D_006097DCA644__INCLUDED_ 35 | 36 | #if _MSC_VER > 1000 37 | #pragma once 38 | #endif // _MSC_VER > 1000 39 | 40 | #ifndef __AFXWIN_H__ 41 | #error include 'stdafx.h' before including this file for PCH 42 | #endif 43 | 44 | #include "resource.h" // main symbols 45 | 46 | ///////////////////////////////////////////////////////////////////////////// 47 | // CMFC_MainApp: 48 | // See MFC_Main.cpp for the implementation of this class 49 | // 50 | 51 | class CMFC_MainApp : public CWinApp 52 | { 53 | public: 54 | CMFC_MainApp(); 55 | 56 | // Overrides 57 | // ClassWizard generated virtual function overrides 58 | //{{AFX_VIRTUAL(CMFC_MainApp) 59 | public: 60 | virtual BOOL InitInstance(); 61 | virtual int ExitInstance(); 62 | //}}AFX_VIRTUAL 63 | 64 | // Implementation 65 | //{{AFX_MSG(CMFC_MainApp) 66 | afx_msg void OnAppAbout(); 67 | afx_msg void OnFileOpen(); 68 | //}}AFX_MSG 69 | DECLARE_MESSAGE_MAP() 70 | }; 71 | 72 | 73 | ///////////////////////////////////////////////////////////////////////////// 74 | 75 | //{{AFX_INSERT_LOCATION}} 76 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 77 | 78 | #endif // !defined(AFX_MFC_MAIN_H__E4156865_7D9E_11D4_8F2D_006097DCA644__INCLUDED_) 79 | -------------------------------------------------------------------------------- /project-maze/code/main/MFC_Main.plg: -------------------------------------------------------------------------------- 1 | 2 | 3 |
 4 | 

Build Log

5 |

6 | --------------------Configuration: MFC_Main - Win32 Debug-------------------- 7 |

8 |

Command Lines

9 | Creating temporary file "C:\WINDOWS\TEMP\RSP82D6.TMP" with contents 10 | [ 11 | /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "GRAPHICS_BUFFERED" /FR"Debug/" /Fp"Debug/MFC_Main.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 12 | "D:\User\Jay\Project\MFC_Main\MFC_Main\MFC_MainView.cpp" 13 | ] 14 | Creating command line "cl.exe @C:\WINDOWS\TEMP\RSP82D6.TMP" 15 | Creating temporary file "C:\WINDOWS\TEMP\RSP82D7.TMP" with contents 16 | [ 17 | /nologo /subsystem:windows /incremental:yes /pdb:"Debug/MFC_Main.pdb" /debug /machine:I386 /out:"Debug/MFC_Main.exe" /pdbtype:sept 18 | .\Debug\ExternDoc.obj 19 | .\Debug\ExternView.obj 20 | .\Debug\MainFrm.obj 21 | .\Debug\MFC_Main.obj 22 | .\Debug\MFC_MainDoc.obj 23 | .\Debug\MFC_MainView.obj 24 | .\Debug\StdAfx.obj 25 | .\Debug\Clipping.obj 26 | .\Debug\DrawFunc.obj 27 | .\Debug\MsgView.obj 28 | .\Debug\RubberBand.obj 29 | .\Debug\Scroll.obj 30 | .\Debug\Zoom.obj 31 | .\Debug\Math.obj 32 | .\Debug\StringTokenizer.obj 33 | .\Debug\Example.obj 34 | .\Debug\MFC_Main.res 35 | .\Debug\s20001234.obj 36 | ] 37 | Creating command line "link.exe @C:\WINDOWS\TEMP\RSP82D7.TMP" 38 |

Output Window

39 | Compiling... 40 | MFC_MainView.cpp 41 | Linking... 42 | Creating temporary file "C:\WINDOWS\TEMP\RSP9010.TMP" with contents 43 | [ 44 | /nologo /o"Debug/MFC_Main.bsc" 45 | .\Debug\StdAfx.sbr 46 | .\Debug\ExternDoc.sbr 47 | .\Debug\ExternView.sbr 48 | .\Debug\MainFrm.sbr 49 | .\Debug\MFC_Main.sbr 50 | .\Debug\MFC_MainDoc.sbr 51 | .\Debug\MFC_MainView.sbr 52 | .\Debug\Clipping.sbr 53 | .\Debug\DrawFunc.sbr 54 | .\Debug\MsgView.sbr 55 | .\Debug\RubberBand.sbr 56 | .\Debug\Scroll.sbr 57 | .\Debug\Zoom.sbr 58 | .\Debug\Math.sbr 59 | .\Debug\StringTokenizer.sbr 60 | .\Debug\Example.sbr 61 | .\Debug\s20001234.sbr] 62 | Creating command line "bscmake.exe @C:\WINDOWS\TEMP\RSP9010.TMP" 63 | Creating browse info file... 64 |

Output Window

65 | 66 | 67 | 68 |

Results

69 | MFC_Main.exe - 0 error(s), 0 warning(s) 70 |
71 | 72 | 73 | -------------------------------------------------------------------------------- /project-maze/code/main/MFC_Main.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/MFC_Main.rc -------------------------------------------------------------------------------- /project-maze/code/main/MFC_Main.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MFC_Main", "MFC_Main.vcxproj", "{51C1D48E-4E34-45CE-B29A-F06E3A8662BB}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {51C1D48E-4E34-45CE-B29A-F06E3A8662BB}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {51C1D48E-4E34-45CE-B29A-F06E3A8662BB}.Debug|Win32.Build.0 = Debug|Win32 14 | {51C1D48E-4E34-45CE-B29A-F06E3A8662BB}.Release|Win32.ActiveCfg = Release|Win32 15 | {51C1D48E-4E34-45CE-B29A-F06E3A8662BB}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /project-maze/code/main/MFC_Main.vcproj.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /project-maze/code/main/MFC_Main.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | MFC_Main.rc 5 | 6 | -------------------------------------------------------------------------------- /project-maze/code/main/MFC_MainDoc.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/MFC_MainDoc.cpp -------------------------------------------------------------------------------- /project-maze/code/main/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // MFC_Main.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /project-maze/code/main/StdAfx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #if !defined(AFX_STDAFX_H__E4156867_7D9E_11D4_8F2D_006097DCA644__INCLUDED_) 7 | #define AFX_STDAFX_H__E4156867_7D9E_11D4_8F2D_006097DCA644__INCLUDED_ 8 | 9 | #if _MSC_VER > 1000 10 | #pragma once 11 | #endif // _MSC_VER > 1000 12 | 13 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 14 | 15 | #include // MFC core and standard components 16 | #include // MFC extensions 17 | #include // MFC Automation classes 18 | #include // MFC support for Internet Explorer 4 Common Controls 19 | #ifndef _AFX_NO_AFXCMN_SUPPORT 20 | #include // MFC support for Windows Common Controls 21 | #endif // _AFX_NO_AFXCMN_SUPPORT 22 | 23 | 24 | //{{AFX_INSERT_LOCATION}} 25 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 26 | 27 | #endif // !defined(AFX_STDAFX_H__E4156867_7D9E_11D4_8F2D_006097DCA644__INCLUDED_) 28 | -------------------------------------------------------------------------------- /project-maze/code/main/UI/MsgView.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | #include "..\StdAfx.h" 31 | #include 32 | 33 | static CRichEditView* g_pMsgView = NULL; 34 | static int g_nMsgCnt = 1; 35 | 36 | void initMessage(CRichEditView* pView) 37 | { 38 | g_pMsgView = pView; 39 | CRichEditCtrl& rich = g_pMsgView->GetRichEditCtrl(); 40 | rich.SetReadOnly(); 41 | rich.SetBackgroundColor(FALSE, RGB(200, 200, 200)); 42 | rich.SetWindowText("0 : Ready\n"); 43 | } 44 | 45 | void showMessage(const char* pszMsg) 46 | { 47 | CRichEditCtrl& rich = g_pMsgView->GetRichEditCtrl(); 48 | CString str, tmp; 49 | int length; 50 | 51 | rich.GetWindowText(str); 52 | tmp.Format("%d : %s\n", g_nMsgCnt, pszMsg); 53 | str += tmp; 54 | length = str.GetLength(); 55 | rich.SetWindowText(str); 56 | rich.SetSel(length, length); 57 | g_nMsgCnt++; 58 | } 59 | 60 | void clearMessage() 61 | { 62 | CRichEditCtrl& rich = g_pMsgView->GetRichEditCtrl(); 63 | rich.SetWindowText("0 : Ready\n"); 64 | g_nMsgCnt = 1; 65 | } -------------------------------------------------------------------------------- /project-maze/code/main/UI/MsgView.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | #ifndef __MSG_VIEW_H__ 31 | #define __MSG_VIEW_H__ 32 | 33 | #include 34 | 35 | extern void initMessage(CRichEditView* pView); 36 | extern void showMessage(const char* pszMsg); 37 | extern void clearMessage(); 38 | 39 | #endif // __MSG_VIEW_H__ -------------------------------------------------------------------------------- /project-maze/code/main/UI/RubberBand.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/UI/RubberBand.cpp -------------------------------------------------------------------------------- /project-maze/code/main/UI/RubberBand.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | #ifndef __RUBBER_BAND_H__ 31 | #define __RUBBER_BAND_H__ 32 | 33 | // rubber band type 34 | #define RBT_DEFAULT 0 35 | #define RBT_ZOOM 1 36 | #define RBT_RESIZE 2 37 | 38 | // rubber band status 39 | #define RBS_BEGIN 0 40 | #define RBS_LOOP 1 41 | #define RBS_END 2 42 | 43 | // rubber band drag information 44 | #define RBD_DEFAULT 0 45 | #define RBD_ZI 1 46 | #define RBD_ZO 2 47 | 48 | // cursor position index 49 | #define RB_POS_UKN 0 50 | #define RB_POS_TL 1 51 | #define RB_POS_TR 2 52 | #define RB_POS_BR 3 53 | #define RB_POS_BL 4 54 | #define RB_POS_LE 5 55 | #define RB_POS_RE 6 56 | #define RB_POS_TE 7 57 | #define RB_POS_BE 8 58 | 59 | #define RB_NO_DRAWN 0 60 | #define RB_IS_DRAWN 1 61 | #define RB_WAS_DRAWN 2 62 | 63 | // global variables 64 | extern CRect g_rcRB; 65 | extern CRect g_rcPrevRB; 66 | extern int g_nResizePos; 67 | extern int g_nDrawnRB; 68 | 69 | // global functions 70 | extern bool initRB(CWnd* pWnd); 71 | extern void clearRB(); 72 | extern int beginRB(const POINT& pt, short type = RBT_DEFAULT); 73 | extern int endRB(const POINT& pt); 74 | extern void endResizableRB(); 75 | extern void redoRB(); 76 | extern void dragRB(const POINT& pt); 77 | extern void drawRB(); 78 | 79 | #endif // __RUBBER_BAND_H__ -------------------------------------------------------------------------------- /project-maze/code/main/UI/Scroll.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/UI/Scroll.cpp -------------------------------------------------------------------------------- /project-maze/code/main/UI/Scroll.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | #ifndef __SCROLL_H__ 31 | #define __SCROLL_H__ 32 | 33 | extern void setScroll(); 34 | extern void handleHScroll(UINT nSBCode, UINT nPos); 35 | extern void handleVScroll(UINT nSBCode, UINT nPos); 36 | extern void handleSize(UINT nType, int cx, int cy); 37 | 38 | #endif // __SCROLL_H__ -------------------------------------------------------------------------------- /project-maze/code/main/UI/Zoom.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/UI/Zoom.cpp -------------------------------------------------------------------------------- /project-maze/code/main/UI/Zoom.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/UI/Zoom.h -------------------------------------------------------------------------------- /project-maze/code/main/UpgradeLog.XML: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /project-maze/code/main/UpgradeLog2.XML: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /project-maze/code/main/UpgradeLog3.XML: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /project-maze/code/main/UpgradeLog4.XML: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /project-maze/code/main/Util/Math.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | double round(double x) 31 | { 32 | return (x > 0 ? int(x + 0.5) : int (x - 0.5)); 33 | } -------------------------------------------------------------------------------- /project-maze/code/main/Util/Math.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | #ifndef __MATH_H__ 31 | #define __MATH_H__ 32 | 33 | extern double round(double x); 34 | 35 | #endif // __MATH_H__ -------------------------------------------------------------------------------- /project-maze/code/main/Util/StringTokenizer.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | #include 31 | #include 32 | #include 33 | #include "StringTokenizer.h" 34 | 35 | void CStringTokenizer::prepareNext() 36 | { 37 | int i; 38 | // go to next token 39 | do 40 | { 41 | while (m_nBufIdx < STRING_BUFFER_SIZE && isspace(m_cBuffer[m_nBufIdx])) 42 | m_nBufIdx++; 43 | // load next line if needed 44 | if (m_nBufIdx >= STRING_BUFFER_SIZE || '\0' == m_cBuffer[m_nBufIdx]) 45 | { 46 | // check if EOF 47 | if (NULL == fgets(m_cBuffer, STRING_BUFFER_SIZE, m_pFile)) 48 | { 49 | m_cNext[0] = '\0'; 50 | return; 51 | } 52 | m_nBufIdx = 0; 53 | } 54 | } while (isspace(m_cBuffer[m_nBufIdx])); 55 | 56 | for (i = 0; m_nBufIdx < STRING_BUFFER_SIZE && isspace(m_cBuffer[m_nBufIdx]) == 0; m_nBufIdx++, i++) 57 | m_cNext[i] = m_cBuffer[m_nBufIdx]; 58 | m_cNext[i] = '\0'; 59 | } 60 | -------------------------------------------------------------------------------- /project-maze/code/main/Util/StringTokenizer.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | *** 3 | *** Copyright (c) 2000 Design Automation Lab at the Sogang University, 4 | *** 5 | *** Affiliation: DA Lab, Sogang University, Computer Science Department, 6 | *** Seoul, Korea 7 | *** 8 | *** Permission is hereby granted, free of charge, to any person obtaining 9 | *** a copy of this software and associated documentation files (the 10 | *** "Software"), to deal in the Software without restriction, including 11 | *** without limitation 12 | *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 | *** and/or sell copies of the Software, and to permit persons to whom the 14 | *** Software is furnished to do so, subject to the following conditions: 15 | *** 16 | *** The above copyright notice and this permission notice shall be included 17 | *** in all copies or substantial portions of the Software. 18 | *** 19 | *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 24 | *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 25 | *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | *** 27 | *** 28 | ***************************************************************************/ 29 | 30 | #ifndef __STRING_TOKENIZER_H__ 31 | #define __STRING_TOKENIZER_H__ 32 | 33 | #define STRING_BUFFER_SIZE 128 34 | #define MAX_TOKEN_SIZE 64 35 | 36 | class CStringTokenizer 37 | { 38 | public: 39 | CStringTokenizer() : m_pFile(NULL) {}; 40 | ~CStringTokenizer() { if (m_pFile) fclose(m_pFile); }; 41 | 42 | void initialize() 43 | { m_nBufIdx = 0; m_cBuffer[0] = '\0'; m_cToken[0] = '\0'; }; 44 | 45 | bool openFile(const char* pszFileName) 46 | { 47 | 48 | if (0 != fopen_s(&m_pFile,pszFileName, "rt")) 49 | return false; 50 | initialize(); 51 | prepareNext(); 52 | return true; 53 | }; 54 | 55 | void closeFile() 56 | { fclose(m_pFile); m_pFile = NULL; }; 57 | 58 | bool hasNext() 59 | { return (m_cNext[0] != '\0'); }; 60 | 61 | const char* getNext() 62 | { 63 | if (m_cNext[0] == '\0') return NULL; 64 | strcpy_s(m_cToken, m_cNext); 65 | prepareNext(); 66 | return m_cToken; 67 | }; 68 | 69 | void prepareNext(); 70 | 71 | public: 72 | FILE* m_pFile; 73 | int m_nBufIdx; 74 | char m_cBuffer[STRING_BUFFER_SIZE]; 75 | char m_cToken[MAX_TOKEN_SIZE]; 76 | char m_cNext[MAX_TOKEN_SIZE]; 77 | }; 78 | 79 | #endif // __STRING_TOKENIZER_H__ -------------------------------------------------------------------------------- /project-maze/code/main/_UpgradeReport_Files/UpgradeReport_Minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/_UpgradeReport_Files/UpgradeReport_Minus.gif -------------------------------------------------------------------------------- /project-maze/code/main/_UpgradeReport_Files/UpgradeReport_Plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/_UpgradeReport_Files/UpgradeReport_Plus.gif -------------------------------------------------------------------------------- /project-maze/code/main/res/MFC_Main.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/res/MFC_Main.ico -------------------------------------------------------------------------------- /project-maze/code/main/res/MFC_Main.rc2: -------------------------------------------------------------------------------- 1 | // 2 | // MFC_MAIN.RC2 - resources Microsoft Visual C++ does not edit directly 3 | // 4 | 5 | #ifdef APSTUDIO_INVOKED 6 | #error this file is not editable by Microsoft Visual C++ 7 | #endif //APSTUDIO_INVOKED 8 | 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // Add manually edited resources here... 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | -------------------------------------------------------------------------------- /project-maze/code/main/res/MFC_MainDoc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/res/MFC_MainDoc.ico -------------------------------------------------------------------------------- /project-maze/code/main/res/Toolbar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/res/Toolbar.bmp -------------------------------------------------------------------------------- /project-maze/code/main/res/zoom.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/res/zoom.cur -------------------------------------------------------------------------------- /project-maze/code/main/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/code/main/resource.h -------------------------------------------------------------------------------- /project-maze/code/main/test.dat: -------------------------------------------------------------------------------- 1 | HATCHBOX 55.000000 20.000000 80.000000 80.000000 3 0x0046728C 0x0032EE65 3 2 | SOLIDBOX 20.000000 50.000000 45.000000 80.000000 3 0x007D34F9 0x00003000 3 | SOLIDBOX 20.000000 20.000000 45.000000 60.000000 3 0x00837106 0x007A18F3 4 | BOX 10.000000 10.000000 90.000000 90.000000 2 0x00E421C7 5 | LINE 0.000000 100.000000 100.000000 0.000000 10 0x00860B0B 6 | LINE 0.000000 0.000000 100.000000 100.000000 5 0x00BCAB78 7 | -------------------------------------------------------------------------------- /project-maze/code/main/test2.dat: -------------------------------------------------------------------------------- 1 | HATCHBOX 55.000000 20.000000 80.000000 80.000000 3 0x006CB4D8 0x005FEEBF 1 2 | SOLIDBOX 20.000000 50.000000 45.000000 80.000000 3 0x0090C921 0x00231246 3 | SOLIDBOX 20.000000 20.000000 45.000000 60.000000 3 0x00417C82 0x00934525 4 | BOX 10.000000 10.000000 90.000000 90.000000 2 0x006D36DA 5 | LINE 0.000000 100.000000 100.000000 0.000000 5 0x002FFA5F 6 | LINE 0.000000 0.000000 100.000000 100.000000 5 0x00BB9976 7 | -------------------------------------------------------------------------------- /project-maze/code/snippets/generate_perfect_maze.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define MAXH 100 6 | #define MAXW 100 7 | 8 | enum { 9 | N, E, W, S 10 | }; 11 | 12 | char visit_flag[MAXH][MAXW]; 13 | char horizontal_route[MAXH][MAXW - 1]; 14 | char vertical_route[MAXH - 1][MAXW]; 15 | 16 | int adjacent(int possible_dirs[], int x, int y, int h, int w) { 17 | int possible_dir_count = 0; 18 | 19 | if (y > 0 && visit_flag[y - 1][x] == 0) possible_dirs[possible_dir_count++] = N; 20 | if (x < w - 1 && visit_flag[y][x + 1] == 0) possible_dirs[possible_dir_count++] = E; 21 | if (x > 0 && visit_flag[y][x - 1] == 0) possible_dirs[possible_dir_count++] = W; 22 | if (y < h - 1 && visit_flag[y + 1][x] == 0) possible_dirs[possible_dir_count++] = S; 23 | 24 | return possible_dir_count; 25 | } 26 | 27 | void dfs(int x, int y, int h, int w) { 28 | int possible_dirs[4]; 29 | int possible_dir_count = adjacent(possible_dirs, x, y, h, w); 30 | 31 | visit_flag[y][x] = 1; 32 | 33 | while (possible_dir_count) { 34 | int random_dir = rand() % possible_dir_count; 35 | 36 | switch (possible_dirs[random_dir]) { 37 | case N: 38 | vertical_route[y - 1][x] = 1; 39 | dfs(x, y - 1, h, w); 40 | break; 41 | case E: 42 | horizontal_route[y][x] = 1; 43 | dfs(x + 1, y, h, w); 44 | break; 45 | case S: 46 | vertical_route[y][x] = 1; 47 | dfs(x, y + 1, h, w); 48 | break; 49 | case W: 50 | horizontal_route[y][x - 1] = 1; 51 | dfs(x - 1, y, h, w); 52 | break; 53 | } 54 | 55 | possible_dir_count = adjacent(possible_dirs, x, y, h, w); 56 | } 57 | } 58 | 59 | void printMaze(int h, int w) { 60 | for (int x = 0; x < w; x++) { 61 | putchar('+'); 62 | putchar('-'); 63 | } 64 | putchar('+'); 65 | putchar('\n'); 66 | for (int y = 0; y < h; y++) { 67 | putchar('|'); 68 | for (int x = 0; x < w; x++) { 69 | putchar(' '); 70 | putchar(x < w - 1 && horizontal_route[y][x] ? ' ' : '|'); 71 | } 72 | putchar('\n'); 73 | putchar('+'); 74 | for (int x = 0; x < w; x++) { 75 | putchar(y < h - 1 && vertical_route[y][x] ? ' ' : '-'); 76 | putchar('+'); 77 | } 78 | putchar('\n'); 79 | } 80 | } 81 | 82 | int main() { 83 | srand(time(NULL)); 84 | 85 | int h, w; 86 | scanf("%d%d", &h, &w); 87 | 88 | dfs(0, 0, h, w); 89 | printMaze(h, w); 90 | 91 | return 0; 92 | } -------------------------------------------------------------------------------- /project-maze/paper/report/design-report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/paper/report/design-report.pdf -------------------------------------------------------------------------------- /project-maze/paper/report/inc-images/screenshot0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/paper/report/inc-images/screenshot0.png -------------------------------------------------------------------------------- /project-maze/paper/report/inc-images/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/paper/report/inc-images/screenshot1.png -------------------------------------------------------------------------------- /project-maze/paper/report/inc-sections/2-1.tex: -------------------------------------------------------------------------------- 1 | 구현 1주차에는 완전 미로와 불완전 미로 생성 로직을 각각 구현한다. 각각의 미로 생성에 필요한 자료구조와 알고리즘을 고안한다. 2 | 3 | 구현 2주차에는 1주차에서 생성한 미로를 읽어 화면에 그리는 GUI를 구성한다. 이를 위해 다음과 같은 항목들의 구현이 필요하다. 4 | \begin{itemize} 5 | \item 화면에 UI 요소를 그리는 로직 6 | \item 미로를 표현하기 위한 자료구조의 고안 7 | \end{itemize} 8 | 9 | 구현 3주차에는 미로 해결 알고리즘을 구현한다. 이를 위해 다음 알고리즘의 이해와 구현이 필요하다. 10 | \begin{itemize} 11 | \item 깊이 우선 탐색\translation{DFS} 12 | \item 너비 우선 탐색\translation{BFS} 13 | \end{itemize} -------------------------------------------------------------------------------- /project-maze/paper/report/inc-sections/2-2.tex: -------------------------------------------------------------------------------- 1 | \subsubsection{깊이 우선 탐색\translation{depth first search}} 깊이 우선 탐색, 또는 DFS는 그래프 탐색 방법의 일종이다. 2 | 3 | $N\left(u\right)$를 $u$와 인접한 노드들의 집합이라고 정의한다면, $N\left(u\right)$의 4 | 모든 원소 $v_i$에 대해 $N\left(v_i\right)$를 전부 방문한 후 $v_{i + 1}$을 방문하는 방식으로 동작한다. 5 | 이를 위해 스택을 사용한다. 6 | 7 | 간단히 말하자면, DFS는 진행 방향을 정하고 갈 수 있는 만큼 진행한 후 더 이상 진행할 수 없으면 (막다른 길을 마주하면) 8 | 이전 노드로 되돌아와 다른 경로로 진행하는 방식으로 동작한다. 이 때 이전 노드로 되돌아오는 것을 백트래킹\translation{backtracking}이라 한다. 9 | 시작점부터 종점까지의 경로를 성공적으로 찾았을 경우 DFS의 스택에는 그 경로가 저장되어 있다는 특징이 있다. 10 | 11 | DFS의 시간 복잡도는 그래프 $\left(V,\,E\right)$에 대해 인접 행렬로 표현된 그래프의 경우 $\mathcal{O}\left(V^2\right)$, 12 | 인접 리스트로 표현된 그래프의 경우 $\mathcal{O}\left(V+E\right)$를 보인다. 13 | 14 | \subsubsection{너비 우선 탐색\translation{breadth first search}} 너비 우선 탐색, 또는 BFS는 DFS와 마찬가지로 그래프 탐색 방법의 일종이다. 15 | 16 | BFS는 큐 $Q$에 첫 노드를 넣고, $Q$가 빌 때까지 $Q$의 첫 원소 $q$에 대해 $N\left(q\right)$ 중 아직 방문하지 않은 정점들을 전부 $Q$에 추가하면서 그래프를 탐색해 나간다. 17 | 다시 말하면 인접한 노드들부터 차례로 탐색해나가며, 트리의 경우 깊이가 얕은 노드부터 탐색해나간다. 이는 BFS가 시작점부터의 거리가 $n+1$인 정점을 방문했을 경우 18 | 시작점으로부터의 거리가 $n$인 정점은 이미 모두 방문했음을 의미하며, 간선의 가중치가 모두 같은 경우 이는 최단 경로를 찾는 데 쓰일 수 있다. 19 | 20 | BFS의 시간 복잡도는 그래프 $\left(V,\,E\right)$에 대해 인접 행렬로 표현된 그래프의 경우 마찬가지로 $\mathcal{O}\left(V^2\right)$, 21 | 인접 리스트로 표현된 그래프의 경우 $\mathcal{O}\left(V+E\right)$를 보인다. 22 | 23 | \subsubsection{재귀 백트래킹\translation{recursive backtracker}} 재귀 백트래킹은 완전 미로를 만드는 알고리즘 중 하나이다. 24 | 완전 미로는 최소 스패닝 트리\translation{minimum spanning tree}로 생각할 수 있는데, 이 점에서 착안해 미로의 모든 칸을 노드로 생각한다면 25 | 랜덤한 점에서 랜덤하게 MST를 만드는 식으로 완전 미로를 구성할 수 있다. 따라서 DFS를 응용해 MST를 구성하여 미로를 생성할 수 있다. -------------------------------------------------------------------------------- /project-maze/paper/report/inc-sections/2-3-week2.tex: -------------------------------------------------------------------------------- 1 | \subsubsection{2주차: 미로를 화면에 그리는 로직} 미로를 화면에 그리기 위해 미로를 2차원 동적 배열에 저장한다. 2 | 3 | 이 때 각 칸은 `$+$', `$-$', `$|$' 또는 `.'으로 구성되는데, `.'의 경우 길이 있음을, `$+$', `$-$', `$|$'의 경우 벽이 있음을 나타내므로 4 | 이에 따라 적절한 크기의 사각형을 적절한 위치에 그리면 될 것이다. 따라서 $rows \times cols$의 미로의 경우 직사각형을 $rows \times cols$번 그리는데, 5 | 지금 확인하는 칸이 `+'일 경우 작은 정사각형을, `-'일 경우 좌우로 긴 직사각형을, `$|$'일 경우 상하로 6 | 긴 직사각형을 적절한 위치에 그린다. 크기는 \texttt{WALL_WIDTH}와 \texttt{CELL_SIZE}에 미리 정의한다. 7 | 8 | $i$와 $j$가 홀수일 경우는 현재 확인하고 있는 칸은 원래 미로의 각 칸이 되는 경우이고 $i$ 혹은 $j$가 짝수일 경우는 원래 미로의 벽 혹은 통로가 되는 경우이다. 9 | 따라서 이 점을 이용해 직사각형을 그리기 시작하는 왼쪽 위 $x$ 좌표는 $i$에 대해 10 | \[\left(CELL\_SIZE \times \left\lfloor\frac{i}{2}\right\rfloor\right) + \left(WALL\_WIDTH \times \left\lceil\frac{i}{2}\right\rceil\right)\] 11 | 이고, 이는 $y$ 좌표에 대해서도 마찬가지이다. 직사각형을 그리는 작업이 상수 시간만큼 걸린다고 가정하면 미로를 그리는 데 소요되는 시간 복잡도는 $\mathcal{O}\left(rows \times cols\right)$ 12 | 이고 미로를 저장하는 공간 복잡도도 $\mathcal{O}\left(rows \times cols\right)$이다. 13 | 14 | 특히 `.' 칸들에만 정점이, 인접한 `.' 칸들 사이에만 간선이 있다고 생각하면 15 | 미로를 그래프처럼 생각하고 탐색할 수 있으므로 굳이 가로/세로 길을 계산해 저장할 필요가 없다. 16 | 17 | \subsubsection{2주차: 툴바에 버튼 추가} MFC API를 사용하여 툴바에 버튼을 추가한다. 프로젝트의 리소스는 \texttt{MFC_Main.rc}라는 파일이 관리하는데, 18 | 프로젝트의 \texttt{IDR\_MAINFRAME}에서 Event Handler Wizard를 이용해 메뉴를 추가할 수 있다. -------------------------------------------------------------------------------- /project-maze/paper/report/inc-sections/2-3-week3.tex: -------------------------------------------------------------------------------- 1 | \subsubsection{3주차: 그래프를 탐색하는 로직} 그래프를 DFS와 BFS 두 방법을 사용해 탐색한다. 2 | 3 | 배열의 좌상단 인덱스 $\left(0,\,0\right)$, 크기를 $n\times m$이라고 할 때, 미로의 시작점은 $\left(1,\,1\right)$이고, 4 | 종점은 $\left(n-2,\,m-2\right)$이고, 어떤 칸 $\left(x,\,y\right)$를 노드라고 생각할 때 그 노드에 연결된 노드들은 인접한 상하좌우 4칸, 즉 5 | $\left(x + 1,\,y\right)$, $\left(x - 1,\,y\right)$, $\left(x,\,y + 1\right)$, $\left(x,\,y - 1\right)$로 생각할 수 있다. 6 | 7 | 각 탐색 알고리즘의 구현은 다음과 같았다. 8 | 9 | \begin{itemize} 10 | \item \textbf{DFS} -- 스택 $S$를 정의한다. $S$에 첫 노드를 넣고, 11 | $S$의 첫 원소 $s$에 대해 $N\left(s\right)$ 중 아직 방문하지 않은 정점들을 전부 $S$에 추가하고, 12 | $S$의 첫 원소를 제거한다. 이를 $S$가 빌 때까지 반복한다. 13 | \item \textbf{BFS} -- 큐 $Q$를 정의한다. $Q$에 첫 노드를 넣고, 14 | $Q$의 첫 원소 $q$에 대해 $N\left(q\right)$ 중 아직 방문하지 않은 정점들을 전부 $Q$에 추가하고, 15 | $Q$의 첫 원소를 제거한다. 이를 $Q$가 빌 때까지 반복한다. 16 | \end{itemize} 17 | 18 | 세부적으로, $p=\left(p_x,\,p_y\right)$에 대해 19 | $N\left(p\right)=\left\{\left(p_x + 1,\,p_y\right),\,\left(p_x - 1,\,p_y\right),\,\left(p_x,\,p_y + 1\right),\,\left(p_x,\,p_y - 1\right)\right\}$ 20 | 으로 정의할 수 있다. 21 | 22 | 방문 여부를 체크하기 위한 $n\times m$ 배열을 따로 만들어 관리한다. 각각의 알고리즘에서 최악의 경우 스택이나 큐에 $n\times m$개의 원소가 들어가고 나온다. 23 | 따라서 각각 알고리즘의 공간 복잡도는 $\mathcal{O}\left(n\times m\right)$이며, 시간 복잡도도 마찬가지다. -------------------------------------------------------------------------------- /project-maze/paper/report/inc-sections/2-4.tex: -------------------------------------------------------------------------------- 1 | \textbf{2.3}에서 설명한 이론과 실제 코드를 비교하고 분석한다. 2 | 3 | 프로젝트에서 수정하여야 하는 주요 파일들은 다음과 같다. 4 | 5 | \begin{tabularx}{\linewidth}{l|X} 6 | 파일 이름 & 기능 \\ 7 | \hline 8 | generate_perfect_maze.c & 완전 미로를 생성하는 C 소스 \\ 9 | generate_imperfect_maze.c & 불완전 미로를 생성하는 C 소스 \\ 10 | \hline 11 | MFC_Main.rc & MFC 프로젝트에서 리소스들을 정의하고 있는 파일 \\ 12 | User Code/usercode.cpp & 미로를 읽고, DFS와 BFS를 진행하고, 화면에 그리는 등 핵심적인 로직이 들어가는 부분 \\ 13 | \end{tabularx} 14 | 15 | \subsubsection{미로 프로젝트 1주차} 1주차에 구현된 사항은 다음과 같다. 16 | 17 | \textbf{generate_perfect_maze.c}: 완전 미로를 생성한다. 이론의 의사 코드를 그대로 구현했다. 18 | 19 | \textbf{generate_imperfect_maze.c}: 완전 미로를 생성한다. 이론의 의사 코드를 그대로 구현했다. 20 | 21 | \subsubsection{미로 프로젝트 2주차} 2주차에 구현된 사항은 다음과 같다. 22 | 23 | \textbf{화면에 미로를 그리는 로직}: 의사 코드를 그대로 구현했으나, 실제 구현에서는 미로에 그레이디언트를 추가했다. 아래는 실제 구현된 코드이다. 24 | 25 | \begin{minted}[xleftmargin=\parindent,breaklines,linenos]{c++} 26 | static void drawBuffered(){ 27 | for (int i = 0; i < rows; i++) { 28 | int x = CELL_SIZE * (i / 2) + WALL_WIDTH * (i - i / 2); 29 | for (int j = 0; j < cols; j++) { 30 | int y = CELL_SIZE * (j / 2) + WALL_WIDTH * (j - j / 2); 31 | 32 | // this adds gradients just for fun 33 | double blend = (double) (i + j) / (rows + cols); 34 | COLORREF color = RGB( 35 | 0x00 * (1 - blend) + 0x9c * blend, 36 | 0xbc * (1 - blend) + 0x27 * blend, 37 | 0xd4 * (1 - blend) + 0xb0 * blend 38 | ); 39 | 40 | switch (field[i][j]) { 41 | case '+': 42 | DrawSolidBox_I(y, x, 43 | y + WALL_WIDTH, x + WALL_WIDTH, 44 | 0, color, color); 45 | break; 46 | case '-': 47 | DrawSolidBox_I(y, x, 48 | y + CELL_SIZE, x + WALL_WIDTH, 49 | 0, color, color); 50 | break; 51 | case '|': 52 | DrawSolidBox_I(y, x, 53 | y + WALL_WIDTH, x + CELL_SIZE, 54 | 0, color, color); 55 | break; 56 | } 57 | } 58 | } 59 | } 60 | \end{minted} 61 | 62 | \textbf{툴바에 메뉴와 버튼 추가}: Event Handler Wizard를 이용해 메뉴를 추가했으며, MFC_MainDoc.cpp의 코드에서는 다음과 같은 항목들이 추가되았다. 63 | 64 | \inputminted[xleftmargin=\parindent,linenos,firstline=31,lastline=40]{c++}{inc-sources/MainDoc.cpp} 65 | 66 | \subsubsection{미로 프로젝트 3주차} 3주차에 구현된 사항은 다음과 같다. 67 | 68 | \textbf{DFS/BFS}: 의사 코드를 그대로 구현했으나, 실제 구현에서는 방문한 경로를 저장하는 방식을 구체화하였다. 다음은 BFS에서 방문하는 경로를 저장하는 로직을 추가한 코드이다. 69 | 70 | \inputminted[xleftmargin=\parindent,linenos,firstline=323,lastline=358]{c++}{inc-sources/usercode.cpp} 71 | 72 | 위의 코드에서 \texttt{visited\_cells}, \texttt{prev\_cell}을 참조한다. 73 | 74 | 또한 최단 경로를 그리기 위해 \texttt{drawBuffered} 함수에 줄 186--251을 추가하였다. -------------------------------------------------------------------------------- /project-maze/paper/report/inc-sections/2-5.tex: -------------------------------------------------------------------------------- 1 | \begin{figure} 2 | \centering 3 | \includegraphics[width=0.6\textwidth]{inc-images/screenshot0} 4 | \caption{DFS 수행 스크린샷} 5 | \label{fig:dfs} 6 | \end{figure} 7 | 8 | \begin{figure} 9 | \centering 10 | \includegraphics[width=0.6\textwidth]{inc-images/screenshot1} 11 | \caption{BFS 수행 스크린샷} 12 | \label{fig:bfs} 13 | \end{figure} 14 | 15 | \newpage -------------------------------------------------------------------------------- /project-maze/paper/report/inc-sections/2-6.tex: -------------------------------------------------------------------------------- 1 | Figure \ref{fig:dfs}는 미로를 불러와 DFS로 미로를 해결했을 때의 스크린샷이다. 2 | 정상적으로 미로의 솔루션을 찾을 수 있었다. 3 | 4 | Figure \ref{fig:bfs}는 미로를 불러와 BFS로 미로를 해결했을 때의 스크린샷이다. 5 | 정상적으로 미로의 솔루션을 찾을 수 있었다. 6 | 7 | BFS로 찾은 뒤 DFS로 다시 찾으라고 명령했을 경우나 반대 순서로 명령했을 경우에도 제대로 동작하였으며, 새 파일을 열어 경로를 탐색했을 경우에도 잘 동작하였다. -------------------------------------------------------------------------------- /project-maze/paper/report/inc-sections/3-1.tex: -------------------------------------------------------------------------------- 1 | 이 프로젝트를 제작하는 데 사용된 시스템의 소프트웨어/하드웨어 정보는 다음과 같다. 2 | 3 | \begin{tabularx}{\linewidth}{l|X} 4 | 항목 & 값 \\ 5 | \hline 6 | 운영 체제 & Microsoft Windows Version 10.0.17763.557 \\ 7 | 아키텍쳐 & x86-64 \\ 8 | CPU & Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz \\ 9 | \hline 10 | IDE & Microsoft Visual Studio Community 2019 (Version 16.0.3) \\ 11 | & Microsoft .NET Framework 4.7.03190 \\ 12 | Platform Tools & Visual Studio 2019 (v142) \\ 13 | \end{tabularx} -------------------------------------------------------------------------------- /project-maze/paper/week12/maze-1-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/paper/week12/maze-1-post.pdf -------------------------------------------------------------------------------- /project-maze/paper/week12/maze-1-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/paper/week12/maze-1-pre.pdf -------------------------------------------------------------------------------- /project-maze/paper/week12/maze-1-pre.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | 3 | \begin{document} 4 | 5 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline PRJ-2 미로 프로젝트 1주차 예비 보고서} 6 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 7 | \institute{서강대학교 컴퓨터공학과} 8 | \maketitle 9 | 10 | \section{목적} 11 | 미로 게임을 위한 알고리즘과 자료구조를 이해한다. 12 | 13 | \section{문제} 14 | \subsection{미로 생성 알고리즘} 15 | 16 | 미로의 각 칸들을 정점이라고 생각하고, 인접 관계를 간선이라고 생각한다면, 미로는 그래프로 나타낼 수 있다, 여기서 완전 미로는 17 | 최소 비용 신장 트리\translation{minimum spanning tree}로 생각할 수 있다. 그래프에서 최소 비용 신장 트리를 만드는 18 | 알고리즘 중 하나로 프림 알고리즘\translation{Prim's algorithm}이 있다. 19 | 프림 알고리즘은 최단 경로 탐색 알고리즘인 데이크스트라 알고리즘\translation{Djikstra's algorithm}과 비슷한 20 | 방식으로 동작힌디. 21 | 22 | 임의의 노드를 골라 트리의 루트로 만들고, 그래프의 모든 변이 들어 있는 최소 힙 $Q$에 대해, 23 | 모든 노드가 트리에 포함되어 있지 않은 동안, 트리와 연결된 간선 가운데 트리 속의 두 꼭짓점을 연결하지 않는 가장 작은 간선을 트리에 추가한다. 24 | 이를 의사 코드로 나타내면 다음과 같다. 25 | 26 | \begin{codebox} 27 | \Procname{\proc{MST-Prim}($G$, $w$, $r$)} 28 | \li \For each $u \in G.V$ \Do 29 | \li $\attrib{u}{key} \gets \infty$ 30 | \li $\attrib{u}{\pi} \gets \const{null}$ 31 | \End 32 | \li $\attrib{r}{key} \gets 0$ 33 | \li $Q \gets \attrib{G}{V}$ 34 | \li \While $Q \neq \emptyset$ \Do 35 | \li $u \gets \proc{Extract-Min}(Q)$ 36 | \li \For each $v \in \attrib{G}{Adj}[u]$ \Do 37 | \li \If $v \in Q$ and $w(u,\,v) < \attrib{v}{key}$ \Then 38 | \li $\attrib{v}{\pi} \gets u$ 39 | \li $\attrib{v}{key} \gets w(u,\,v)$ 40 | \End 41 | \End 42 | \End 43 | \end{codebox} 44 | 45 | 하지만 이 프로젝트의 경우 간선들의 길이는 항상 1이므로, 최소 힙 등을 신경쓰지 않고도 알고리즘을 진행할 수 있겠다. 46 | 모든 노드가 트리에 포함되어 있지 않은 동안, 남아 있는 간선 중 트리와 연결된 간선 가운데 아무 간선이나 랜덤하게 골라서 추가하면 되는 것이다. 47 | 48 | $n\times m$의 격자를 그래프로 만들면 노드는 $n\times m$개, 간선은 $m\left(n - 1\right) + n\left(m - 1\right)$개이다. 49 | 모든 간선마다 한 꼭짓점은 트리에 포함되어 있고 다른 꼭지점은 아닌 간선을 하나 골라 트리에 추가하기만 하면 되므로 간선 개수만큼의 시간이 소요된다. 50 | 51 | 이렇게 얻은 최소 비용 신장 트리를 인접 리스트 자료구조로 저장한다고 가정하자. 트리의 노드는 $nm$개이므로 간선은 $nm - 1$개이다. 따라서 52 | 이 자료구조의 공간 복잡도는 $\mathcal{O}\left(nm\right)$이 된다. 53 | 54 | \end{document} 55 | -------------------------------------------------------------------------------- /project-maze/paper/week13/maze-2-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/paper/week13/maze-2-post.pdf -------------------------------------------------------------------------------- /project-maze/paper/week13/maze-2-post.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | \newcommand{\norm}[1]{\left\lVert#1\right\rVert} 3 | 4 | \begin{document} 5 | 6 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline PRJ-2 미로 프로젝트 2주차 결과 보고서} 7 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 8 | \institute{서강대학교 컴퓨터공학과} 9 | \maketitle 10 | 11 | \section{목적} 12 | 실습에서 구성한 자료 구조를 기술한다. 13 | 14 | \section{문제} 15 | 실습에서는 자료 구조의 구현으로 \mintinline{c++}{std::vector>}를 사용하였다. 빈 칸은 `.', 벽은 `+', `-', `$|$' 중 하나로 16 | 이루어진 2차원 배열이다. .maz 파일을 읽어들여 그대로 2차원 배열에 저장하는 방식이다. 17 | 18 | 자료 구조의 내용을 스크린에 그리는 코드는 다음과 같다. 19 | \begin{minted}[xleftmargin=\parindent,breaklines,linenos]{c++} 20 | for (int i = 0; i < rows; i++) { 21 | int x = CELL_SIZE * (i / 2) + WALL_WIDTH * (i - i / 2); 22 | for (int j = 0; j < cols; j++) { 23 | int y = CELL_SIZE * (j / 2) + WALL_WIDTH * (j - j / 2); 24 | 25 | // this adds gradients just for fun 26 | double blend = (double) (i + j) / (rows + cols); 27 | COLORREF color = RGB( 28 | 0x00 * (1 - blend) + 0x9c * blend, 29 | 0xbc * (1 - blend) + 0x27 * blend, 30 | 0xd4 * (1 - blend) + 0xb0 * blend 31 | ); 32 | 33 | switch (field[i][j]) { 34 | case '+': 35 | DrawSolidBox_I(y, x, 36 | y + WALL_WIDTH, x + WALL_WIDTH, 37 | 0, color, color); 38 | break; 39 | case '-': 40 | DrawSolidBox_I(y, x, 41 | y + CELL_SIZE, x + WALL_WIDTH, 42 | 0, color, color); 43 | break; 44 | case '|': 45 | DrawSolidBox_I(y, x, 46 | y + WALL_WIDTH, x + CELL_SIZE, 47 | 0, color, color); 48 | break; 49 | } 50 | } 51 | } 52 | \end{minted} 53 | 54 | 이는 직사각형을 $rows \times cols$번 그리는데, 지금 확인하는 칸이 `+'일 경우 작은 정사각형을, `-'일 경우 좌우로 긴 직사각형을, `$|$'일 경우 상하로 55 | 긴 직사각형을 적절한 위치에 그린다. 크기는 \texttt{WALL_WIDTH}와 \texttt{CELL_SIZE}에 정의되어 있다. 56 | 57 | $i$와 $j$가 홀수일 경우는 현재 확인하고 있는 칸은 원래 미로의 각 칸이 되는 경우이고 $i$ 혹은 $j$가 짝수일 경우는 원래 미로의 벽 혹은 통로가 되는 경우이다. 58 | 따라서 이 점을 이용해 직사각형을 그리기 시작하는 왼쪽 위 $x$ 좌표는 $i$에 대해 59 | \[\left(CELL\_SIZE \times \left\lfloor\frac{i}{2}\right\rfloor\right) + \left(WALL\_WIDTH \times \left\lceil\frac{i}{2}\right\rceil\right)\] 60 | 이고, 이는 $y$ 좌표에 대해서도 마찬가지이다. 직사각형을 그리는 작업이 상수 시간만큼 걸린다고 가정하면 미로를 그리는 데 소요되는 시간 복잡도는 $\mathcal{O}\left(rows \times cols\right)$ 61 | 이고 미로를 저장하는 공간 복잡도도 $\mathcal{O}\left(rows \times cols\right)$이다. 62 | 63 | 실험 전에 생각한 방법과 다르게 이렇게 구현하더라도 `.' 칸들에만 정점이, 인접한 `.' 칸들 사이에만 간선이 있다고 생각하면 64 | 미로를 그래프처럼 생각하고 탐색할 수 있으므로 굳이 가로/세로 길을 계산해 저장할 필요가 없다. 65 | 66 | \section{습득한 내용} 67 | MFC에서 리소스를 수정하여 메뉴 항목을 추가하거나 툴바 아이콘을 추가하는 방법을 알 수 있었다. 68 | 69 | \end{document} 70 | -------------------------------------------------------------------------------- /project-maze/paper/week13/maze-2-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/paper/week13/maze-2-pre.pdf -------------------------------------------------------------------------------- /project-maze/paper/week13/maze-2-pre.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | \newcommand{\norm}[1]{\left\lVert#1\right\rVert} 3 | 4 | \begin{document} 5 | 6 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline PRJ-2 미로 프로젝트 2주차 예비 보고서} 7 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 8 | \institute{서강대학교 컴퓨터공학과} 9 | \maketitle 10 | 11 | \section{목적} 12 | DFS와 BFS 알고리즘을 이해하고 미로 문제 해결에 어떻게 사용할 수 있을 것인지 보인다. 13 | 14 | \section{문제} 15 | \subsection{그래프 탐색 알고리즘} 16 | 17 | 너비 우선 탐색\translation{Breadth-First Search}과 깊이 우선 탐색\translation{Depth-First Search}는 그래프를 18 | 탐색하는 대표적인 알고리즘들이다. 19 | 20 | 어떤 노드 $u$와 인접한 노드들의 집합을 $N\left(u\right)$라고 하자. BFS는 큐 $Q$에 첫 노드를 넣고, 21 | $Q$가 빌 때까지 $Q$의 첫 원소 $q$에 대해 $N\left(q\right)$ 중 아직 방문하지 않은 정점들을 전부 $Q$에 추가하면서 그래프를 탐색해 나간다. 22 | 다시 말하면 인접한 노드들부터 차례로 탐색해나가며, 트리의 경우 깊이가 얕은 노드부터 탐색해나간다. 23 | 24 | DFS는 BFS와 반대의 전략을 취하는데, $N\left(u\right)$의 모든 원소 $v_i$에 대해 $N\left(v_i\right)$를 전부 방문한 후 $v_{i + 1}$을 25 | 방문하는 방식으로 동작한다. 이를 위해 스택을 사용한다. DFS는 한 방향으로 깊이 탐색하다가 더 이상 진행할 수 없으면 이전 노드로 되돌아와 다른 26 | 방향으로 탐색하는데, 이전 노드로 되돌아오는 것을 백트래킹\translation{backtracking}이라 한다. 27 | 28 | 인접 리스트로 표현된 그래프 $G = \left(V,\,E\right)$의 경우 각각의 방법의 시간 복잡도는 모두 $\mathcal{O}\left(\norm{V}+\norm{E}\right)$ 29 | 를 보인다. 30 | 31 | \subsection{미로 문제에의 적용} 32 | 33 | $h\times w$ 미로의 $\left(i,\,j\right)$에 위치한 셀을 $u_{ij}$라 하자. 그러면 $u$는 그래프의 노드로 생각할 수 있으며, 34 | 이웃한 노드는 최대 4개 -- $u_{\left(i - 1\right)j}$, $u_{\left(i + 1\right)j}$, 35 | $u_{i\left(j - 1\right)}$, $u_{i\left(j + 1\right)}$ -- 가 가능하다. 이는 미로의 가장자리에 있는 노드들을 제외하고 36 | 모두 동일하므로 간선 정보는 1주차에사 사용한 자료구조를 그대로 사용하고, 추가로 DFS/BFS의 수행을 위해 방문 순서와 여부를 저장하는 $h\times w$의 37 | 배열을 도입한다. 이 때 공간 복잡도는 $\mathcal{O}\left(h\times w\right)$가 된다. 38 | 또한 이 경우 두 알고리즘 공통적으로 현재 노드에서 인접한 4방향에 존재하는 노드 중 벽으로 막혀 있지 않으며 39 | 아직 방문하지 않은 노드를 쿼리하는 것은 단순히 2차원 배열의 원소에 4번 접근하는 것과 동일하다. 40 | 41 | \subsection{탐색 알고리즘의 구현 방법} 42 | 43 | \begin{itemize} 44 | \item \textbf{DFS} -- 인접한 노드를 방문하는 재귀함수 \proc{DFS}($u$)를 정의한다. $u$에 대해 45 | $v \in N\left(u\right)$마다, $v$를 아직 방문하지 않았다면 \proc{DFS}($v$)를 호출한다. 46 | \item \textbf{BFS} -- 큐 $Q$를 정의한다. 위에서 소개한 대로 $Q$에 첫 노드를 넣고, 47 | $Q$의 첫 원소 $q$에 대해 $N\left(q\right)$ 중 아직 방문하지 않은 정점들을 전부 $Q$에 추가하고, 48 | $Q$의 첫 원소를 제거한다. 이를 $Q$가 빌 때까지 반복한다. 49 | \end{itemize} 50 | 51 | \end{document} 52 | -------------------------------------------------------------------------------- /project-maze/paper/week14/maze-3-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/paper/week14/maze-3-post.pdf -------------------------------------------------------------------------------- /project-maze/paper/week14/maze-3-post.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | \newcommand{\norm}[1]{\left\lVert#1\right\rVert} 3 | 4 | \begin{document} 5 | 6 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline PRJ-2 미로 프로젝트 3주차 결과 보고서} 7 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 8 | \institute{서강대학교 컴퓨터공학과} 9 | \maketitle 10 | 11 | \section{목적} 12 | 작성한 알고리즘과 자료구조를 기술한다. 알고리즘의 시간 및 공간 복잡도를 보이고 실험 전에 생각한 방법과 어떻게 다른지 보인다. 13 | DFS, BFS 알고리즘 각각의 장단점을 비교하고, 설계한 자료구조에는 어떤 알고리즘이 더 적합한지 기술한다. 14 | 15 | \section{문제} 16 | 자료 구조의 구현으로 \mintinline{c++}{std::vector>}를 사용하였다. 빈 칸은 `.', 벽은 `+', `-', `$|$' 중 하나로 17 | 이루어진 2차원 배열이다. .maz 파일을 읽어들여 그대로 2차원 배열에 저장하는 방식이다. 18 | 19 | 배열의 좌상단 인덱스 $\left(0,\,0\right)$, 크기를 $n\times m$이라고 할 때, 미로의 시작점은 $\left(1,\,1\right)$이고, 20 | 종점은 $\left(n-2,\,m-2\right)$이고, 어떤 칸 $\left(x,\,y\right)$를 노드라고 생각할 때 그 노드에 연결된 노드들은 인접한 상하좌우 4칸, 즉 21 | $\left(x + 1,\,y\right)$, $\left(x - 1,\,y\right)$, $\left(x,\,y + 1\right)$, $\left(x,\,y - 1\right)$로 생각할 수 있다. 22 | 23 | 각 탐색 알고리즘의 구현은 다음과 같았다. 24 | 25 | \begin{itemize} 26 | \item \textbf{DFS} -- 스택 $S$를 정의한다. $S$에 첫 노드를 넣고, 27 | $S$의 첫 원소 $s$에 대해 $N\left(s\right)$ 중 아직 방문하지 않은 정점들을 전부 $S$에 추가하고, 28 | $S$의 첫 원소를 제거한다. 이를 $S$가 빌 때까지 반복한다. 29 | \item \textbf{BFS} -- 큐 $Q$를 정의한다. $Q$에 첫 노드를 넣고, 30 | $Q$의 첫 원소 $q$에 대해 $N\left(q\right)$ 중 아직 방문하지 않은 정점들을 전부 $Q$에 추가하고, 31 | $Q$의 첫 원소를 제거한다. 이를 $Q$가 빌 때까지 반복한다. 32 | \end{itemize} 33 | 34 | 세부적으로, $p=\left(p_x,\,p_y\right)$에 대해 35 | $N\left(p\right)=\left\{\left(p_x + 1,\,p_y\right),\,\left(p_x - 1,\,p_y\right),\,\left(p_x,\,p_y + 1\right),\,\left(p_x,\,p_y - 1\right)\right\}$ 36 | 으로 정의되었다. 37 | 38 | 방문 여부를 체크하기 위한 $n\times m$ 배열을 따로 만들어 관리했다. 각각의 알고리즘에서 최악의 경우 스택이나 큐에 $n\times m$개의 원소가 들어가고 나온다. 39 | 따라서 각각 알고리즘의 공간 복잡도는 $\mathcal{O}\left(n\times m\right)$이며, 시간 복잡도도 마찬가지다. 40 | 41 | 스택 자료구조로는 \mintinline{c++}{std::stack}, 큐 자료구조로는 \mintinline{c++}{std::queue}를 사용했다. 42 | 실험 전에 생각한 방법과 크게 달라진 점은 없었지만, 탐색 경로를 저장하기 위해 \texttt{std::pair}의 2차원 동적 배열을 만들었다. 43 | 이 배열의 각 칸은 그 칸에 도달하기 직전의 칸의 좌표를 저장하고 있다. 44 | 45 | \subsection{DFS와 BFS의 장단점} 46 | DFS를 할 경우 스택에 저장된 좌표들의 시퀀스는 항상 시작점부터 끝점까지의 경로를 구성함을 보장하지만 BFS의 경우 그렇지 않다. 47 | 반면 BFS는 시작점부터 끝점까지의 경로가 최단 거리임을 보장한다. 따라서 완전 미로를 해결해야 하는 경우 DFS가 효율적이겠으나, 48 | 시작점부터 끝점까지의 경로가 다수 존재하는 불완전 미로를 해결해야 하는 경우 DFS는 최단 거리를 보장하지는 못하므로 이 때는 BFS를 사용하는 것이 49 | 바람직하겠다. 다만 굳이 최단 경로가 필요하지 않고 공간 최적화가 중요하다면 BFS는 일반적으로 큐에 동시에 저장된 최대 원소 수가 DFS의 스택에서의 그것보다 크므로 50 | DFS를 쓰는 것이 좋겠다. 51 | 52 | \end{document} 53 | -------------------------------------------------------------------------------- /project-maze/paper/week14/maze-3-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-maze/paper/week14/maze-3-pre.pdf -------------------------------------------------------------------------------- /project-maze/paper/week14/maze-3-pre.tex: -------------------------------------------------------------------------------- 1 | \input{../../../header} 2 | \newcommand{\norm}[1]{\left\lVert#1\right\rVert} 3 | 4 | \begin{document} 5 | 6 | \title{CSE3013 (컴퓨터공학 설계 및 실험 I) \space \newline PRJ-2 미로 프로젝트 3주차 예비 보고서} 7 | \author{서강대학교 컴퓨터공학과 박수현 (20181634)} 8 | \institute{서강대학교 컴퓨터공학과} 9 | \maketitle 10 | 11 | \section{목적} 12 | DFS와 BFS 알고리즘의 시간 복잡도를 보이고 설계한 자료구조에서 각각의 알고리즘을 이용해 어떻게 경로를 찾을 수 있는지 보인다. 13 | 14 | \section{문제} 15 | \subsection{그래프 탐색 알고리즘의 시간 복잡도} 16 | 17 | 그래프 $G = \left(V,\,E\right)$가 있다고 하자. DFS와 BFS는 모두 모든 정점을 한 번씩만 방문하는 알고리즘이므로 정점을 방문하는 데에는 18 | $\mathcal{O}\left(\norm{V}\right)$가 소요된다. 또한 정점에 대해 인접한 정점을 쿼리해 진행해야 하는데, 인접한 정점을 쿼리하는 연산은 19 | 어느 자료 구조를 사용하느냐에 따라 시간 복잡도가 달라진다. 인접 리스트를 사용할 경우 인접한 정점을 쿼리하는 연산의 시간 복잡도는 20 | $\mathcal{O}\left(\norm{E}\right)$이고, 인접 행렬을 사용할 경우 각 노드마다 연결 여부를 체크해야 하므로 전체 시간 복잡도는 21 | $\mathcal{O}\left(\norm{V}^2\right)$이다. 22 | 23 | 따라서 전체 시간 복잡도는 인접 리스트의 경우 $\mathcal{O}\left(\norm{V}+\norm{E}\right)$이고 인접 행렬의 경우 24 | $\mathcal{O}\left(\norm{V}^2\right)$이다. 25 | 26 | \subsection{탐색 알고리즘의 구현 방법} 27 | 28 | \begin{itemize} 29 | \item \textbf{DFS} -- 스택 $S$를 정의한다. $S$에 첫 노드를 넣고, 30 | $S$의 첫 원소 $s$에 대해 $N\left(s\right)$ 중 아직 방문하지 않은 정점들을 전부 $S$에 추가하고, 31 | $S$의 첫 원소를 제거한다. 이를 $S$가 빌 때까지 반복한다. 32 | \item \textbf{BFS} -- 큐 $Q$를 정의한다. $Q$에 첫 노드를 넣고, 33 | $Q$의 첫 원소 $q$에 대해 $N\left(q\right)$ 중 아직 방문하지 않은 정점들을 전부 $Q$에 추가하고, 34 | $Q$의 첫 원소를 제거한다. 이를 $Q$가 빌 때까지 반복한다. 35 | \end{itemize} 36 | 37 | 구현한 자료구조의 크기가 $col \times row$라 히면, 가장자리는 모두 벽이므로 맨 왼쪽 위 칸을 $\left(0,\,0\right)$이라 할 때 38 | 첫 노드는 $\left(1,\,1\right)$이고 마지막 노드는 $\left(col - 2,\,row - 2\right)$이다. 인접한 노드는 인접한 4방향의 39 | 칸 중 통로(`.' 문자) 칸으로 정의한다. 40 | 41 | \end{document} 42 | -------------------------------------------------------------------------------- /project-tetris/README.md: -------------------------------------------------------------------------------- 1 | # 9-11주차: 테트리스 프로젝트 2 | 3 | - [코드](code) 4 | - [설계 보고서](paper/report/design-report.pdf) 5 | - [1주차 예비 보고서](paper/week09/tetris-1-pre.pdf) 6 | - [1주차 결과 보고서](paper/week09/tetris-1-post.pdf) 7 | - [2주차 예비 보고서](paper/week10/tetris-2-pre.pdf) 8 | - [2주차 결과 보고서](paper/week10/tetris-2-post.pdf) 9 | - [3주차 예비 보고서](paper/week11/tetris-3-pre.pdf) 10 | - [3주차 결과 보고서](paper/week11/tetris-3-post.pdf) -------------------------------------------------------------------------------- /project-tetris/code/decision_tree.c: -------------------------------------------------------------------------------- 1 | #include "decision_tree.h" 2 | #include 3 | 4 | decision_tree_node decision_tree_create() { 5 | decision_tree_node newNode = (decision_tree_node)malloc(sizeof(struct __decision_tree_node)); 6 | newNode->parent = NULL; 7 | newNode->children = (decision_tree_node *)malloc(0); 8 | newNode->children_size = 0; 9 | return newNode; 10 | } 11 | 12 | void decision_tree_destroy(decision_tree_node root) { 13 | for (int i = 0; i < root->children_size; i++) { 14 | if (root->children[i] == NULL) continue; 15 | decision_tree_destroy(root->children[i]); 16 | } 17 | free(root); 18 | } 19 | 20 | void decision_tree_add_child(decision_tree_node node, decision_tree_node child) { 21 | node->children = (decision_tree_node *)realloc(node->children, sizeof(decision_tree_node) * (node->children_size + 1)); 22 | node->children[node->children_size] = child; 23 | (node->children_size)++; 24 | } 25 | 26 | void decision_tree_node_swap(decision_tree_node *a, decision_tree_node *b) { 27 | decision_tree_node temp = *a; 28 | *a = *b; 29 | *b = temp; 30 | } 31 | 32 | void decision_tree_node_quicksort(decision_tree_node *array, int start, int end) { 33 | if (start >= end) 34 | return; 35 | 36 | int p = start, i = start, j = end; 37 | 38 | while (i < j) { 39 | while (array[i]->score.boardScore + array[i]->score.propagatedScore 40 | <= array[p]->score.boardScore + array[p]->score.propagatedScore && i < end) { 41 | i++; 42 | } 43 | while (array[j]->score.boardScore + array[j]->score.propagatedScore 44 | > array[p]->score.boardScore + array[p]->score.propagatedScore) { 45 | j--; 46 | } 47 | 48 | if (i < j) { 49 | decision_tree_node_swap(&array[i], &array[j]); 50 | } 51 | } 52 | 53 | decision_tree_node_swap(&array[p], &array[j]); 54 | 55 | decision_tree_node_quicksort(array, start, j - 1); 56 | decision_tree_node_quicksort(array, j + 1, end); 57 | } 58 | 59 | long long decision_tree_size(decision_tree_node root) { 60 | long long size = sizeof(*root); 61 | for (int i = 0; i < root->children_size; i++) { 62 | size += decision_tree_size(root->children[i]); 63 | } 64 | return size; 65 | } -------------------------------------------------------------------------------- /project-tetris/code/decision_tree.h: -------------------------------------------------------------------------------- 1 | #ifndef __DECISION_TREE_H__ 2 | #define __DECISION_TREE_H__ 3 | 4 | typedef struct __score_pair { 5 | long double boardScore, propagatedScore; 6 | } score_pair; 7 | 8 | struct __decision_tree_node { 9 | score_pair score; 10 | char field[22][10]; 11 | struct __decision_tree_node *parent; 12 | struct __decision_tree_node **children; 13 | int children_size; 14 | int curBlockID; 15 | int recBlockX, recBlockY, recBlockRotate; 16 | }; 17 | 18 | typedef struct __decision_tree_node* decision_tree_node; 19 | 20 | decision_tree_node decision_tree_create(); 21 | 22 | void decision_tree_destroy(decision_tree_node root); 23 | 24 | void decision_tree_add_child(decision_tree_node node, decision_tree_node child); 25 | 26 | void decision_tree_swap(decision_tree_node *a, decision_tree_node *b); 27 | 28 | void decision_tree_node_quicksort(decision_tree_node *array, int start, int end); 29 | 30 | long long decision_tree_size(decision_tree_node root); 31 | 32 | #endif // __DECISION_TREE_H__ 33 | -------------------------------------------------------------------------------- /project-tetris/code/makefile: -------------------------------------------------------------------------------- 1 | OBJECTS = ordered_list.o decision_tree.o queue.o tetris.o 2 | SRC = ordered_list.c decision_tree.c queue.c tetris.c 3 | 4 | CC = gcc 5 | CFLAGS = -g -ggdb 6 | 7 | TARGET = main 8 | 9 | $(TARGET): $(OBJECTS) ordered_list.h decision_tree.h queue.h tetris.h 10 | $(CC) -o $(TARGET) $(OBJECTS) -lncurses 11 | 12 | clean: 13 | rm $(OBJECTS) $(TARGET) 14 | 15 | -------------------------------------------------------------------------------- /project-tetris/code/ordered_list.h: -------------------------------------------------------------------------------- 1 | #ifndef __ORDERED_LIST_H__ 2 | #define __ORDERED_LIST_H__ 3 | 4 | enum __node_color { RED, BLACK, NULL_COLOR }; 5 | 6 | struct __bst_node { 7 | int score; 8 | int order; 9 | char *name; 10 | 11 | int size; 12 | enum __node_color color; 13 | struct __bst_node *parent; 14 | struct __bst_node *left; 15 | struct __bst_node *right; 16 | }; 17 | 18 | typedef struct __bst_node* ordered_list_node; 19 | 20 | struct __bst { 21 | ordered_list_node root; 22 | int size; 23 | unsigned int total_order; 24 | struct __bst_node null_node; 25 | }; 26 | 27 | typedef struct __bst* ordered_list; 28 | 29 | ordered_list newList(); 30 | 31 | int freeList(ordered_list list); 32 | 33 | ordered_list_node newEntry(int score, char *name); 34 | 35 | int orderedList_Insert(ordered_list list, ordered_list_node u); 36 | 37 | int orderedList_Delete(ordered_list list, int r); 38 | 39 | ordered_list_node *orderedList_Query(ordered_list list, int l, int r); 40 | 41 | int orderedList_indexOf(ordered_list list, ordered_list_node x); 42 | 43 | ordered_list_node orderedList_GetAt(ordered_list_node u, int i); 44 | 45 | #endif // __ORDERED_LIST_H__ 46 | -------------------------------------------------------------------------------- /project-tetris/code/queue.c: -------------------------------------------------------------------------------- 1 | #include "queue.h" 2 | #include 3 | 4 | queue queue_create() { 5 | queue q = (queue) malloc(sizeof(struct __queue)); 6 | q->front = NULL; 7 | q->rear = NULL; 8 | q->size = 0; 9 | return q; 10 | } 11 | 12 | void queue_emplace(queue q, triple value) { 13 | queue_node newNode = (queue_node) malloc(sizeof(struct __queue_node)); 14 | newNode->value = value; 15 | newNode->next = NULL; 16 | 17 | if (q->front == NULL) { 18 | q->front = newNode; 19 | q->rear = newNode; 20 | q->size = 1; 21 | } else { 22 | q->rear->next = newNode; 23 | q->rear = newNode; 24 | (q->size)++; 25 | } 26 | } 27 | 28 | triple queue_front(queue q) { 29 | if (q->size) return q->front->value; 30 | return (triple) {-1, -1, -1}; 31 | } 32 | 33 | void queue_pop(queue q) { 34 | if (q->front == NULL) return; 35 | if (q->front->next == NULL) { 36 | free(q->front); 37 | q->front = NULL; 38 | q->rear = NULL; 39 | q->size = 0; 40 | return; 41 | } 42 | 43 | queue_node temp = q->front->next; 44 | free(q->front); 45 | q->front = temp; 46 | (q->size)--; 47 | } 48 | 49 | void queue_destroy(queue q) { 50 | while (q->size) { 51 | queue_pop(q); 52 | } 53 | } -------------------------------------------------------------------------------- /project-tetris/code/queue.h: -------------------------------------------------------------------------------- 1 | #ifndef __QUEUE_H__ 2 | #define __QUEUE_H__ 3 | 4 | typedef struct __triple { 5 | int first, second, third; 6 | } triple; 7 | 8 | struct __queue_node { 9 | triple value; 10 | struct __queue_node *next; 11 | }; 12 | 13 | typedef struct __queue_node* queue_node; 14 | 15 | struct __queue { 16 | queue_node front; 17 | queue_node rear; 18 | int size; 19 | }; 20 | 21 | typedef struct __queue* queue; 22 | 23 | queue queue_create(); 24 | 25 | void queue_emplace(queue q, triple value); 26 | 27 | triple queue_front(queue q); 28 | 29 | void queue_pop(queue q); 30 | 31 | void queue_destroy(queue q); 32 | 33 | #endif // __QUEUE_H__ 34 | -------------------------------------------------------------------------------- /project-tetris/code/rank.txt: -------------------------------------------------------------------------------- 1 | 11 2 | Jacob 20340 3 | Park 17990 4 | shiftpsh 12550 5 | Kim 7430 6 | shiftpsh 670 7 | Jacob 620 8 | Chris 450 9 | shiftpsh 150 10 | shiftpsh 130 11 | shiftpsh 130 12 | shiftpsh 70 13 | -------------------------------------------------------------------------------- /project-tetris/paper/experiment-result.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/experiment-result.xlsx -------------------------------------------------------------------------------- /project-tetris/paper/report/design-report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/report/design-report.pdf -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-images/screenshot-best.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/report/inc-images/screenshot-best.png -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-images/screenshot0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/report/inc-images/screenshot0.png -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-images/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/report/inc-images/screenshot1.png -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-images/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/report/inc-images/screenshot2.png -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-images/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/report/inc-images/screenshot3.png -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-images/screenshot4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/report/inc-images/screenshot4.png -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sections/2-1.tex: -------------------------------------------------------------------------------- 1 | 구현 1주차에는 테트리스 로직을 구현한다. 기본적인 테트리스 로직 구현을 위해 다음과 같은 항목들의 구현이 필요하다. 2 | \begin{itemize} 3 | \item 블록이 필드의 특정 위치에 놓여질 수 있는지 판단하는 로직 4 | \item 시간이 지남에 따라 블록을 움직이고, 떨어뜨리고, 필드를 업데이트하는 로직 5 | \item 현재 블록의 그림자 위치를 계산하고 표시하는 로직 6 | \item 점수를 계산하는 로직 7 | \end{itemize} 8 | 9 | 구현 2주차에는 랭킹 시스템을 구현한다. 랭킹 시스템에는 다음과 같은 항목들의 구현이 필요하다. 10 | \begin{itemize} 11 | \item 랭킹 정보를 파일에 저장하고 읽어들이는 로직 12 | \item 새로운 랭킹 정보를 삽입하는 로직 13 | \item 존재하는 랭킹 정보를 삭제하는 로직 14 | \item 특정 범위 내의 랭킹을 쿼리하는 로직 15 | \item 특정 이름을 갖는 플레이어의 랭킹 정보를 쿼리하는 로직 16 | \end{itemize} 17 | 18 | 구현 3주차에는 추천 시스템을 구현한다. 추천 시스템에는 다음과 같은 항목들의 구현이 필요하다. 19 | \begin{itemize} 20 | \item 추천 위치를 계산하는 로직 21 | \item 컴퓨터가 자동으로 게임을 진행하는 로직 22 | \end{itemize} 23 | 24 | 추가로 추천 알고리즘을 개선하는 프로그램을 개발한다. -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sections/2-5.tex: -------------------------------------------------------------------------------- 1 | \begin{figure} 2 | \centering 3 | \includegraphics[width=0.6\textwidth]{inc-images/screenshot0} 4 | \caption{게임 플레이 화면 스크린샷} 5 | \label{fig:gameplay} 6 | \end{figure} 7 | 8 | \begin{figure} 9 | \centering 10 | \includegraphics[width=0.6\textwidth]{inc-images/screenshot1} 11 | \caption{게임 오버 스크린샷} 12 | \label{fig:gameover} 13 | \end{figure} 14 | 15 | \begin{figure} 16 | \centering 17 | \includegraphics[width=0.6\textwidth]{inc-images/screenshot2} 18 | \caption{게임 오버 이후 랭킹 스크린샷} 19 | \label{fig:endgame-results} 20 | \end{figure} 21 | 22 | \begin{figure} 23 | \centering 24 | \includegraphics[width=0.6\textwidth]{inc-images/screenshot3} 25 | \caption{랭킹 스크린샷} 26 | \label{fig:rankings} 27 | \end{figure} 28 | 29 | \begin{figure} 30 | \centering 31 | \includegraphics[width=0.6\textwidth]{inc-images/screenshot4} 32 | \caption{추천 플레이 스크린샷} 33 | \label{fig:recommend-play} 34 | \end{figure} 35 | 36 | \begin{figure} 37 | \centering 38 | \includegraphics[width=0.6\textwidth]{inc-images/screenshot-best} 39 | \caption{가장 오래 살아남은 추천 플레이 스크린샷} 40 | \label{fig:best-play} 41 | \end{figure} 42 | 43 | \newpage -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources-java/TetrisJNI.java: -------------------------------------------------------------------------------- 1 | package com.shiftpsh.tetris_ai; 2 | 3 | public class TetrisJNI { 4 | static { 5 | System.loadLibrary("tetris"); 6 | } 7 | 8 | private native String run(String[] constraints); 9 | 10 | public static String simulate(String[] args) { 11 | return new TetrisJNI().run(args); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources-java/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'c' 4 | id 'org.jetbrains.kotlin.jvm' version '1.3.11' 5 | } 6 | 7 | group 'com.shiftpsh' 8 | version '1.0-SNAPSHOT' 9 | 10 | sourceCompatibility = 1.8 11 | 12 | repositories { 13 | mavenCentral() 14 | } 15 | 16 | dependencies { 17 | compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8" 18 | compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1" 19 | testCompile group: 'junit', name: 'junit', version: '4.12' 20 | } 21 | 22 | compileKotlin { 23 | kotlinOptions.jvmTarget = "1.8" 24 | } 25 | compileTestKotlin { 26 | kotlinOptions.jvmTarget = "1.8" 27 | } 28 | 29 | jar { 30 | manifest { 31 | attributes 'Main-Class': 'com.shiftpsh.tetris_ai.MainKt' 32 | } 33 | from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } 34 | } -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources-java/constraints.kt: -------------------------------------------------------------------------------- 1 | package com.shiftpsh.tetris_ai 2 | 3 | import java.util.* 4 | 5 | data class Constraints( 6 | val constraints: List 7 | ) { 8 | override fun toString(): String { 9 | return constraints.map { "%.2f".format(it) }.joinToString(" ") 10 | } 11 | 12 | operator fun get(i: Int) = constraints[i] 13 | 14 | operator fun unaryMinus() = Constraints(constraints.map { -it }) 15 | 16 | operator fun plus(rhs: Constraints) = constraints.forEachIndexed { index, d -> d + rhs[index] } 17 | 18 | operator fun minus(rhs: Constraints) = this + (-rhs) 19 | 20 | operator fun times(rhs: Double) = Constraints(constraints.map { it * rhs }) 21 | 22 | operator fun div(rhs: Double) = this * (1 / rhs) 23 | 24 | fun gaussian(mean: Double, variance: Double): Double { 25 | return mean + (Random().nextGaussian() - 0.5) * variance 26 | } 27 | 28 | fun gaussianNeighbor(variance: Double): Constraints = Constraints(constraints.map { gaussian(it, variance) }) 29 | } 30 | 31 | operator fun Double.times(rhs: Constraints): Constraints { 32 | return rhs * this 33 | } -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources-java/main.kt: -------------------------------------------------------------------------------- 1 | package com.shiftpsh.tetris_ai 2 | 3 | import java.io.File 4 | import java.nio.charset.Charset 5 | import kotlin.random.Random 6 | 7 | 8 | 9 | fun execute(constraints: Constraints): Result { 10 | val resultRaw = TetrisJNI.simulate(constraints.toString().split(' ').toTypedArray()) 11 | return resultRaw 12 | .split('\n')[0] 13 | .split(' ') 14 | .map { it.toDouble() } 15 | .let { Result(it[0], it[1], it[2]) } 16 | } 17 | 18 | fun batch_execute(iterations: Int, constraints: Constraints): Result { 19 | val results = List(iterations) { execute(constraints) }.sortedBy { it.cost() } 20 | val truncated = results.subList(iterations / 8, 3 * iterations / 8) 21 | 22 | var average = Result(0.0, 0.0, 0.0) 23 | for (r in truncated) average += r 24 | return average / truncated.size.toDouble() 25 | } 26 | 27 | fun main() { 28 | var constraints = Constraints(List(18){0.0}) 29 | 30 | val k = 0.005 31 | 32 | var temperature = 1000.0 33 | println("Epoch 0: temperature = $temperature") 34 | println() 35 | 36 | var prevResult = batch_execute(16, constraints) 37 | 38 | val startTime = System.currentTimeMillis() 39 | while (temperature > 0.001) { 40 | val newConstraints = constraints.gaussianNeighbor(50.0) 41 | println("Epoch $i: temperature = $temperature") 42 | val currResult = batch_execute(16, newConstraints) 43 | 44 | val p = Math.pow(Math.E, (prevResult.cost() - currResult.cost()) / (temperature * k)) 45 | 46 | if (p > Random.nextDouble() || prevResult.cost() > currResult.cost()) { 47 | constraints = newConstraints 48 | prevResult = currResult 49 | temperature *= 0.995 50 | println("[v | %.3f%%] $currResult".format(Math.min(p * 100, 100.0))) 51 | } else { 52 | println("[x | %.3f%%] $currResult".format(Math.min(p * 100, 100.0))) 53 | } 54 | 55 | val endTime = System.currentTimeMillis() 56 | 57 | val s = ((endTime - startTime) / 1000).toDouble() 58 | val m = (s / 60).toLong() 59 | val h = (m / 60) 60 | println("Time elapsed: %02d h %02d m %.2f s".format(h, m % 60, s % 60.0)) 61 | println() 62 | } 63 | } -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources-java/result.kt: -------------------------------------------------------------------------------- 1 | package com.shiftpsh.tetris_ai 2 | 3 | data class Result( 4 | var score: Double, 5 | var drops: Double, 6 | var efficiency: Double 7 | ) { 8 | operator fun plus(rhs: Result) = Result( 9 | score + rhs.score, 10 | drops + rhs.drops, 11 | efficiency + rhs.efficiency 12 | ) 13 | operator fun div(rhs: Double) = Result( 14 | score / rhs, 15 | drops / rhs, 16 | efficiency / rhs 17 | ) 18 | fun cost(): Double = -(drops + efficiency * 10) 19 | } 20 | 21 | fun List.average(): Result { 22 | var sum = Result(0.0, 0.0, 0.0) 23 | val count = size.toDouble() 24 | forEach { sum += it / count } 25 | return sum 26 | } -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources/decision-tree.c: -------------------------------------------------------------------------------- 1 | #include "decision_tree.h" 2 | #include 3 | 4 | decision_tree_node decision_tree_create() { 5 | decision_tree_node newNode = (decision_tree_node)malloc(sizeof(struct __decision_tree_node)); 6 | newNode->parent = NULL; 7 | newNode->children = (decision_tree_node *)malloc(0); 8 | newNode->children_size = 0; 9 | return newNode; 10 | } 11 | 12 | void decision_tree_destroy(decision_tree_node root) { 13 | for (int i = 0; i < root->children_size; i++) { 14 | if (root->children[i] == NULL) continue; 15 | decision_tree_destroy(root->children[i]); 16 | } 17 | free(root); 18 | } 19 | 20 | void decision_tree_add_child(decision_tree_node node, decision_tree_node child) { 21 | node->children = (decision_tree_node *)realloc(node->children, sizeof(decision_tree_node) * (node->children_size + 1)); 22 | node->children[node->children_size] = child; 23 | (node->children_size)++; 24 | } 25 | 26 | void decision_tree_node_swap(decision_tree_node *a, decision_tree_node *b) { 27 | decision_tree_node temp = *a; 28 | *a = *b; 29 | *b = temp; 30 | } 31 | 32 | void decision_tree_node_quicksort(decision_tree_node *array, int start, int end) { 33 | if (start >= end) 34 | return; 35 | 36 | int p = start, i = start, j = end; 37 | 38 | while (i < j) { 39 | while (array[i]->score.boardScore + array[i]->score.propagatedScore 40 | <= array[p]->score.boardScore + array[p]->score.propagatedScore && i < end) { 41 | i++; 42 | } 43 | while (array[j]->score.boardScore + array[j]->score.propagatedScore 44 | > array[p]->score.boardScore + array[p]->score.propagatedScore) { 45 | j--; 46 | } 47 | 48 | if (i < j) { 49 | decision_tree_node_swap(&array[i], &array[j]); 50 | } 51 | } 52 | 53 | decision_tree_node_swap(&array[p], &array[j]); 54 | 55 | decision_tree_node_quicksort(array, start, j - 1); 56 | decision_tree_node_quicksort(array, j + 1, end); 57 | } 58 | 59 | long long decision_tree_size(decision_tree_node root) { 60 | long long size = sizeof(*root); 61 | for (int i = 0; i < root->children_size; i++) { 62 | size += decision_tree_size(root->children[i]); 63 | } 64 | return size; 65 | } -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources/decision-tree.h: -------------------------------------------------------------------------------- 1 | #ifndef __DECISION_TREE_H__ 2 | #define __DECISION_TREE_H__ 3 | 4 | typedef struct __score_pair { 5 | long double boardScore, propagatedScore; 6 | } score_pair; 7 | 8 | struct __decision_tree_node { 9 | score_pair score; 10 | char field[22][10]; 11 | struct __decision_tree_node *parent; 12 | struct __decision_tree_node **children; 13 | int children_size; 14 | int curBlockID; 15 | int recBlockX, recBlockY, recBlockRotate; 16 | }; 17 | 18 | typedef struct __decision_tree_node* decision_tree_node; 19 | 20 | decision_tree_node decision_tree_create(); 21 | 22 | void decision_tree_destroy(decision_tree_node root); 23 | 24 | void decision_tree_add_child(decision_tree_node node, decision_tree_node child); 25 | 26 | void decision_tree_swap(decision_tree_node *a, decision_tree_node *b); 27 | 28 | void decision_tree_node_quicksort(decision_tree_node *array, int start, int end); 29 | 30 | long long decision_tree_size(decision_tree_node root); 31 | 32 | #endif // __DECISION_TREE_H__ 33 | -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources/makefile: -------------------------------------------------------------------------------- 1 | OBJECTS = ordered_list.o decision_tree.o queue.o tetris.o 2 | SRC = ordered_list.c decision_tree.c queue.c tetris.c 3 | 4 | CC = gcc 5 | CFLAGS = -g -ggdb 6 | 7 | TARGET = main 8 | 9 | $(TARGET): $(OBJECTS) ordered_list.h decision_tree.h queue.h tetris.h 10 | $(CC) -o $(TARGET) $(OBJECTS) -lncurses 11 | 12 | clean: 13 | rm $(OBJECTS) $(TARGET) 14 | 15 | -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources/ordered-list.h: -------------------------------------------------------------------------------- 1 | #ifndef __ORDERED_LIST_H__ 2 | #define __ORDERED_LIST_H__ 3 | 4 | enum __node_color { RED, BLACK, NULL_COLOR }; 5 | 6 | struct __bst_node { 7 | int score; 8 | int order; 9 | char *name; 10 | 11 | int size; 12 | enum __node_color color; 13 | struct __bst_node *parent; 14 | struct __bst_node *left; 15 | struct __bst_node *right; 16 | }; 17 | 18 | typedef struct __bst_node* ordered_list_node; 19 | 20 | struct __bst { 21 | ordered_list_node root; 22 | int size; 23 | unsigned int total_order; 24 | struct __bst_node null_node; 25 | }; 26 | 27 | typedef struct __bst* ordered_list; 28 | 29 | ordered_list newList(); 30 | 31 | int freeList(ordered_list list); 32 | 33 | ordered_list_node newEntry(int score, char *name); 34 | 35 | int orderedList_Insert(ordered_list list, ordered_list_node u); 36 | 37 | int orderedList_Delete(ordered_list list, int r); 38 | 39 | ordered_list_node *orderedList_Query(ordered_list list, int l, int r); 40 | 41 | int orderedList_indexOf(ordered_list list, ordered_list_node x); 42 | 43 | ordered_list_node orderedList_GetAt(ordered_list_node u, int i); 44 | 45 | #endif // __ORDERED_LIST_H__ 46 | -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources/queue.c: -------------------------------------------------------------------------------- 1 | #include "queue.h" 2 | #include 3 | 4 | queue queue_create() { 5 | queue q = (queue) malloc(sizeof(struct __queue)); 6 | q->front = NULL; 7 | q->rear = NULL; 8 | q->size = 0; 9 | return q; 10 | } 11 | 12 | void queue_emplace(queue q, triple value) { 13 | queue_node newNode = (queue_node) malloc(sizeof(struct __queue_node)); 14 | newNode->value = value; 15 | newNode->next = NULL; 16 | 17 | if (q->front == NULL) { 18 | q->front = newNode; 19 | q->rear = newNode; 20 | q->size = 1; 21 | } else { 22 | q->rear->next = newNode; 23 | q->rear = newNode; 24 | (q->size)++; 25 | } 26 | } 27 | 28 | triple queue_front(queue q) { 29 | if (q->size) return q->front->value; 30 | return (triple) {-1, -1, -1}; 31 | } 32 | 33 | void queue_pop(queue q) { 34 | if (q->front == NULL) return; 35 | if (q->front->next == NULL) { 36 | free(q->front); 37 | q->front = NULL; 38 | q->rear = NULL; 39 | q->size = 0; 40 | return; 41 | } 42 | 43 | queue_node temp = q->front->next; 44 | free(q->front); 45 | q->front = temp; 46 | (q->size)--; 47 | } 48 | 49 | void queue_destroy(queue q) { 50 | while (q->size) { 51 | queue_pop(q); 52 | } 53 | } -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources/queue.h: -------------------------------------------------------------------------------- 1 | #ifndef __QUEUE_H__ 2 | #define __QUEUE_H__ 3 | 4 | typedef struct __triple { 5 | int first, second, third; 6 | } triple; 7 | 8 | struct __queue_node { 9 | triple value; 10 | struct __queue_node *next; 11 | }; 12 | 13 | typedef struct __queue_node* queue_node; 14 | 15 | struct __queue { 16 | queue_node front; 17 | queue_node rear; 18 | int size; 19 | }; 20 | 21 | typedef struct __queue* queue; 22 | 23 | queue queue_create(); 24 | 25 | void queue_emplace(queue q, triple value); 26 | 27 | triple queue_front(queue q); 28 | 29 | void queue_pop(queue q); 30 | 31 | void queue_destroy(queue q); 32 | 33 | #endif // __QUEUE_H__ 34 | -------------------------------------------------------------------------------- /project-tetris/paper/report/inc-sources/rank.txt: -------------------------------------------------------------------------------- 1 | 10 2 | Jacob 20340 3 | Park 17990 4 | shiftpsh 12550 5 | Kim 7430 6 | shiftpsh 670 7 | Jacob 620 8 | Chris 450 9 | shiftpsh 150 10 | shiftpsh 130 11 | shiftpsh 130 12 | -------------------------------------------------------------------------------- /project-tetris/paper/week09/images/colors256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/week09/images/colors256.png -------------------------------------------------------------------------------- /project-tetris/paper/week09/images/colors8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/week09/images/colors8.png -------------------------------------------------------------------------------- /project-tetris/paper/week09/tetris-1-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/week09/tetris-1-post.pdf -------------------------------------------------------------------------------- /project-tetris/paper/week09/tetris-1-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/week09/tetris-1-pre.pdf -------------------------------------------------------------------------------- /project-tetris/paper/week10/tetris-2-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/week10/tetris-2-post.pdf -------------------------------------------------------------------------------- /project-tetris/paper/week10/tetris-2-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/week10/tetris-2-pre.pdf -------------------------------------------------------------------------------- /project-tetris/paper/week11/tetris-3-post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/week11/tetris-3-post.pdf -------------------------------------------------------------------------------- /project-tetris/paper/week11/tetris-3-pre.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiftpsh/sgcs-cse3013/15525350eb71998d618046010c880eec4c03a708/project-tetris/paper/week11/tetris-3-pre.pdf --------------------------------------------------------------------------------