diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1ff0c42..0000000 --- a/.gitattributes +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################### -# Set default behavior to automatically normalize line endings. -############################################################################### -* text=auto - -############################################################################### -# Set default behavior for command prompt diff. -# -# This is need for earlier builds of msysgit that does not have it on by -# default for csharp files. -# Note: This is only used by command line -############################################################################### -#*.cs diff=csharp - -############################################################################### -# Set the merge driver for project and solution files -# -# Merging from the command prompt will add diff markers to the files if there -# are conflicts (Merging from VS is not affected by the settings below, in VS -# the diff markers are never inserted). Diff markers may cause the following -# file extensions to fail to load in VS. An alternative would be to treat -# these files as binary and thus will always conflict and require user -# intervention with every merge. To do so, just uncomment the entries below -############################################################################### -#*.sln merge=binary -#*.csproj merge=binary -#*.vbproj merge=binary -#*.vcxproj merge=binary -#*.vcproj merge=binary -#*.dbproj merge=binary -#*.fsproj merge=binary -#*.lsproj merge=binary -#*.wixproj merge=binary -#*.modelproj merge=binary -#*.sqlproj merge=binary -#*.wwaproj merge=binary - -############################################################################### -# behavior for image files -# -# image files are treated as binary by default. -############################################################################### -#*.jpg binary -#*.png binary -#*.gif binary - -############################################################################### -# diff behavior for common document formats -# -# Convert binary document formats to text before diffing them. This feature -# is only available from the command line. Turn it on by uncommenting the -# entries below. -############################################################################### -#*.doc diff=astextplain -#*.DOC diff=astextplain -#*.docx diff=astextplain -#*.DOCX diff=astextplain -#*.dot diff=astextplain -#*.DOT diff=astextplain -#*.pdf diff=astextplain -#*.PDF diff=astextplain -#*.rtf diff=astextplain -#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 3c4efe2..0000000 --- a/.gitignore +++ /dev/null @@ -1,261 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# DNX -project.lock.json -project.fragment.lock.json -artifacts/ - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings -# but database connection strings (with potential passwords) will be unencrypted -#*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/packages/repositories.config -# NuGet v3's project.json files produces more ignoreable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -node_modules/ -orleans.codegen.cs - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc \ No newline at end of file diff --git a/Bulls_Cows.sln b/Bulls_Cows.sln deleted file mode 100644 index 38f37c5..0000000 --- a/Bulls_Cows.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2047 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bulls_Cows", "Bulls_Cows\Bulls_Cows.vcxproj", "{7049A09E-1B9B-45CC-9C99-FBA0AE782B1C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7049A09E-1B9B-45CC-9C99-FBA0AE782B1C}.Debug|x64.ActiveCfg = Debug|x64 - {7049A09E-1B9B-45CC-9C99-FBA0AE782B1C}.Debug|x64.Build.0 = Debug|x64 - {7049A09E-1B9B-45CC-9C99-FBA0AE782B1C}.Debug|x86.ActiveCfg = Debug|Win32 - {7049A09E-1B9B-45CC-9C99-FBA0AE782B1C}.Debug|x86.Build.0 = Debug|Win32 - {7049A09E-1B9B-45CC-9C99-FBA0AE782B1C}.Release|x64.ActiveCfg = Release|x64 - {7049A09E-1B9B-45CC-9C99-FBA0AE782B1C}.Release|x64.Build.0 = Release|x64 - {7049A09E-1B9B-45CC-9C99-FBA0AE782B1C}.Release|x86.ActiveCfg = Release|Win32 - {7049A09E-1B9B-45CC-9C99-FBA0AE782B1C}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {9C3C4976-317A-41AA-A274-B65E872A8E59} - EndGlobalSection -EndGlobal diff --git a/Bulls_Cows/Bulls_Cows.cpp b/Bulls_Cows/Bulls_Cows.cpp deleted file mode 100644 index bbb2544..0000000 Binary files a/Bulls_Cows/Bulls_Cows.cpp and /dev/null differ diff --git a/Bulls_Cows/Bulls_Cows.vcxproj b/Bulls_Cows/Bulls_Cows.vcxproj deleted file mode 100644 index 224a352..0000000 --- a/Bulls_Cows/Bulls_Cows.vcxproj +++ /dev/null @@ -1,167 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {7049A09E-1B9B-45CC-9C99-FBA0AE782B1C} - Win32Proj - BullsCows - 10.0.17134.0 - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - true - - - false - - - false - - - - Use - Level3 - Disabled - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Use - Level3 - Disabled - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Use - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Use - Level3 - MaxSpeed - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - - - Create - Create - Create - Create - - - - - - \ No newline at end of file diff --git a/Bulls_Cows/Bulls_Cows.vcxproj.filters b/Bulls_Cows/Bulls_Cows.vcxproj.filters deleted file mode 100644 index a4a2d18..0000000 --- a/Bulls_Cows/Bulls_Cows.vcxproj.filters +++ /dev/null @@ -1,39 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/Bulls_Cows/FBullCowGame.cpp b/Bulls_Cows/FBullCowGame.cpp deleted file mode 100644 index a168cd1..0000000 --- a/Bulls_Cows/FBullCowGame.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "stdafx.h" -#include "FBullCowGame.h" -#include -#define TMap std::map -using int32 = int; - -FBullCowGame::FBullCowGame() { Reset(); } - - - -int32 FBullCowGame::GetCurrentTry() const { return MyCurrentTry; } - -int32 FBullCowGame::GetHiddenWordLength() const { return MyHiddenWord.length(); } - -bool FBullCowGame::IsGameWon() const { return BGameIsWon; } - -int32 FBullCowGame::GetMaxTries() const -{ - TMapwordlengthTOmaxtry{ {3,4},{4,5},{5,7},{6,8} }; - return wordlengthTOmaxtry[MyHiddenWord.length()]; - } - -void FBullCowGame::Reset() -{ - - const FString HIDDEN_WORD = "planet"; - MyHiddenWord = HIDDEN_WORD; - BGameIsWon = false; //condition for resetting the gamewon condtion to false - MyCurrentTry = 1; - - return; -} - - - - - -EGuessStatus FBullCowGame::CheckGuessValidity(FString guess) const -{ - //if guess is not an isogram - if (!IsIsogram(guess)) { - return EGuessStatus::Not_Isogram; - //return not an isogram - } - //if guess is not lowercase - else if (!IsLowerCase(guess)) { - //return not an lowercase - return EGuessStatus::Not_Lowercase; - } - //if guess is of wrong length - else if (guess.length() != GetHiddenWordLength()) { - //return wrong length - return EGuessStatus::Wrong_Length; - } - //otherwise - else { - //return ok - return EGuessStatus::OK; - } - - -} - - - -//recieve a valid guess and increment turn and return counts -FBullCowCount FBullCowGame::SubmitValidGuess(FString guess) -{ - - MyCurrentTry++; - FBullCowCount BullCowCount; - int32 WordLength = MyHiddenWord.length();//assuming same length as guess - - //loop through all letters in guess - for (int32 MHChar = 0; MHChar < WordLength; MHChar++) { - //compare the letters against the hidden word - for (int32 GChar = 0; GChar < WordLength; GChar++) { - //if guess letter is same as hidden word - if (guess[GChar] == MyHiddenWord[MHChar]) { - if (MHChar == GChar)//if they at same position - { - - BullCowCount.bull++;//the increase number of bulls - } - - else { - BullCowCount.cow++; //increase number of cows - } - - } - - } - } - if (BullCowCount.bull == WordLength) { - BGameIsWon = true; - } - else { - BGameIsWon = false; - } - return BullCowCount; -} - -bool FBullCowGame::IsIsogram(FString word) const -{ - if (word.length() <= 1) return true; - TMap LetterSeen; - for (auto letter : word) - { - letter = tolower(letter); - if (LetterSeen[letter]) - { - return false; - } - else - { - LetterSeen[letter]=true; - } - } - return true; -} - -bool FBullCowGame::IsLowerCase(FString word) const -{ - for (auto letter : word) - { - if (!islower(letter)) - { - return false; - } - } -} - diff --git a/Bulls_Cows/FBullCowGame.h b/Bulls_Cows/FBullCowGame.h deleted file mode 100644 index 4b9a05d..0000000 --- a/Bulls_Cows/FBullCowGame.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once -#include -using int32 = int; - -using FString = std::string; -struct FBullCowCount -{ - int32 bull = 0; - int32 cow = 0; - -}; -enum class EGuessStatus { - Invalid_Status, - OK, - Not_Isogram, - Wrong_Length, - Not_Lowercase -}; -class FBullCowGame { -public: - FBullCowGame();// constructor - int32 GetMaxTries() const; - int32 GetCurrentTry() const; - bool IsGameWon() const; - int32 GetHiddenWordLength() const; - EGuessStatus CheckGuessValidity(FString) const; //better return value required - - - void Reset(); //better return value required - //another method for counting the number of bulls and cows and increase try - FBullCowCount SubmitValidGuess(FString); - -//try not to work on private right now -private: - //look in the constructor for values - int32 MyCurrentTry; - - FString MyHiddenWord; - bool BGameIsWon; - bool IsIsogram(FString) const; - bool IsLowerCase(FString) const; -}; - diff --git a/Bulls_Cows/stdafx.cpp b/Bulls_Cows/stdafx.cpp deleted file mode 100644 index 7ef14e3..0000000 Binary files a/Bulls_Cows/stdafx.cpp and /dev/null differ diff --git a/Bulls_Cows/stdafx.h b/Bulls_Cows/stdafx.h deleted file mode 100644 index 94d4ed8..0000000 Binary files a/Bulls_Cows/stdafx.h and /dev/null differ diff --git a/Bulls_Cows/targetver.h b/Bulls_Cows/targetver.h deleted file mode 100644 index 567cd34..0000000 Binary files a/Bulls_Cows/targetver.h and /dev/null differ diff --git a/README.md b/README.md deleted file mode 100644 index 010a0af..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# solution -command line interface game coded in c++. -IN this game we have to guess an isogram