Please submit on Canvas.
You can compare your code with the executable Alice in the lab directory.
UNIX> cd /home/plank/cs494/labs/Lab-0 UNIX> ./Alice 17 8 3 UNIX> ./Alice 5000 5000 30 UNIX> ./Alice 500000000000000000 500000000000000000 292893220 UNIX> time ./Alice 500000000000000000 500000000000000000 292893220 0.000u 0.000s 0:00.00 0.0% 0+0k 0+0io 0pf+0w UNIX>There is a shell script there named Alice-Test.sh. Alice-Test.sh should run in well under 1 second (mine runs in about 0.14 seconds), and the output of Alice-Test.sh should be identical to Alice-Answers.txt.
You are to write the program Board-Folding.cpp, which takes the grid on standard input as strings of 0's and 1's, and prints the answer on standard output. For example:
UNIX> pwd /home/jplank/classes/494/labs/Lab-0-SRM-639/public UNIX> cat Boards/TC0.txt 10 11 UNIX> ./Board-Folding < Boards/TC0.txt 1 UNIX> cat Boards/TC1.txt 1111111 1111111 UNIX> ./Board-Folding < Boards/TC1.txt 84 UNIX>You should implement the fastest variant in the presentation, where starting_places() is O(n2), and you are comparing integers rather than strings.
I have example boards in the directory Boards. They get as big as 3000x300.
Board-Timings.sh times the executable in ./Board-Folding against the boards in Boards. I have the file Board-Timings.txt, which contains the timings of my executable running on hydra3.eecs.utk.edu in January, 2024. Your timings on a hydra machine should be within a factor of two.
Here are examples:
UNIX> sh -c 'time ./Board-Folding < Boards/BF7.txt' 8994001 real 0m0.235s user 0m0.230s sys 0m0.004s UNIX> sh Board-Test.sh > ~/junk.txt UNIX> wc ~/junk.txt 63 63 333 /home/jplank/junk.txt UNIX> diff ~/junk.txt Board-Answers.txt UNIX> sh -c 'time sh Board-Test.sh > /dev/null' real 0m3.785s user 0m3.661s sys 0m0.110s UNIX>
Boards/TC0.txt
Boards/TC1.txt
Boards/TC2.txt
Boards/TC3.txt
Boards/TC4.txt
Boards/D001.txt
Boards/D002.txt
Boards/D003.txt
Boards/D004.txt
Boards/D005.txt
Boards/D006.txt
Boards/D007.txt
Boards/D008.txt
Boards/D009.txt
Boards/D010.txt
Boards/D011.txt
Boards/D012.txt
Boards/D013.txt
Boards/D014.txt
Boards/D015.txt
Boards/D016.txt
Boards/D017.txt
Boards/D018.txt
Boards/D019.txt
Boards/D020.txt
Boards/D021.txt
Boards/D022.txt
Boards/D023.txt
Boards/D024.txt
Boards/D025.txt
Boards/D026.txt
Boards/D027.txt
Boards/D028.txt
Boards/D029.txt
Boards/D030.txt
Boards/D031.txt
Boards/D032.txt
Boards/D033.txt
Boards/D034.txt
Boards/D035.txt
Boards/D036.txt
Boards/D037.txt
Boards/D038.txt
Boards/D039.txt
Boards/D040.txt
Boards/D041.txt
Boards/D042.txt
Boards/D043.txt
Boards/D044.txt
Boards/D045.txt
Boards/D046.txt
Boards/D047.txt
Boards/D048.txt
Boards/D049.txt
Boards/D050.txt
Boards/BF0.txt
Boards/BF1.txt
Boards/BF2.txt
Boards/BF3.txt
Boards/BF4.txt
Boards/BF5.txt
Boards/BF6.txt
Boards/BF7.txt