refactoring
This commit is contained in:
+1
-21
@@ -1,28 +1,8 @@
|
||||
#include "../include/useful_funcs.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
bool AreWeInBounds(int x, int y, std::vector<std::vector<char>> &map) {
|
||||
if (x < 0 || y < 0) {
|
||||
return false;
|
||||
}
|
||||
if (x >= map.size() || y >= map[x].size()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int conditional_operation(int a, int b, char op) {
|
||||
switch (op) {
|
||||
case '+':
|
||||
return a + b;
|
||||
case '-':
|
||||
return a - b;
|
||||
default:
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ifstream inputfile("input");
|
||||
std::string input;
|
||||
|
||||
+1
-21
@@ -1,29 +1,9 @@
|
||||
#include "../include/useful_funcs.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
|
||||
bool AreWeInBounds(int x, int y, std::vector<std::vector<char>> &map) {
|
||||
if (x < 0 || y < 0) {
|
||||
return false;
|
||||
}
|
||||
if (x >= map.size() || y >= map[x].size()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int conditional_operation(int a, int b, char op) {
|
||||
switch (op) {
|
||||
case '+':
|
||||
return a + b;
|
||||
case '-':
|
||||
return a - b;
|
||||
default:
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
bool WillHeGetStuck(int posX, int posY, int direction, int locX, int locY,
|
||||
std::vector<std::vector<char>> map) {
|
||||
char op_x;
|
||||
|
||||
Reference in New Issue
Block a user