/*
 * CS 106B Section 03 Problems
 */

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

void stutter(Stack<int>& s); // section problem 1
string starString(int n); // section problem 2
void writeChars(int n); // section problem 3
bool isMeasurable(int target, Vector<int>& weights); // section problem 4
int waysToClimb(int steps); // section problem 5
bool isSubsequence(string big, string small); // section problem 6

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

    // test stutter
    Stack<int> s1, s2;
    s1.push(1);
    s2.push(1);
    s2.push(2);
    s2.push(3);
    stutter(s1);
    stutter(s2);
    cout << "stutter({1}): " << s1.toString() << " should be {1, 1}" << endl;
    cout << "stutter({1, 2, 3}): " << s2.toString() << " should be {1, 1, 2, 2, 3, 3}" << endl;

    // test starString
    cout << "starString(1): " << starString(1) << " should be **" << endl;
    cout << "starString(2): " << starString(2) << " should be ****" << endl;
    cout << "starString(4): " << starString(4) << " should be ****************" << endl;

    // test writeChars
    cout << "writeChars(1) output below should be *" << endl;
    writeChars(1);
    cout << endl << "writeChars(2) output below should be **" << endl;
    writeChars(2);
    cout << endl << "writeChars(4) output below should be <**>" << endl;
    writeChars(4);
    cout << endl << "writeChars(9) output below should be <<<<*>>>>" << endl;
    writeChars(9);
    cout << endl;

    // test isMeasurable
    Vector<int> v1, v2;
    v1 += 1, 3;
    v2 += 2, 3, 7;
    string test1 = isMeasurable(2, v1) ? "true" : "false";
    string test2 = isMeasurable(5, v1) ? "true" : "false";
    string test3 = isMeasurable(6, v2) ? "true" : "false";
    cout << "isMeasurable(2, {1, 3}): " << test1 << " should be true" << endl;
    cout << "isMeasurable(5, {1, 3}): " << test2 << " should be false" << endl;
    cout << "isMeasurable(6, {2, 3, 7}): " << test3 << " should be true" << endl;

    // test waysToClimb
    cout << "waysToClimb(1): " << waysToClimb(1) << " should be 1" << endl;
    cout << "waysToClimb(2): " << waysToClimb(2) << " should be 2" << endl;
    cout << "waysToClimb(4): " << waysToClimb(4) << " should be 5" << endl;

    // test isSubsequence
    test1 = isSubsequence("computer", "core") ? "true" : "false";
    test2 = isSubsequence("computer", "cope") ? "true" : "false";
    test3 = isSubsequence("computer", "computer") ? "true" : "false";

    cout << "isSubsequence(\"computer\", \"core\"): " << test1 << " should be false" << endl;
    cout << "isSubsequence(\"computer\", \"cope\"): " << test2 << " should be true" << endl;
    cout << "isSubsequence(\"computer\", \"computer\"): " << test3 << " should be true" << endl;
    return 0;
}


void stutter(Stack<int>& s) {
    // TODO: finish me
}


string starString(int n) {
    // TODO: finish me
    return "";
}


void writeChars(int n) {
    // TODO: finish me
}


bool isMeasurable(int target, Vector<int>& weights) {
    // TODO: finish me
    return false;
}


int waysToClimb(int steps) {
    // TODO: finish me
    return 0;
}


bool isSubsequence(string big, string small) {
    // TODO: finish me
    return false;
}
