44 lines
962 B
C++
44 lines
962 B
C++
#ifndef DVEREB_PROBLEM_H
|
|
#define DVEREB_PROBLEM_H
|
|
|
|
#include <cstdlib>
|
|
#include <ncurses.h>
|
|
|
|
enum PROBLEM_TYPE
|
|
{
|
|
// NOTE(dev): EASY means each digit can be handled without carryover.
|
|
// e.g. 33 + 46 is easy because 6+3 < 10 and 3+4 is < 10.
|
|
// HARD means you might have to carry over.
|
|
// e.g. 33 + 97 is hard because 7 + 3 = 10, carry the 1, 9 + 3 + 1 = 13, 130.
|
|
EASY_ADDITION = 1,
|
|
EASY_SUBTRACTION,
|
|
HARD_ADDITION,
|
|
HARD_SUBTRACTION,
|
|
};
|
|
|
|
class Problem
|
|
{
|
|
public:
|
|
Problem(PROBLEM_TYPE type, unsigned short max_digits, unsigned win_x, unsigned win_y);
|
|
~Problem();
|
|
|
|
void Draw(bool selected);
|
|
|
|
private:
|
|
Problem() = delete;
|
|
static bool seeded;
|
|
|
|
PROBLEM_TYPE problem_type;
|
|
WINDOW *win = nullptr;
|
|
unsigned window_x, window_y;
|
|
|
|
int number_top;
|
|
int number_bottom;
|
|
|
|
// Helper Functions:
|
|
void GenerateNumbers(PROBLEM_TYPE type, unsigned short max_digits);
|
|
void GenerateWindow(unsigned win_x, unsigned win_y);
|
|
};
|
|
|
|
#endif
|