/*
 * CS 106B Section 01 Problems
 */

#include <cmath>
#include <iostream>
#include <string>
#include "console.h"
#include "grid.h"
#include "stack.h"
#include "vector.h"
using namespace std;

void cumulative(Vector<int>& vec); // section problem 3
int crossSum(Grid<int>& grid, int row, int col); // section problem 4
void splitStack(Stack<int>& stack); // section problem 5

int main() {
    setConsoleSize(750, 500);
    setConsoleFont("Monospaced-Bold-14");
    setConsoleEcho(true);

    // test cumulative function
    Vector<int> v;
    v += 1, 1, 2, 3, 5;
    cumulative(v);
    cout << "v: " << v << " should be {1, 2, 4, 7, 12}" << endl;

    // test crossSum function
    Grid<int> grid;
    grid.resize(3, 3); // 3x3 grid with numbers 1-9
    int num = 1;
    for (int r = 0; r < grid.numRows(); r++) {
        for (int c = 0; c < grid.numCols(); c++) {
            grid[r][c] = num;
            num++;
        }
    }
    int sum = crossSum(grid, 1, 1);
    cout << "sum: " << sum << " should be 25" << endl;

    // test splitStack function
    Vector<int> values;
    Stack<int> stack;
    values += 4, 0, -1, 5, -6, -3, 2, 7;
    for (int i = 0; i < values.size(); i++) {
        stack.push(values[i]);
    }
    splitStack(stack);
    cout << "stack: " << stack.toString() << " should be {-3, -6, -1, 7, 2, 5, 0, 4}";
    return 0;
}

void cumulative(Vector<int>& vec) {
    // TODO: finish me
}

int crossSum(Grid<int>& grid, int row, int col) {
    // TODO: finish me
    return 0;
}

void splitStack(Stack<int>& stack) {
    // TODO: finish me
}
