Пример #1
0
 /**
  * This constructs a 3-cities symmetric problem (naive TSP) 
  * with weight matrix [[0,1,1][1,0,1][1,1,0]] and RANDOMKEYS encoding
  */
 tsp_vrplc::tsp_vrplc() : base_tsp(3, 0, 0 , base_tsp::RANDOMKEYS), m_weights(), m_capacity(1.1)
 {
     std::vector<double> dumb(3,0);
     m_weights = std::vector<std::vector<double> > (3,dumb);
     m_weights[0][1] = 1;
     m_weights[0][2] = 1;
     m_weights[2][1] = 1;
     m_weights[1][0] = 1;
     m_weights[2][0] = 1;
     m_weights[1][2] = 1;
 }
Пример #2
0
int main(int argc, char* argv[])
{
  char holding[10000];        //This is just here as a buffer to try and keep you from overwriting main's return address, and into safe pages
  char *string;
  string=argv[1];             //string now points at the argument to main
  unsigned long long stack; 
  stack=get_sp();             //stack now points to the stack pointer.
  
    if(argc>1)                //Make sure that a filename was provided.
    {
      printf("\\Length of Input String:%d\\", strlen(string));
      dumb(argv[1]);   
    }
    else
      {
	printf("\n\nError: No Command Line arg for vuln was given\n\n");
	dumb("Useless Text");
      }
  return (0);
}
Пример #3
0
/*expected structure of input bytes:
 * d0: GHCZ marx switch fill, GHCZ line switch fill
 * d1: GHCZ marx switch dump, GHCZ line switch dump
 * d2: GHCZ recirculator, recirculator on/off, recirculator auto/manual, final two unused
 * o0: GHCZ marx fill valve, GHCZ line switch fill valve
 * o1: GHCZ marx dump valve, GHCZ line empty valve
 * o2: bottle, dump, recirculator in, recirculator out, final four unused
 * 
 */
void output(unsigned char d0,unsigned char d1,unsigned char d2)
{
     unsigned char o0,o1,o2;
    //byte masks to find whether the recirculator is in dumb or smart mode
    bool recirc_smart=d2&0b00000010;
    //if recirculator is smart
    if (recirc_smart){
        smart(d0,d1,d2,&o0,&o1,&o2);
    }
    else if (recirc_smart==0){
        dumb(d0,d1,d2,&o0,&o1,&o2);
    }

    //write three bytes i
    __delay_us(1);
    write(o0,o1,o2);
    //clock the data held on the output latches to the pins in parallel.
    OutCLK();

    return;
}
Пример #4
0
//________________________________________________________
long    GetMaxCharWidth (_HYFont& f)
{
    _String dumb ('W');
    return GetVisibleStringWidth (dumb,f);
    // TBI
}
Пример #5
0
double f(){
	static int i = dumb();
	static auto f = std::bind(std::uniform_real_distribution<double>(0.0,1.0), std::default_random_engine(time(0)));
	return f();
}
Пример #6
0
// RUN: %clang_cc1 -std=c++1z -verify %s
// RUN: %clang_cc1 -std=c++2a -verify %s

template<typename ...T> constexpr auto sum(T ...t) { return (... + t); }
template<typename ...T> constexpr auto product(T ...t) { return (t * ...); }
template<typename ...T> constexpr auto all(T ...t) { return (true && ... && t); }
template<typename ...T> constexpr auto dumb(T ...t) { return (false && ... && t); }

static_assert(sum(1, 2, 3, 4, 5) == 15);
static_assert(product(1, 2, 3, 4, 5) == 120);
static_assert(!all(true, true, false, true, false));
static_assert(all(true, true, true, true, true));
static_assert(!dumb(true, true, true, true, true));

struct S {
  int a, b, c, d, e;
};
template<typename ...T> constexpr auto increment_all(T &...t) {
  (++t, ...);
}
constexpr bool check() {
  S s = { 1, 2, 3, 4, 5 };
  increment_all(s.a, s.b, s.c, s.d, s.e);
  return s.a == 2 && s.b == 3 && s.c == 4 && s.d == 5 && s.e == 6;
}
static_assert(check());

template<int ...N> void empty() {
  static_assert((N || ...) == false);
  static_assert((N && ...) == true);
  (N, ...);