Skip to content

Commit

Permalink
Checking in today's changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ejatgit committed May 17, 2024
1 parent b53f3e5 commit 6faf88e
Show file tree
Hide file tree
Showing 10 changed files with 335 additions and 194 deletions.
2 changes: 1 addition & 1 deletion CPP/High_Voltage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif()
project ("High_Voltage")

# Add source to this project's executable.
add_executable (High_Voltage "High_Voltage.cpp" "High_Voltage.h" "cPlayer.cpp" "cInterceptor.cpp" "cPlayer.h" "cInterceptor.h" "GlobalVariables.h" "mBuildMaze.h")
add_executable (High_Voltage "High_Voltage.cpp" "High_Voltage.h" "cPlayer.cpp" "cInterceptor.cpp" "cPlayer.h" "cInterceptor.h" "GlobalVariables.h" "mBuildMaze.h" "mRunGame.h" "mMoveCharacters.h")

if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET High_Voltage PROPERTY CXX_STANDARD 20)
Expand Down
6 changes: 6 additions & 0 deletions CPP/High_Voltage/GlobalVariables.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include<string>
#include<vector>
#include <windows.h>
//using namespace std;

#include "cPlayer.h"
Expand All @@ -25,7 +26,12 @@ const int iMaxHighVoltageBarriersPerRow = 15;
//Public rMaze As Range
const int iMazeRows = 25;
const int iMazeCols = 30;
int nInterAlive;
int nInterKilled;
int nTotalinterceptorsKilled;
std::string rMaze[iMazeRows][iMazeCols];
HANDLE hStdout, hStdin;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
// not needed since output goes to the terminal not an excel range
//Public interceptorCollection As Collection

Expand Down
6 changes: 5 additions & 1 deletion CPP/High_Voltage/High_Voltage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
//

#include "High_Voltage.h"

#include"mRunGame.h"
using namespace std;

int main()
{
hStdin = GetStdHandle(STD_INPUT_HANDLE);
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);

cout << "Hello CMake." << endl;
RunGame();
return 0;
}
1 change: 1 addition & 0 deletions CPP/High_Voltage/High_Voltage.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
#include <iostream>

// TODO: Reference additional headers your program requires here.
#include"GlobalVariables.h"
223 changes: 132 additions & 91 deletions CPP/High_Voltage/mFunctions.cpp
Original file line number Diff line number Diff line change
@@ -1,52 +1,54 @@
#include"GlobalVariables.h"
#include "mFunctions.h"

//Attribute VB_Name = "mFunctions"
//Option Explicit

