#include "libscl.h"

using namespace scl;
using namespace std;

int main() {

  INTEGER n, k;
  
  intvec lhs;
  intvec rhs;

  n = 5, k = 3;

  cout << '\n';
  cout << "n = " << n << ", k = " << k << '\n';
  cout << '\n';

  n_choose_k nck(n,k);

  INTEGER count;

  count = 0;

  do {
    nck.draw(lhs,rhs);
    cout << "[ ";
    for (INTEGER i=1; i<=k; ++i) cout << lhs[i] << ' ';
    cout << "] [ ";
    for (INTEGER i=1; i<=n-k; ++i) cout << rhs[i] << ' ';
    cout << ']' << '\n';
    ++count;
  } while (nck.update());

  cout << '\n';
  cout << "count = " << count << '\n';
  cout << '\n';

  count = 0;

  do {
    nck.draw(lhs,rhs);
    cout << "[ ";
    for (INTEGER i=1; i<=k; ++i) cout << lhs[i] << ' ';
    cout << "] [ ";
    for (INTEGER i=1; i<=n-k; ++i) cout << rhs[i] << ' ';
    cout << ']' << '\n';
    ++count;
  } while (nck.update());

  cout << '\n';
  cout << "count = " << count << '\n';
  
  cout << '\n';
  n = 6, k = 3;

  cout << '\n';
  cout << "n = " << n << ", k = " << k << '\n';
  cout << '\n';

  nck.reset(n,k);

  count = 0;

  do {
    nck.draw(lhs,rhs);
    cout << "[ ";
    for (INTEGER i=1; i<=k; ++i) cout << lhs[i] << ' ';
    cout << "] [ ";
    for (INTEGER i=1; i<=n-k; ++i) cout << rhs[i] << ' ';
    cout << ']' << '\n';
    ++count;
  } while (nck.update());

  cout << '\n';
  cout << "count = " << count << '\n';
  cout << '\n';

  n_choose_k NchooseK = nck;

  cout << '\n';
  n = 7, k = 2;
  cout << "n = " << n << ", k = " << k << '\n';
  cout << '\n';

  NchooseK.reset(n,k);

  count = 0;

  do {
    NchooseK.draw(lhs,rhs);
    cout << "[ ";
    for (INTEGER i=1; i<=k; ++i) cout << lhs[i] << ' ';
    cout << "] [ ";
    for (INTEGER i=1; i<=n-k; ++i) cout << rhs[i] << ' ';
    cout << ']' << '\n';
    ++count;
  } while (NchooseK.update());

  cout << '\n';
  cout << "count = " << count << '\n';
  cout << '\n';

  n_choose_k tmp;
  tmp.draw(lhs,rhs);


  return 0;
}

