// AP Computer Science Marine Biology Case Study program
// Copyright (C) 2000  College Board and Educational Testing Service

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// onedwalk.cpp - copyright statement added 5/31/2000

#include "randgen.h"
#include <iostream.h>

int main()
{
  RandGen randomVals;
  int position = 0;
  int numSteps;
  int step;
  int flip;

  cout << "Number of steps? ";
  cin >> numSteps;
  for (step = 0; step < numSteps; step++)
  {
    flip = randomVals.RandInt(2);
    if (flip == 0)
    {
      position++;
    }
    else
    {
      position--;
    }
  }
  cout << "Final position = " << position << endl;
  return 0;
}