//
int offsetRowBy(int iValue) {
//Function offsetRowBy(ByVal iValue As Integer) As Integer
//
//If 1 <= iValue And iValue <= 3 Then
if (1 <= iValue && iValue <= 3 ){
// offsetRowBy = 1
return 1;
}
//ElseIf 7 <= iValue And iValue <= 9 Then
else if (7 <= iValue && iValue <= 9){
// offsetRowBy = -1
return -1;
}
//Else
if (1 <= iValue && iValue <= 3) {
// offsetRowBy = 1
return 1;
}
//ElseIf 7 <= iValue And iValue <= 9 Then
else if (7 <= iValue && iValue <= 9) {
// offsetRowBy = -1
return -1;
}
//Else
else {
// offsetRowBy = 0
return 0;
//End If
// offsetRowBy = 0
return 0;
//End If
}
//
//End Function
//
//End Function
}
//
int offsetColumnBy(int iValue) {
//Function offsetColumnBy(ByVal iValue As Integer) As Integer
//
//If iValue = 3 Or iValue = 6 Or iValue = 9 Then
if (iValue == 3 || iValue == 6 || iValue == 9){
// offsetColumnBy = 1
return 1;
}
//ElseIf iValue = 1 Or iValue = 4 Or iValue = 7 Then
else if (iValue == 1 || iValue == 4 || iValue == 7){
// offsetColumnBy = -1
return -1;
}
//Else
if (iValue == 3 || iValue == 6 || iValue == 9) {
// offsetColumnBy = 1
return 1;
}
//ElseIf iValue = 1 Or iValue = 4 Or iValue = 7 Then
else if (iValue == 1 || iValue == 4 || iValue == 7) {
// offsetColumnBy = -1
return -1;
}
//Else
else {
// offsetColumnBy = 0
return 0;
//End If
}
//
//End Function
// offsetColumnBy = 0
return 0;
//End If
}
//
//End Function
}
//
int interceptorRowOffset(int iValue) {
Expand All @@ -55,79 +57,118 @@ int interceptorRowOffset(int iValue) {
//
//iTest = cActivePlayer.Row - iValue
int iTest = cActivePlayer.Row - iValue;
//
//If iTest > 0 Then
if (iTest > 0){
// interceptorRowOffset = 1
}
//ElseIf iTest < 0 Then
else if (iTest < 0){
// interceptorRowOffset = -1
return -1;
}
//Else
else {
// interceptorRowOffset = 0
return 0;
//End If
//
//If iTest > 0 Then
if (iTest > 0) {
// interceptorRowOffset = 1
}
//
//End Function
//ElseIf iTest < 0 Then
else if (iTest < 0) {
// interceptorRowOffset = -1
return -1;
}
//Else
else {
// interceptorRowOffset = 0
return 0;
//End If
}
//
//End Function
}
//
int interceptorColumnOffset(Int iValue) {
//Function interceptorColumnOffset(ByVal iValue As Integer) As Integer
//Dim iTest As Integer
//
//iTest = cActivePlayer.Column - iValue
int iTest = cActivePlayer.Column- iValue;
//
//If iTest > 0 Then
int iTest = cActivePlayer.Column - iValue;
//
//If iTest > 0 Then
if (iTest > 0) {
// interceptorColumnOffset = 1
return 0;
}
//ElseIf iTest < 0 Then
else if (iTest < 0){
// interceptorColumnOffset = -1
return-1;
}
//Else
// interceptorColumnOffset = 1
return 0;
}
//ElseIf iTest < 0 Then
else if (iTest < 0) {
// interceptorColumnOffset = -1
return-1;
}
//Else
else {
// interceptorColumnOffset = 0
return 0;
// interceptorColumnOffset = 0
return 0;
}
//End If
//
//End Function
}
//End If
//
bool CheckInterceptorsAlive() {
//Function CheckInterceptorsAlive() As Boolean
//Dim cNowinterceptor As cInterceptor
cIneterceptor cNowInterceptor;
//
//For Each cNowinterceptor In interceptorCollection
//for (size_t i = 0; i < myVector.size(); ++i)
for (int i = 0; i < interceptorCollection.count, ++i)
{
cNowInterceptor = interceptorCollection[i];
// If cNowinterceptor.Alive Then
if (cNowInterceptor.Alive) {
// CheckInterceptorsAlive = True
return true;
// Exit For
break;
}
// Else
else
{
// CheckInterceptorsAlive = False
return false;
// End If
}
//Next cNowinterceptor
//
}
//End Function
}
//
bool CheckInterceptorsAlive(){
//Function CheckInterceptorsAlive() As Boolean
//Dim cNowinterceptor As cInterceptor
cIneterceptor cNowInterceptor;
//
//For Each cNowinterceptor In interceptorCollection
for (size_t i = 0; i < myVector.size(); ++i)
for (int i = 0; i < interceptorCollection.count,++i)//left off here
void MsgBox(std::string sNowMessage,std::string rLocation) {
//write out to the console some where
if (rLocation="nMsgbox0")
{
cNowInterceptor = interceptorCollection[i];
// If cNowinterceptor.Alive Then
if (cNowInterceptor.Alive) {
// CheckInterceptorsAlive = True
return true;
// Exit For
break;
}
// Else
else
{
// CheckInterceptorsAlive = False
return false;
// End If
}
//Next cNowinterceptor
//
}
//End Function
csbiInfo.dwCursorPosition.X = 0;
csbiInfo.dwCursorPosition.Y = iMazeRows + 2;
SetConsoleCursorPosition(hStdout, csbiInfo.dwCursorPosition);
cout << sNowMessage << endl;
}
else if (rLocation = "nMsgbox1")
{
csbiInfo.dwCursorPosition.X = 0;
csbiInfo.dwCursorPosition.Y = iMazeRows + 3;
SetConsoleCursorPosition(hStdout, csbiInfo.dwCursorPosition);
cout << sNowMessage << endl;
}
else if (rLocation = "nInterAlive")
{
csbiInfo.dwCursorPosition.X = 0;
csbiInfo.dwCursorPosition.Y = iMazeRows + 4;
SetConsoleCursorPosition(hStdout, csbiInfo.dwCursorPosition);
cout << sNowMessage << endl;
}
else if (rLocation = "nInterKilled")
{
csbiInfo.dwCursorPosition.X = 0;
csbiInfo.dwCursorPosition.Y = iMazeRows + 5;
SetConsoleCursorPosition(hStdout, csbiInfo.dwCursorPosition);
cout << sNowMessage << endl;
}
else if (rLocation = "nTotalinterceptorsKilled")
{
csbiInfo.dwCursorPosition.X = 0;
csbiInfo.dwCursorPosition.Y = iMazeRows + 6;
SetConsoleCursorPosition(hStdout, csbiInfo.dwCursorPosition);
cout << sNowMessage << endl;
}

}
1 change: 1 addition & 0 deletions CPP/High_Voltage/mFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ int offsetColumnBy(int iValue);
int interceptorRowOffset(int iValue);
int interceptorColumnOffset(Int iValue);
bool CheckInterceptorsAlive();
void MsgBox(std::string sNowMessage, std::string rLocation);
#endif

Loading

0 comments on commit 6faf88e

Please sign in to comment.