Add files via upload

This commit is contained in:
agsNeto20
2022-05-11 17:44:45 +02:00
committed by GitHub
commit e2ef1fa590
17 changed files with 2780 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
cboard.cpp \
cmvm.cpp \
cpvm.cpp \
cpvp.cpp \
main.cpp
HEADERS += \
cboard.h \
cmvm.h \
cpvm.h \
cpvp.h
+322
View File
@@ -0,0 +1,322 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.1, 2021-07-19T19:44:27. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{f2964861-1c07-4053-861d-2df923f4a88c}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value>
</valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
<value type="QString" key="ClangCodeModel.WarningConfigId">Builtin.BuildSystem</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">2</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5152.win64_mingw81_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\André Neto\Dropbox\Ines e Andre\EDA\Connect4\build-Connect4-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/André Neto/Dropbox/Ines e Andre/EDA/Connect4/build-Connect4-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\André Neto\Dropbox\Ines e Andre\EDA\Connect4\build-Connect4-Desktop_Qt_5_15_2_MinGW_64_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/André Neto/Dropbox/Ines e Andre/EDA/Connect4/build-Connect4-Desktop_Qt_5_15_2_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\André Neto\Dropbox\Ines e Andre\EDA\Connect4\build-Connect4-Desktop_Qt_5_15_2_MinGW_64_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/André Neto/Dropbox/Ines e Andre/EDA/Connect4/build-Connect4-Desktop_Qt_5_15_2_MinGW_64_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
<value type="QString">-e</value>
<value type="QString">cpu-cycles</value>
<value type="QString">--call-graph</value>
<value type="QString">dwarf,4096</value>
<value type="QString">-F</value>
<value type="QString">250</value>
</valuelist>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="QString" key="Analyzer.Valgrind.Callgrind.Arguments"></value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="QString" key="Analyzer.Valgrind.Memcheck.Arguments"></value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindArguments"></value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/André Neto/Dropbox/Ines e Andre/EDA/Connect4/Connect4/Connect4.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/André Neto/Dropbox/Ines e Andre/EDA/Connect4/Connect4/Connect4.pro</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/André Neto/Dropbox/Ines e Andre/EDA/Connect4/build-Connect4-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>
+322
View File
@@ -0,0 +1,322 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.15.1, 2021-06-19T14:47:29. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{8c2f6f0b-020e-4c89-9d71-737524f37114}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value>
</valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
<value type="QString" key="ClangCodeModel.WarningConfigId">Builtin.Questionable</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">4</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.2 MinGW 32-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.2 MinGW 32-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5152.win32_mingw81_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\Dropbox\Ines e Andre\EDA\Final\build-Connect4-Desktop_Qt_5_15_2_MinGW_32_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/Dropbox/Ines e Andre/EDA/Final/build-Connect4-Desktop_Qt_5_15_2_MinGW_32_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="int" key="RunSystemFunction">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\Dropbox\Ines e Andre\EDA\Final\build-Connect4-Desktop_Qt_5_15_2_MinGW_32_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/Dropbox/Ines e Andre/EDA/Final/build-Connect4-Desktop_Qt_5_15_2_MinGW_32_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="RunSystemFunction">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\Dropbox\Ines e Andre\EDA\Final\build-Connect4-Desktop_Qt_5_15_2_MinGW_32_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/Dropbox/Ines e Andre/EDA/Final/build-Connect4-Desktop_Qt_5_15_2_MinGW_32_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="RunSystemFunction">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
<value type="QString">-e</value>
<value type="QString">cpu-cycles</value>
<value type="QString">--call-graph</value>
<value type="QString">dwarf,4096</value>
<value type="QString">-F</value>
<value type="QString">250</value>
</valuelist>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Dropbox/Ines e Andre/EDA/Final/Connect4/Connect4.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Dropbox/Ines e Andre/EDA/Final/Connect4/Connect4.pro</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/Dropbox/Ines e Andre/EDA/Final/build-Connect4-Desktop_Qt_5_15_2_MinGW_32_bit-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>
+173
View File
@@ -0,0 +1,173 @@
#include "cboard.h"
//=============================================================================
CBoard::CBoard() // constructor
{
//Dynamically allocate memory for 3D array
boards = new char**[SIZE];
for (int s = 0; s < SIZE; s++){
boards[s] = new char*[MAX_R];
for (int r = 0; r < MAX_R; r++)
boards[s][r] = new char[MAX_C];
}
// assign value ' ' to the allocated memory
for (int s = 0; s < SIZE; s++)
for (int c = 0; c < MAX_C; c++)
for (int r = 0; r < MAX_R; r++)
boards[s][r][c] = ' ';
turn = 0;
}
CBoard::~CBoard() // destructor
{
// deallocate 3D array
for (int s = 0; s < SIZE; s++){
for (int r = 0; r < MAX_R; r++)
delete []boards[s][r];
delete []boards[s];
}
delete []boards;
}
//=============================================================================
// returns closest free (' ') row of col to the bottom, if not, -1
int CBoard::getRow(int col) const{
for(int r = MAX_R-1; r >= 0; r--)
if(boards[turn][r][col] == ' ')
return r;
return -1;
}
//=============================================================================
// puts player in the col and increments turn
void CBoard::playPiece(int col, char player) {
for(int r = 0; r < MAX_R; r++)
for(int c = 0; c < MAX_C; c++)
boards[turn+1][r][c] = boards[turn][r][c];
boards[++turn][getRow(col)][col] = player;
}
// undoes n turns
void CBoard::undoPiece(int undo){
turn -= undo;
}
// advances n turns
void CBoard::advancePiece(int adv){
turn += adv;
}
//=============================================================================
// gets the player who played on that col, checks for a win
bool CBoard::checkWin(int col, int num) const{
int row = getRow(col)+1;
char player = boards[turn][row][col];
// checks horizontal
for (int c = 0, count = 0; c < MAX_C; c++){
if (boards[turn][row][c] == player)
count ++;
else count = 0;
if (count == num)
return true;
}
// checks vertical
for (int r = 0, count = 0; r < MAX_R; r++){
if (boards[turn][r][col] == player)
count ++;
else count = 0;
if (count == num)
return true;
}
// checks diagonal NE
// left half
for(int i=3, count=0; i <= 5; i++, count=0)
for(int r=i, c=0; r >= 0; r--, c++){
if (boards[turn][r][c] == player) count++;
else count = 0;
if (count == num) return true;
}
// right half
for(int i=2, count=0; i >= 0; i--, count=0)
for(int r=i, c=6; r <= 5; r++, c--){
if (boards[turn][r][c] == player) count++;
else count = 0;
if (count == num) return true;
}
// checks diagonal SE
// left half
for(int i=3, count=0; i <= 5 ; i++, count=0)
for(int c=i, r=5; c >= 0 ; c--, r--){
if (boards[turn][r][c] == player) count++;
else count = 0;
if (count == num) return true;
}
// right half
for(int i=3, count=0; i > 0; i--, count=0)
for(int c=i, r=0; c <= 6 ; c++, r++){
if (boards[turn][r][c] == player) count++;
else count = 0;
if (count == num) return true;
}
return false;
}
// simulate a play and checks if it's a win
bool CBoard::simulateWin(int col, char player){
playPiece(col, player);
bool win = checkWin(col, 4);
undoPiece(1);
return win;
}
//=============================================================================
// prints board all fancy
void CBoard::printBoard() const{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 15);
cout << "| 1 | 2 | 3 | 4 | 5 | 6 | 7 |" << endl;
for(int r = 0; r < MAX_R; r++){
for(int c = 0; c < MAX_C; c++){
cout << "| ";
switch (boards[turn][r][c]){
case '0': SetConsoleTextAttribute(hConsole, 4); break;
case 'O': SetConsoleTextAttribute(hConsole, 6); break;
}
cout << boards[turn][r][c] << " ";
SetConsoleTextAttribute(hConsole, 15);
}
cout << "|" << endl;
}
}
// TODO
void CBoard::printBoardAdvanced() const{
for(int header = 0; header <= turn; header++)
cout << "| 1 | 2 | 3 | 4 | 5 | 6 | 7 | " ;
cout << endl;
for(int r = 0 ; r < MAX_R; r++){
for(int s = turn; s >= 0; s--){
for(int c = 0 ; c < MAX_C; c++)
cout << "| " << boards[s][r][c] << " ";
cout << "| ";
}
cout << endl;
}
cout << endl;
}
//=============================================================================
+39
View File
@@ -0,0 +1,39 @@
#include <iostream>
#include <cstring>
#include <windows.h>
using namespace std;
#ifndef CBOARD_H
#define CBOARD_H
class CBoard{
friend class CPvM;
friend class CPvP;
friend class CMvM;
private:
char ***boards;
int turn;
public:
constexpr static const int MAX_C = 7;
constexpr static const int MAX_R = 6;
constexpr static const int SIZE = MAX_R*MAX_C + 1;
CBoard();
~CBoard();
int getRow(int) const;
void playPiece(int,char);
void undoPiece(int);
void advancePiece(int);
bool checkWin(int,int) const;
bool simulateWin(int,char);
void printBoard() const;
void printBoardAdvanced() const;
};
#endif // CBOARD_H
+243
View File
@@ -0,0 +1,243 @@
#include "cmvm.h"
//=============================================================================
CMvM::CMvM(int dif1, int dif2, char starter) // constructor
{
board = new CBoard();
current_player = starter;
difficulty1 = dif1;
difficulty2 = dif2;
}
CMvM::~CMvM() // destructor
{ delete board; }
//=============================================================================
void CMvM::playGame() // main method
{
while(board->turn+1 < CBoard::SIZE){
showGame();
saveGame();
if(board->checkWin(computerMakePlay(),4))
break;
switchPlayer();
system("pause");
if(board->turn+1 == CBoard::SIZE)
current_player = 'T'; // tie/draw
}
clearFile();
showGame();
gameOver();
}
void CMvM::gameOver() // credits
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
switch (current_player) {
case '0':
SetConsoleTextAttribute(hConsole, 79);
cout << endl << "Red won!"; break;
case 'O':
SetConsoleTextAttribute(hConsole, 111);
cout << endl << "Yellow won!"; break;
case 'T': cout << endl << "It's a tie!";
}
SetConsoleTextAttribute(hConsole, 15);
cout << endl << endl << "THANKS FOR PLAYING!" << endl
<< "Game developed by:" << endl
<< "Ines Ferreira & Andre Neto" << endl << endl;
system("pause");
}
//=============================================================================
void CMvM::showGame() const // machine + difficulty + turn + board
{
system("cls");
switch(current_player){
case 'O':
cout << "Machine 1's turn ";
switch (difficulty1){
case 1: cout << "(Easy)"; break;
case 2: cout << "(Medium)"; break;
case 3: cout << "(Hard)"; break;
case 4: cout << "(Extreme)"; break;
}break;
case '0':
cout << "Machine 2's turn ";
switch (difficulty2){
case 1: cout << "(Easy)"; break;
case 2: cout << "(Medium)"; break;
case 3: cout << "(Hard)"; break;
case 4: cout << "(Extreme)"; break;
}break;
}
cout << endl << "Turn: " << board->turn << endl;
board->printBoard();
}
void CMvM::switchPlayer() // switches between players
{
if (current_player == 'O')
current_player = '0';
else
current_player = 'O';
}
int CMvM::computerMakePlay() // machine's turn
{
int play = -1;
int dif=0;
switch(current_player){
case 'O': dif=difficulty1;break;
case '0': dif=difficulty2;
}
switch (dif){
case 1: // easy
play = randomPlay();
break;
case 2: // medium
play = winNextPlay();
if (play == -1)
play = randomPlay();
break;
case 3: // hard
play = winNextPlay();
if (play == -1)
play = defendNextPlay();
if (play == -1)
play = randomPlay();
break;
case 4: // extreme
play = winNextPlay();
if (play == -1)
play = defendNextPlay();
if (play == -1)
play = bestPlay();
break;
}
board->playPiece(play, current_player);
return play;
}
//=============================================================================
int CMvM::randomPlay() // return a valid random play
{
int play;
do{
srand (time(NULL));
play = rand() % 7;
} while (board->getRow(play) == -1);
return play;
}
int CMvM::winNextPlay() // return winning play, if not -1
{
for (int col=0; col<CBoard::MAX_C; col++)
if(board->getRow(col) != -1)
if(board->simulateWin(col, '0'))
return col;
return -1;
}
int CMvM::defendNextPlay() // return defending play, if not -1
{
for (int col=0; col<CBoard::MAX_C; col++)
if(board->getRow(col) != -1)
if(board->simulateWin(col, 'O'))
return col;
return -1;
}
int CMvM::bestPlay(){
int score[7] = {0,0,0,0,0,0,0};
for (int col = 0; col < CBoard::MAX_C; col++){
if (board->getRow(col) != -1){
board->playPiece(col, '0');
if (col == 0 || col == 6) score[col]--;
if (col == 2 || col == 4) score[col]++;
if (col == 3) score[col] += 2;
for (int s = 2; s < 4; s++)
score[col] += s*board->checkWin(col,s);
board->undoPiece(1);
}
}
int max = score[0];
int maxIndex = 0;
for (int i = 1; i < 7; i++) {
if (score[i] > max) {
maxIndex = i;
max = score[i];
}
}
return maxIndex;
}
//=============================================================================
void CMvM::saveGame() const // saves game in case of unexpected shutdown
{
ofstream WriteFile("savedgame_mvm.txt");
for (int t = 0; t < CBoard::SIZE; t++)
for (int r = 0; r < CBoard::MAX_R; r++)
for (int c = 0; c < CBoard::MAX_C; c++)
WriteFile << board->boards[t][r][c];
WriteFile << endl << board->turn
<< endl << current_player
<< endl << difficulty1
<< endl << difficulty2;
WriteFile.close();
}
void CMvM::clearFile () const // clears saved game after its over
{
ofstream MyFile("savedgame_mvm.txt");
MyFile.close();
}
bool CMvM::loadGame() // resume game, returns false if there is no game to resume
{
ifstream MyReadFile("savedgame_mvm.txt");
if(MyReadFile.peek() == ifstream::traits_type::eof())
return false; // checks if its empty
string tmpString;
getline(MyReadFile, tmpString); // gets board
int i = 0;
for(int t = 0; t < CBoard::SIZE; t++)
for(int r = 0; r < CBoard::MAX_R; r++)
for(int c = 0; c < CBoard::MAX_C; c++)
board->boards[t][r][c] = tmpString[i++];
getline(MyReadFile, tmpString); // gets turn
board->turn = stoi(tmpString);
getline(MyReadFile, tmpString); // gets current_player
current_player = tmpString[0];
getline(MyReadFile, tmpString); // gets player name1
difficulty1 = stoi(tmpString);
getline(MyReadFile, tmpString); // gets player name2
difficulty2 = stoi(tmpString);
MyReadFile.close();
return true; // successful
}
//=============================================================================
+47
View File
@@ -0,0 +1,47 @@
#include <iostream>
#include <fstream>
#include <ctime>
#ifndef CMVM_H
#define CMVM_H
#include "cboard.h"
using namespace std;
class CMvM
{
private:
CBoard *board;
char current_player;
int difficulty1;
int difficulty2;
public:
CMvM(int = 1, int = 1, char = 'O');
~CMvM();
// GAME
void playGame(); // main method
void gameOver(); // roll the credits
void showGame() const; // show game events
void switchPlayer(); // switch between players
// PLAYERS MECHANINCS
int computerMakePlay();
// ALGORITHMS
int randomPlay(); // returns random play
int winNextPlay(); // returns next win move, if not, -1
int defendNextPlay() ; // returns next defensive move, if not, -1
int bestPlay(); // returns the best play possible
// FILES
void saveGame() const; // saves game into file
bool loadGame(); // loads game from file (if any)
void clearFile() const; // clears file
};
#endif // CMVM_H
+364
View File
@@ -0,0 +1,364 @@
#include "cpvm.h"
//=============================================================================
CPvM::CPvM(string name, int dif, char starter) // constructor
{
board = new CBoard();
current_player = starter;
player_name = name;
difficulty = dif;
}
CPvM::~CPvM() // destructor
{ delete board; }
//=============================================================================
void CPvM::playGame() // main method
{
while(board->turn+1 < board->SIZE){
showGame();
saveGame();
if(board->checkWin(makePlay(),4))
break;
switchPlayer();
if(board->turn+1 == board->SIZE)
current_player = 'T'; // tie/draw
}
clearFile();
showGame();
gameOver();
}
void CPvM::gameOver() // credits
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
switch (current_player) {
case '0':
SetConsoleTextAttribute(hConsole, 79);
cout << endl << "Red won!";
saveScore(false); break;
case 'O':
SetConsoleTextAttribute(hConsole, 111);
cout << endl << "Yellow won!";
saveScore(true); break;
case 'T': cout << endl << "It's a tie!";
}
SetConsoleTextAttribute(hConsole, 15);
cout << endl << endl << "THANKS FOR PLAYING!" << endl
<< "Game developed by:" << endl
<< "Ines Ferreira & Andre Neto" << endl << endl;
system("pause");
}
void CPvM::showGame() const // shows player + turn + board
{
system("cls");
cout << "Difficulty: ";
switch (difficulty) {
case 1: cout << "Easy"; break;
case 2: cout << "Medium"; break;
case 3: cout << "Hard"; break;
case 4: cout << "Extreme"; break;
}
cout << endl << "Turn " << board->turn << endl;
board->printBoard();
}
void CPvM::switchPlayer() // switches between players
{
if (current_player == 'O')
current_player = '0';
else
current_player = 'O';
}
//=============================================================================
int CPvM::makePlay() // decides who makes the play
{
int play;
switch (current_player){
case 'O': play = playerMakePlay(); break;
case '0': play = computerMakePlay(); break;
}
board->playPiece(play, current_player);
return play;
}
int CPvM::playerMakePlay() // player's turn
{
int play;
char cplay;
int t = board->turn;
do{
cout << "Pick a collumn [1..7]: ";
cin >> cplay;
if (cplay == '-'){
if(board->turn >= 2){
board->undoPiece(2);
showGame();
}
}
if (cplay == '+'){
if(board->turn < t){
board->advancePiece(2);
showGame();
}
}
if (cplay == '0'){
exit(0);
}
play = (int)cplay - 48 - 1;
}while (play >= CBoard::MAX_C || play < 0 || board->getRow(play) == -1);
return play;
}
int CPvM::computerMakePlay() // machine's turn
{
int play = -1;
switch (difficulty){
case 1: // easy
play = randomPlay();
break;
case 2: // medium
play = winNextPlay();
break;
case 3: // hard
play = winNextPlay();
if (play == -1)
play = defendNextPlay();
if (play == -1)
play = randomPlay();
break;
case 4: // extreme
play = winNextPlay();
if (play == -1)
play = defendNextPlay();
if (play == -1)
play = bestPlay();
break;
}
return play;
}
//=============================================================================
int CPvM::randomPlay() // return a valid random play
{
int play;
do{
srand (time(NULL));
play = rand() % 7;
} while (board->getRow(play) == -1);
return play;
}
int CPvM::winNextPlay() // return winning play, if not -1
{
for (int col=0; col<CBoard::MAX_C; col++)
if(board->getRow(col) != -1)
if(board->simulateWin(col, '0'))
return col;
return -1;
}
int CPvM::defendNextPlay() // return defending play, if not -1
{
for (int col=0; col<CBoard::MAX_C; col++)
if(board->getRow(col) != -1)
if(board->simulateWin(col, 'O'))
return col;
return -1;
}
int CPvM::bestPlay(){
int score[7] = {0,0,0,0,0,0,0};
for (int col = 0; col < CBoard::MAX_C; col++){
if (board->getRow(col) != -1){
board->playPiece(col, '0');
if (col == 0 || col == 6) score[col] -= 3;
if (col == 1 || col == 5) score[col] -= 2;
if (col == 2 || col == 4) score[col] += 0;
if (col == 3) score[col] += 1;
for (int s = 1; s < 4; s++)
score[col] += s*board->checkWin(col,s);
board->undoPiece(1);
}
}
int max = score[0];
int maxIndex = 0;
for (int i = 1; i < 7; i++) {
if (score[i] > max) {
maxIndex = i;
max = score[i];
}
}
return maxIndex;
}
//=============================================================================
void CPvM::saveGame() const // saves game in case of unexpected shutdown
{
ofstream WriteFile("savedgame_pvm.txt");
for (int t = 0; t < CBoard::SIZE; t++)
for (int r = 0; r < CBoard::MAX_R; r++)
for (int c = 0; c < CBoard::MAX_C; c++)
WriteFile << board->boards[t][r][c];
WriteFile << endl << board->turn
<< endl << current_player
<< endl << player_name
<< endl << difficulty;
WriteFile.close();
}
void CPvM::clearFile () const // clears saved game after its over
{
ofstream MyFile("savedgame_pvm.txt");
MyFile.close();
}
bool CPvM::loadGame() // resume game, return false if no game to resume
{
ifstream MyReadFile("savedgame_pvm.txt");
if(MyReadFile.peek() == ifstream::traits_type::eof())
return false; // checks if its empty
string tmpString;
getline(MyReadFile, tmpString); // gets board
int i = 0;
for(int t = 0; t < CBoard::SIZE; t++)
for(int r = 0; r < CBoard::MAX_R; r++)
for(int c = 0; c < CBoard::MAX_C; c++)
board->boards[t][r][c] = tmpString[i++];
getline(MyReadFile, tmpString); // gets turn
board->turn = stoi(tmpString);
getline(MyReadFile, tmpString); // gets current_player
current_player = tmpString[0];
getline(MyReadFile, tmpString); // gets player
player_name = tmpString;
getline(MyReadFile, tmpString); // gets difficulty
difficulty = stoi(tmpString);
MyReadFile.close();
return true; // successful
}
//=============================================================================
struct CPvM::stats // struct to recieve all stats from file
{
string name;
int win;
int loss;
};
void CPvM::swap(stats *xp, stats *yp)
{
stats temp = *xp;
*xp = *yp;
*yp = temp;
}
void CPvM::selectionSort(stats arr[], int n) // score = wins - losses
{
for(int i = 0; i < n-1; i++){
int min_idx = i;
for (int j = i+1; j < n; j++)
if ((arr[j].win - arr[j].loss) > (arr[min_idx].win - arr[min_idx].loss))
min_idx = j;
swap(&arr[min_idx], &arr[i]);
}
}
void CPvM::saveScore(bool is_win) // saves player score to leaderboards
{
ifstream ReadFile("leaderboard_pvm.txt");
string line;
int total=0;
getline(ReadFile, line);
if(ReadFile.peek() == ifstream::traits_type::eof()){}
//total = 0; // checks if its empty
else
total = stoi (line); // total number of players registred
stats all[total+1];
all[total].win = 0;
all[total].loss = 0;
int found = -1;
// from file to struct stats
for (int i = 0; i < total; i++){
getline(ReadFile, line);
all[i].name = line;
getline(ReadFile, line);
all[i].win = stoi(line);
getline(ReadFile, line);
all[i].loss = stoi(line);
//ReadFile >> all[i].win >> all[i].loss;
// searches for player name in files
if (all[i].name == player_name)
found = i;
}
ReadFile.close();
// if player name already exists
if (found != -1){
if (is_win) all[found].win++;
else all[found].loss++;
}
// if player name doesn't exists
else {
all[total].name = player_name;
if (is_win) all[total].win++;
else all[total].loss++;
total++;
}
selectionSort(all, total);
// put ordered leaderboard in file
ofstream WriteFile("leaderboard_pvm.txt");
WriteFile << total;
for(int i = 0; i < total; i++)
WriteFile << endl << all[i].name << endl << all[i].win << endl << all[i].loss;
WriteFile.close();
}
void CPvM::leaderboard() const // show top 10
{
string line;
ifstream ReadFile("leaderboard_pvm.txt");
if(ReadFile.peek() == ifstream::traits_type::eof())
return; // checks if its empty
getline(ReadFile, line);
int n_players, total_players = stoi (line);
if (total_players < 10) n_players = total_players;
else n_players = 10;
cout << " --PLAYER VS MACHINE LEADERBOARD--" << endl << endl;
cout << "Top 10" << setw(20) << "Name" << setw(10) << "Wins" << setw(10) << "Losses" << endl;
for (int i = 0; i < n_players; i++){
getline(ReadFile, line);
cout << setw(6) << i+1 << setw(20) << line;
getline(ReadFile, line);
cout << setw(10) << line;
getline(ReadFile, line);
cout << setw(10) << line << endl;
}
cout << endl;
ReadFile.close();
}
//=============================================================================
+52
View File
@@ -0,0 +1,52 @@
#include <iostream>
#include <fstream>
#include <iomanip>
#include <ctime>
#ifndef CPVM_H
#define CPVM_H
#include "cboard.h"
using namespace std;
class CPvM
{
private:
CBoard *board;
string player_name;
char current_player;
int difficulty;
public:
CPvM(string = "Guest", int = 1, char = 'O');
~CPvM();
// GAME
void playGame(); // main method
void gameOver(); // roll the credits
void showGame() const; // show game events
void switchPlayer(); // switch between players
// PLAYERS MECHANINCS
int makePlay(); // calls playerMakePlay() or computerMakePlay()
int playerMakePlay(); // returns & plays a valid move from player
int computerMakePlay(); // returns & plays a valid move from computer
// ALGORITHMS
int randomPlay(); // returns random play
int winNextPlay(); // returns next win move, if not, -1
int defendNextPlay(); // returns next defensive move, if not, -1
int bestPlay(); // returns the best play possible
// FILES
void saveGame()const; // saves game into file
void clearFile() const; // clears file
bool loadGame(); // loads game from file (if any)
struct stats;
void swap(stats *, stats *);
void selectionSort(stats [], int);
void saveScore(bool);
void leaderboard() const;};
#endif // CPVM_H
+271
View File
@@ -0,0 +1,271 @@
#include "cpvp.h"
//=============================================================================
CPvP::CPvP(string name1, string name2, char starter) // constructor
{
board = new CBoard();
player_name1 = name1; // 'U'
player_name2 = name2; // 'C'
current_player = starter;
}
CPvP::~CPvP() // destructor
{ delete board; }
//=============================================================================
void CPvP::playGame() // main method
{
while(board->turn+1 < CBoard::SIZE){
showGame();
saveGame();
if(board->checkWin(playerMakePlay(),4))
break;
switchPlayer();
if(board->turn+1 == board->SIZE)
current_player = 'T'; // tie/draw
}
clearFile();
showGame();
gameOver();
}
void CPvP::gameOver() // credits
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
switch (current_player) {
case 'O':
SetConsoleTextAttribute(hConsole, 111);
cout << endl << "Yellow won!";
saveScore(false, player_name2);
saveScore(true, player_name1);
break;
case '0':
SetConsoleTextAttribute(hConsole, 79);
cout << endl << "Red won!";
saveScore(true, player_name2);
saveScore(false, player_name1);
break;
case 'T': cout << endl << "It's a tie!";
}
SetConsoleTextAttribute(hConsole, 15);
cout << endl << endl << "THANKS FOR PLAYING!" << endl
<< "Game developed by:" << endl
<< "Ines Ferreira & Andre Neto" << endl << endl;
system("pause");
}
//=============================================================================
void CPvP::showGame() // shows player + turn + board
{
system("cls");
switch(current_player){
case 'O': cout << player_name1 << "'s turn"
<< endl << "Turn " << board->turn << endl; break;
case '0': cout << player_name2 << "'s turn"
<< endl << "Turn " << board->turn << endl;
}
board->printBoard();
}
void CPvP::switchPlayer() // switches between players
{
if (current_player == 'O')
current_player = '0';
else
current_player = 'O';
}
int CPvP::playerMakePlay(){
int play;
char cplay;
int t = board->turn;
do{
cout << "Pick a collumn [1..7]: ";
cin >> cplay;
if (cplay == '-'){
if(board->turn >= 1){
board->undoPiece(1);
switchPlayer();
showGame();
}
}
if (cplay == '+'){
if(board->turn < t){
board->advancePiece(1);
switchPlayer();
showGame();
}
}
if (cplay == '0'){
exit(0);
}
play = (int)cplay - 48 - 1;
}while (play >= CBoard::MAX_C || play < 0 || board->getRow(play) == -1);
board->playPiece(play, current_player);
return play;
}
//=============================================================================
void CPvP::saveGame() // saves game in case of unexpected shutdown
{
ofstream WriteFile("savedgame_pvp.txt");
for (int t = 0; t < CBoard::SIZE; t++)
for (int r = 0; r < CBoard::MAX_R; r++)
for (int c = 0; c < CBoard::MAX_C; c++)
WriteFile << board->boards[t][r][c];
WriteFile << endl << board->turn
<< endl << current_player
<< endl << player_name1
<< endl << player_name2;
WriteFile.close();
}
void CPvP::clearFile () const // clears saved game after its over
{
ofstream MyFile("savedgame_pvp.txt");
MyFile.close();
}
bool CPvP::loadGame() // resume game, returns false if there is no game to resume
{
ifstream MyReadFile("savedgame_pvp.txt");
if(MyReadFile.peek() == ifstream::traits_type::eof())
return false; // checks if its empty
string tmpString;
getline(MyReadFile, tmpString); // gets board
int i = 0;
for(int t = 0; t < CBoard::SIZE; t++)
for(int r = 0; r < CBoard::MAX_R; r++)
for(int c = 0; c < CBoard::MAX_C; c++)
board->boards[t][r][c] = tmpString[i++];
getline(MyReadFile, tmpString); // gets turn
board->turn = stoi(tmpString);
getline(MyReadFile, tmpString); // gets current_player
current_player = tmpString[0];
getline(MyReadFile, tmpString); // gets player name1
player_name1 = tmpString;
getline(MyReadFile, tmpString); // gets player name2
player_name2 = tmpString;
MyReadFile.close();
return true; // successful
}
//=============================================================================
struct CPvP::stats{
string name;
int win;
int loss;
};
void CPvP::swap(stats *xp, stats *yp) // selection sort: score = wins - losses
{
stats temp = *xp;
*xp = *yp;
*yp = temp;
}
void CPvP::selectionSort(stats arr[], int n){
for(int i = 0; i < n-1; i++){
int min_idx = i;
for (int j = i+1; j < n; j++)
if ((arr[j].win - arr[j].loss) > (arr[min_idx].win - arr[min_idx].loss))
min_idx = j;
swap(&arr[min_idx], &arr[i]);
}
}
void CPvP::saveScore(bool is_win, string name) // saves player score to player vs machine leaderboards
{
ifstream ReadFile("leaderboard_pvp.txt");
string line;
int total=0;
getline(ReadFile, line);
if(ReadFile.peek() == ifstream::traits_type::eof()){}
//total = 0; // checks if its empty
else
total = stoi (line); // total number of players registred
stats all[total+1];
all[total].win = 0;
all[total].loss = 0;
int found = -1;
// from file to struct stats
for (int i = 0; i < total; i++){
getline(ReadFile, line);
all[i].name = line;
getline(ReadFile, line);
all[i].win = stoi(line);
getline(ReadFile, line);
all[i].loss = stoi(line);
//ReadFile >> all[i].win >> all[i].loss;
// searches for player name in files
if (all[i].name == name)
found = i;
}
ReadFile.close();
// if player name already exists
if (found != -1){
if (is_win) all[found].win++;
else all[found].loss++;
}
// if player name doesn't exists
else {
all[total].name = name;
if (is_win) all[total].win++;
else all[total].loss++;
total++;
}
selectionSort(all, total);
// put ordered leaderboard in file
ofstream WriteFile("leaderboard_pvp.txt");
WriteFile << total;
for(int i = 0; i < total; i++)
WriteFile << endl << all[i].name << endl << all[i].win << endl << all[i].loss;
WriteFile.close();
}
void CPvP::leaderboard() const // show top 10
{
string line;
ifstream ReadFile("leaderboard_pvp.txt");
if(ReadFile.peek() == ifstream::traits_type::eof())
return; // checks if its empty
getline(ReadFile, line);
int n_players, total_players = stoi (line);
if (total_players < 10) n_players = total_players;
else n_players = 10;
cout << " --PLAYER VS PLAYER LEADERBOARD--" << endl << endl;
cout << "Top 10" << setw(20) << "Name" << setw(10) << "Wins" << setw(10) << "Losses" << endl;
for (int i = 0; i < n_players; i++){
getline(ReadFile, line);
cout << setw(6) << i+1 << setw(20) << line;
getline(ReadFile, line);
cout << setw(10) << line;
getline(ReadFile, line);
cout << setw(10) << line << endl;
}
cout << endl;
ReadFile.close();
}
//=============================================================================
+45
View File
@@ -0,0 +1,45 @@
#include <iostream>
#include <fstream>
#include <iomanip>
#ifndef CPVP_H
#define CPVP_H
#include "cboard.h"
using namespace std;
class CPvP
{
private:
CBoard *board;
string player_name1;
string player_name2;
char current_player;
public:
CPvP(string = "Guest1", string = "Guest2", char = 'O');
~CPvP();
// GAME
void playGame(); // main method
void gameOver(); // roll the credits
void showGame(); // show player turn, board
void switchPlayer(); // switch between players
// PLAYERS MECHANINCS
int playerMakePlay(); // returns & plays a valid move from player
// FILES
void saveGame(); // saves game into file
bool loadGame(); // loads game from file (if any)
void clearFile() const; // clears file
struct stats;
void swap(stats *, stats *);
void selectionSort(stats [], int);
void saveScore(bool, string);
void leaderboard() const;
};
#endif // CPVP_H
+440
View File
@@ -0,0 +1,440 @@
#include <ctime>
#include <iostream>
#include "cpvm.h"
#include "cpvp.h"
#include "cmvm.h"
using namespace std;
void mainMenu();
void newGame();
void showLeaderboard();
void showLeaderboardPvM();
void showLeaderboardPvP();
void commands();
void resumeGame();
string setName();
void newPvM();
void newPvP();
void newMvM();
void resumePvM();
void resumePvP();
void resumeMvM();
int main(){
mainMenu();
}
void mainMenu(){
char option;
do{
system("cls");
cout << "Welcome to Connect 4" << endl << endl
<< "1) New Game" << endl
<< "2) Resume Game" << endl
<< "3) Leaderboards" << endl
<< "4) Commands" << endl
<< "0) Quit" << endl << endl
<< "Choose an option: ";
cin >> option;
}while(option < '0' || option > '4');
switch(option){
case '1': newGame(); break;
case '2': resumeGame(); break;
case '3': showLeaderboard(); break;
case '4': commands(); break;
case '0': exit(0);
}
}
void newGame(){
// set game mode
char mode;
do{
system("cls");
cout << "Choose your game mode:" << endl << endl
<< "1) Player vs Machine" << endl
<< "2) Player vs Player" << endl
<< "3) Machine vs Machine" << endl
<< "0) Exit" << endl << endl
<< "Choose an option: ";
cin >> mode;
if(mode == '0'){ mainMenu(); }
system("cls");
}while(mode < '0' || mode > '3');
switch (mode) {
case '1': newPvM(); break;
case '2': newPvP(); break;
case '3': newMvM(); break;
case '0': mainMenu();
}
}
void showLeaderboard(){
char mode;
do{
system("cls");
cout << "Choose a game mode leaderboard: " << endl << endl
<< "1) Player vs Machine" << endl
<< "2) Player vs Player" << endl
<< "0) Quit" << endl << endl
<< "Choose an option: ";
cin >> mode;
if(mode == '0'){ mainMenu(); }
system("cls");
}while(mode < '0' || mode > '2');
switch(mode){
case '1': showLeaderboardPvM(); break;
case '2': showLeaderboardPvP(); break;
case '0': mainMenu();
}
}
void showLeaderboardPvM(){
CPvM* game = new CPvM ();
system("cls");
game->leaderboard();
system("pause");
delete game;
mainMenu();
}
void showLeaderboardPvP(){
CPvP* game = new CPvP ();
system("cls");
game->leaderboard();
system("pause");
delete game;
mainMenu();
}
void commands(){
system("cls");
cout << "Game Commands:" << endl << endl
<< "Choose a collumn [1..7] to make your move" << endl
<< "type \"0\" to force close the game" << endl
<< "type \"-\" to undo your last play" << endl
<< "type \"+\" to go forward one play" << endl << endl;
system("pause");
mainMenu();
}
string setName(string n){
string name;
do{
getline(cin, name);
if(name == n) cout << "Invalid name" << endl << "Try again: ";
} while (name.size() > 18 || name == n || name == "");
return name;
}
void newPvM(){
CPvM* game = new CPvM ();
if(game->loadGame()){
delete game;
char aux;
do{
system("cls");
cout << "Your previous game is still unfinished." << endl
<< "If you continue, your progress will be lost." << endl << endl
<< "1) Start a new game anyways" << endl
<< "2) Resume saved game" << endl
<< "0) Back" << endl << endl
<< "Choose an option: ";
cin >> aux;
} while (aux <'0' || aux >'2');
switch (aux){
case '1': break;
case '2': resumePvM(); break;
case '0': mainMenu();
}
} else delete game;
// set name
string name;
system("cls");
cout << "Your Name: ";
cin.ignore();
name = setName(" ");
// set dificulty
char difficulty;
do{
system("cls");
cout << "Hello " << name;
cout << endl;
cout << "Choose your difficulty:" << endl << endl
<< "1) Easy" << endl
<< "2) Medium" << endl
<< "3) Hard" << endl
<< "4) Extreme" << endl
<< "0) Exit" << endl << endl
<< "Choose an option: ";
cin >> difficulty;
if(difficulty == '0'){ mainMenu(); }
system("cls");
}while(difficulty < '0' || difficulty > '4');
// set first player
char starter_char;
int starter_int;
do{
system("cls");
switch (difficulty) {
case '1': cout << "Difficulty: Easy" << endl; break;
case '2': cout << "Difficulty: Medium" << endl; break;
case '3': cout << "Difficulty: Hard" << endl; break;
case '4': cout << "Difficulty: Extreme" << endl;
}
cout << "Who makes the first play?" << endl << endl
<< "1) Human" << endl
<< "2) Computer" << endl
<< "3) It's whatever" << endl
<< "0) Exit" << endl << endl
<< "Choose an option: ";
cin >> starter_char;
if(starter_char == '0'){ mainMenu(); }
} while(starter_char < '0' || starter_char > '3');
switch (starter_char) {
case '1': starter_int = 1; break;
case '2': starter_int = 2; break;
case '3': srand (time(NULL));
starter_int = rand() % 2 + 1;
}
switch (starter_int) {
case 1: starter_char = 'O'; break;
case 2: starter_char = '0'; break;
}
CPvM *g = new CPvM (name, (int)difficulty-48, starter_char);
g->playGame();
delete g;
mainMenu();
}
void newPvP(){
CPvP* game = new CPvP ();
if(game->loadGame()){
delete game;
char aux;
do{
system("cls");
cout << "Your previous game is still unfinished." << endl
<< "If you continue, your progress will be lost." << endl << endl
<< "1) Start a new game anyways" << endl
<< "2) Resume saved game" << endl
<< "0) Back" << endl << endl
<< "Choose an option: ";
cin >> aux;
} while (aux <'0' || aux >'2');
switch (aux){
case '1': break;
case '2': resumePvP(); break;
case '0': mainMenu();
}
} else delete game;
// set name
system("cls");
cout << "Player 1 name: ";
cin.ignore();
string name1 = setName(" ");
cout << "Player 2 name: ";
string name2 = setName(name1);
char starter_char;
int starter_int;
do{
system("cls");
cout << "Who wants to play first?" << endl << endl
<< "1) " << name1 << endl
<< "2) " << name2 << endl
<< "3) It's whatever" << endl
<< "0) Exit" << endl << endl
<< "Choose an option: ";
cin >> starter_char;
if(starter_char == '0'){ mainMenu(); }
system("cls");
} while(starter_char < '0' || starter_char > '3');
switch (starter_char) {
case '1': starter_int = 1; break;
case '2': starter_int = 2; break;
case '3': srand (time(NULL));
starter_int = rand() % 2 + 1;
}
switch (starter_int) {
case 1: starter_char = 'O'; break;
case 2: starter_char = '0'; break;
}
cout << starter_char << endl;
CPvP* game_pvm = new CPvP (name1, name2, starter_char);
game_pvm->playGame();
delete game_pvm;
mainMenu();
}
void newMvM(){
CMvM* game = new CMvM ();
if(game->loadGame()){
delete game;
char aux;
do{
system("cls");
cout << "Your previous game is still unfinished." << endl
<< "If you continue, your progress will be lost." << endl << endl
<< "1) Start a new game anyways" << endl
<< "2) Resume saved game" << endl
<< "0) Back" << endl << endl
<< "Choose an option: ";
cin >> aux;
} while (aux <'0' || aux >'2');
switch (aux){
case '1': break;
case '2': resumeMvM(); break;
case '0': mainMenu();
}
} else delete game;
char dif1, dif2;
// set dificulty of Machine 1
do{
system("cls");
cout << "Choose Machine's 1 difficulty:" << endl << endl
<< "1) Easy" << endl
<< "2) Medium" << endl
<< "3) Hard" << endl
<< "4) Extreme" << endl
<< "0) Exit" << endl << endl
<< "Choose an option: ";
cin >> dif1;
if(dif1 == '0'){ mainMenu(); }
system("cls");
}while(dif1 < '0' || dif1 > '4');
// set dificulty of Machine 2
do{
system("cls");
cout << "Choose Machine's 2 difficulty:" << endl << endl
<< "1) Easy" << endl
<< "2) Medium" << endl
<< "3) Hard" << endl
<< "4) Extreme" << endl
<< "0) Exit" << endl << endl
<< "Choose an option: ";
cin >> dif2;
if(dif2 == '0'){ mainMenu(); }
system("cls");
}while(dif2 < '0' || dif2 > '4');
// set first player
char starter_char;
int starter_int;
do{
system("cls");
cout << "Who makes the first play?" << endl << endl
<< "1) Machine 1" << endl
<< "2) Machine 2" << endl
<< "3) It's whatever" << endl
<< "0) Exit" << endl << endl
<< "Choose an option: ";
cin >> starter_char;
if(starter_char == '0'){ mainMenu(); }
} while(starter_char < '0' || starter_char > '3');
switch (starter_char) {
case '1': starter_int = 1; break;
case '2': starter_int = 2; break;
case '3': srand (time(NULL));
starter_int = rand() % 2 + 1;
}
switch (starter_int) {
case 1: starter_char = 'O'; break;
case 2: starter_char = '0'; break;
}
CMvM *g = new CMvM ((int)dif1-48, (int)dif2-48, starter_char);
g->playGame();
delete g;
mainMenu();
}
void resumeGame(){
char mode;
do{
system("cls");
cout << "Choose your game mode to resume:" << endl << endl
<< "1) Player vs Machine" << endl
<< "2) Player vs Player" << endl
<< "3) Machine vs Machine" << endl
<< "0) Exit" << endl << endl
<< "Choose an option: ";
cin >> mode;
if(mode == '0'){ mainMenu(); }
system("cls");
}while(mode < '0' || mode > '3');
switch (mode) {
case '1': resumePvM(); break;
case '2': resumePvP(); break;
case '3': resumeMvM(); break;
case '0': mainMenu();
}
}
void resumePvM(){
CPvM* game = new CPvM ();
if(game->loadGame())
game->playGame();
else{
system("cls");
cout << "No game to resume." << endl << endl;
system("pause");
mainMenu();
}
delete game;
}
void resumePvP(){
CPvP* game = new CPvP ();
if(game->loadGame())
game->playGame();
else{
system("cls");
cout << "No game to resume." << endl << endl;
system("pause");
mainMenu();
}
delete game;
}
void resumeMvM(){
CMvM* game = new CMvM ();
if(game->loadGame())
game->playGame();
else{
system("cls");
cout << "No game to resume." << endl << endl;
system("pause");
mainMenu();
}
delete game;
}