From e212c28a26eca28b4abe4a02524c9fc3bfd41d72 Mon Sep 17 00:00:00 2001 From: bradybod Date: Tue, 5 Nov 2019 14:41:39 -0700 Subject: [PATCH] adding hw 6 start --- .idea/misc.xml | 4 ++ .idea/vcs.xml | 6 +++ Hw6/CMakeLists.txt | 94 ++++++++++++++++++++++++++++++++++ Hw6/CMakeLists.txt.in | 15 ++++++ Hw6/LifeSimulator.cpp | 4 ++ Hw6/LifeSimulator.hpp | 8 +++ Hw6/Pattern.hpp | 8 +++ Hw6/PatternAcorn.cpp | 5 ++ Hw6/PatternAcorn.hpp | 8 +++ Hw6/PatternBlinker.cpp | 5 ++ Hw6/PatternBlinker.hpp | 8 +++ Hw6/PatternBlock.cpp | 5 ++ Hw6/PatternBlock.hpp | 8 +++ Hw6/PatternGlider.cpp | 5 ++ Hw6/PatternGlider.hpp | 8 +++ Hw6/PatternGosperGliderGun.cpp | 5 ++ Hw6/PatternGosperGliderGun.hpp | 8 +++ Hw6/RendererConsole.cpp | 5 ++ Hw6/RendererConsole.hpp | 8 +++ Hw6/_clang-format | 13 +++++ Hw6/main.cpp | 4 ++ 21 files changed, 234 insertions(+) create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml create mode 100644 Hw6/CMakeLists.txt create mode 100755 Hw6/CMakeLists.txt.in create mode 100644 Hw6/LifeSimulator.cpp create mode 100644 Hw6/LifeSimulator.hpp create mode 100644 Hw6/Pattern.hpp create mode 100644 Hw6/PatternAcorn.cpp create mode 100644 Hw6/PatternAcorn.hpp create mode 100644 Hw6/PatternBlinker.cpp create mode 100644 Hw6/PatternBlinker.hpp create mode 100644 Hw6/PatternBlock.cpp create mode 100644 Hw6/PatternBlock.hpp create mode 100644 Hw6/PatternGlider.cpp create mode 100644 Hw6/PatternGlider.hpp create mode 100644 Hw6/PatternGosperGliderGun.cpp create mode 100644 Hw6/PatternGosperGliderGun.hpp create mode 100644 Hw6/RendererConsole.cpp create mode 100644 Hw6/RendererConsole.hpp create mode 100644 Hw6/_clang-format create mode 100644 Hw6/main.cpp diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..79b3c94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Hw6/CMakeLists.txt b/Hw6/CMakeLists.txt new file mode 100644 index 0000000..7694853 --- /dev/null +++ b/Hw6/CMakeLists.txt @@ -0,0 +1,94 @@ +cmake_minimum_required(VERSION 3.14) +project(Hw5) + +set(CMAKE_CXX_STANDARD 17) + +# +# Manually specifying all the source files. +# +set(HEADER_FILES + WordTree.hpp + rlutil.h) +set(SOURCE_FILES + WordTree.cpp ) +set(UNIT_TEST_FILES + TestWordTree.cpp) + +add_executable(TypeAhead ${HEADER_FILES} ${SOURCE_FILES} main.cpp ) +add_executable(UnitTestRunner ${HEADER_FILES} ${SOURCE_FILES} ${UNIT_TEST_FILES}) + +# +# We want the C++ 17 standard for our project +# +set_property(TARGET TypeAhead PROPERTY CXX_STANDARD 17) +set_property(TARGET UnitTestRunner PROPERTY CXX_STANDARD 17) + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + target_compile_options(TypeAhead PRIVATE /W4 /permissive-) + target_compile_options(UnitTestRunner PRIVATE /W4 /permissive-) + set_target_properties(UnitTestRunner PROPERTIES LINK_FLAGS "/STACK:10000000") +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_options(TypeAhead PRIVATE -Wall -Wextra -pedantic -Wl,--stack,10000000 -O3) + target_compile_options(UnitTestRunner PRIVATE -Wall -Wextra -pedantic -Wl,--stack,10000000 -O3) +endif() +# +# Prepare a pre-build step to run clang-format over all the [ch]pp source files. +# Start by finding the location of the clang-format executable. +# +find_program(CLANG_FORMAT "clang-format") +if (CLANG_FORMAT) + # + # Need to take the simple source file locations used for the project and get their full + # file system locations for use in putting together the clang-format command line + # + unset(SOURCE_FILES_PATHS) + foreach(SOURCE_FILE ${HEADER_FILES} ${SOURCE_FILES} ${UNIT_TEST_FILES} main.cpp) + get_source_file_property(WHERE ${SOURCE_FILE} LOCATION) + set(SOURCE_FILES_PATHS ${SOURCE_FILES_PATHS} ${WHERE}) + endforeach() + + + # + # This creates the clang-format target/command + # + add_custom_target( + ClangFormat + COMMAND ${CLANG_FORMAT} + -i + -style=file + ${SOURCE_FILES_PATHS} + ) + # + # This makes the clang-format target a dependency of the main GoogleTestIntro project + # + add_dependencies(TypeAhead ClangFormat) +else() + message("Unable to find clang-format") +endif() + +configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt) +execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . + RESULT_VARIABLE result + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download ) +if(result) + message(FATAL_ERROR "CMake step for googletest failed: ${result}") +endif() +execute_process(COMMAND ${CMAKE_COMMAND} --build . + RESULT_VARIABLE result + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download ) +if(result) + message(FATAL_ERROR "Build step for googletest failed: ${result}") +endif() + +# Prevent overriding the parent project's compiler/linker +# settings on Windows +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + +# Add googletest directly to our build. This defines +# the gtest and gtest_main targets. +add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src + ${CMAKE_CURRENT_BINARY_DIR}/googletest-build + EXCLUDE_FROM_ALL) + +# Now simply link against gtest or gtest_main as needed. Eg +target_link_libraries(UnitTestRunner gtest_main) diff --git a/Hw6/CMakeLists.txt.in b/Hw6/CMakeLists.txt.in new file mode 100755 index 0000000..16d9939 --- /dev/null +++ b/Hw6/CMakeLists.txt.in @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.10) + +project(googletest-download NONE) + +include(ExternalProject) +ExternalProject_Add(googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG master + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) \ No newline at end of file diff --git a/Hw6/LifeSimulator.cpp b/Hw6/LifeSimulator.cpp new file mode 100644 index 0000000..56e5bd0 --- /dev/null +++ b/Hw6/LifeSimulator.cpp @@ -0,0 +1,4 @@ +// +// Created by Brady Bodily on 11/5/19. +// + diff --git a/Hw6/LifeSimulator.hpp b/Hw6/LifeSimulator.hpp new file mode 100644 index 0000000..9b00fc7 --- /dev/null +++ b/Hw6/LifeSimulator.hpp @@ -0,0 +1,8 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#ifndef CS3460_CPP_LIFESIMULATOR_HPP +#define CS3460_CPP_LIFESIMULATOR_HPP + +#endif //CS3460_CPP_LIFESIMULATOR_HPP diff --git a/Hw6/Pattern.hpp b/Hw6/Pattern.hpp new file mode 100644 index 0000000..bd65770 --- /dev/null +++ b/Hw6/Pattern.hpp @@ -0,0 +1,8 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#ifndef CS3460_CPP_PATTERN_HPP +#define CS3460_CPP_PATTERN_HPP + +#endif //CS3460_CPP_PATTERN_HPP diff --git a/Hw6/PatternAcorn.cpp b/Hw6/PatternAcorn.cpp new file mode 100644 index 0000000..70596f4 --- /dev/null +++ b/Hw6/PatternAcorn.cpp @@ -0,0 +1,5 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#include "PatternAcorn.hpp" diff --git a/Hw6/PatternAcorn.hpp b/Hw6/PatternAcorn.hpp new file mode 100644 index 0000000..d7c4c02 --- /dev/null +++ b/Hw6/PatternAcorn.hpp @@ -0,0 +1,8 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#ifndef CS3460_CPP_PATTERNACORN_HPP +#define CS3460_CPP_PATTERNACORN_HPP + +#endif //CS3460_CPP_PATTERNACORN_HPP diff --git a/Hw6/PatternBlinker.cpp b/Hw6/PatternBlinker.cpp new file mode 100644 index 0000000..97a1de8 --- /dev/null +++ b/Hw6/PatternBlinker.cpp @@ -0,0 +1,5 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#include "PatternBlinker.hpp" diff --git a/Hw6/PatternBlinker.hpp b/Hw6/PatternBlinker.hpp new file mode 100644 index 0000000..2a8a41d --- /dev/null +++ b/Hw6/PatternBlinker.hpp @@ -0,0 +1,8 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#ifndef CS3460_CPP_PATTERNBLINKER_HPP +#define CS3460_CPP_PATTERNBLINKER_HPP + +#endif //CS3460_CPP_PATTERNBLINKER_HPP diff --git a/Hw6/PatternBlock.cpp b/Hw6/PatternBlock.cpp new file mode 100644 index 0000000..d437649 --- /dev/null +++ b/Hw6/PatternBlock.cpp @@ -0,0 +1,5 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#include "PatternBlock.hpp" diff --git a/Hw6/PatternBlock.hpp b/Hw6/PatternBlock.hpp new file mode 100644 index 0000000..33617aa --- /dev/null +++ b/Hw6/PatternBlock.hpp @@ -0,0 +1,8 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#ifndef CS3460_CPP_PATTERNBLOCK_HPP +#define CS3460_CPP_PATTERNBLOCK_HPP + +#endif //CS3460_CPP_PATTERNBLOCK_HPP diff --git a/Hw6/PatternGlider.cpp b/Hw6/PatternGlider.cpp new file mode 100644 index 0000000..f42abcb --- /dev/null +++ b/Hw6/PatternGlider.cpp @@ -0,0 +1,5 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#include "PatternGlider.hpp" diff --git a/Hw6/PatternGlider.hpp b/Hw6/PatternGlider.hpp new file mode 100644 index 0000000..cfee49c --- /dev/null +++ b/Hw6/PatternGlider.hpp @@ -0,0 +1,8 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#ifndef CS3460_CPP_PATTERNGLIDER_HPP +#define CS3460_CPP_PATTERNGLIDER_HPP + +#endif //CS3460_CPP_PATTERNGLIDER_HPP diff --git a/Hw6/PatternGosperGliderGun.cpp b/Hw6/PatternGosperGliderGun.cpp new file mode 100644 index 0000000..f7cd0cb --- /dev/null +++ b/Hw6/PatternGosperGliderGun.cpp @@ -0,0 +1,5 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#include "PatternGosperGliderGun.hpp" diff --git a/Hw6/PatternGosperGliderGun.hpp b/Hw6/PatternGosperGliderGun.hpp new file mode 100644 index 0000000..214bc69 --- /dev/null +++ b/Hw6/PatternGosperGliderGun.hpp @@ -0,0 +1,8 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#ifndef CS3460_CPP_PATTERNGOSPERGLIDERGUN_HPP +#define CS3460_CPP_PATTERNGOSPERGLIDERGUN_HPP + +#endif //CS3460_CPP_PATTERNGOSPERGLIDERGUN_HPP diff --git a/Hw6/RendererConsole.cpp b/Hw6/RendererConsole.cpp new file mode 100644 index 0000000..563db2f --- /dev/null +++ b/Hw6/RendererConsole.cpp @@ -0,0 +1,5 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#include "RendererConsole.hpp" diff --git a/Hw6/RendererConsole.hpp b/Hw6/RendererConsole.hpp new file mode 100644 index 0000000..6707e29 --- /dev/null +++ b/Hw6/RendererConsole.hpp @@ -0,0 +1,8 @@ +// +// Created by Brady Bodily on 11/5/19. +// + +#ifndef CS3460_CPP_RENDERERCONSOLE_HPP +#define CS3460_CPP_RENDERERCONSOLE_HPP + +#endif //CS3460_CPP_RENDERERCONSOLE_HPP diff --git a/Hw6/_clang-format b/Hw6/_clang-format new file mode 100644 index 0000000..25743cc --- /dev/null +++ b/Hw6/_clang-format @@ -0,0 +1,13 @@ +Language: Cpp +ColumnLimit: 0 +BreakBeforeBraces : Allman +BreakConstructorInitializers: AfterColon +Cpp11BracedListStyle: true +IndentCaseLabels: true +NamespaceIndentation: All +IndentWidth: 4 +TabWidth: 4 +UseTab: Never +DerivePointerAlignment: false +PointerAlignment: Left +IncludeBlocks: Regroup \ No newline at end of file diff --git a/Hw6/main.cpp b/Hw6/main.cpp new file mode 100644 index 0000000..56e5bd0 --- /dev/null +++ b/Hw6/main.cpp @@ -0,0 +1,4 @@ +// +// Created by Brady Bodily on 11/5/19. +// +