/* Oslo ricepile animation (version 2.02 - Windows) 
 *
 * Copyright (C) 2005 N.R. Moloney 
 *
 * Distributed under the Qt Non-Commercial license version 1.0
 */

#ifndef OSLO_H
#define OSLO_H

#include <qlcdnumber.h>
#include <qwidget.h>

const int L = 70;
const int H = 138;
const double prob = 0.5;
const int maxSpeed = 5;
const int offsetx = 200;
const int offsety = 5; 
const unsigned short int pixel = 5;
const int wall = 15;

const int buttonWidth = 160;
const int buttonHeight = 55;
const int comboBoxHeight = 70;
const int LCDWidth = 170;
const int LCDHeight = 100;
const int leftAlign = 10;
const int rightAlign = 820;

const int FAST = 0;
const int SLOW = 1;
const int PAUSE = 2;

const int SLOWTIME = 100;

class Oslo : public QWidget
{

  Q_OBJECT

 public:

  Oslo( QWidget * parent = 0, const char * name = 0 );
  
  int * h;
  int * zc;
  int * toppling;
  int * newToppling;
  int numToppling;
  int speed;
  int hits, hTotal, s, sMax;
  int column, depth;

  QLCDNumber * hitsLCD;
  QLCDNumber * grainsLCD;
  QLCDNumber * sLCD;
  QLCDNumber * largestLCD;

  void initialiseLattice();
  void relax();

 public slots:
    
  void slotSpeed( int S );
  void slotStartAgain();
  
 protected:

  void paintEvent( QPaintEvent * );

 private slots:
   
  void drive();
  void update();

};

#endif 
