
 I. ARIT 1992 Hidirbeyli,AYDIN,TR.  09400
              Golden,    CO,   USA. 80401



Xpool
=====

Xpool is an X windows application which simulates a billiard game by using
an approach called Discrete Element Methods(DEM). I actually wrote this as an 
assignment for the DEM class that I was taking this semester (Spring 1992).
Currently, I am having some problems with the graphics (moving bitmaps on the
screen), so don't expect to see something real fancy. To increase the 
performance, I wrote the code such that any stopped ball will not be redrawn.
This causes some problems because when you create a bitmap you actually 
create a rectangle area which contains the shape you define and that 
rectangle chops off some pieces from other balls when they get close to 
each other. You can solve this by redrawing all the balls in each time
step, but it will dramaticlly reduce the performance. There may be some
other problems that I didn't catch. Actually, I couldn't spend enough
time to add some other feautes like 3-ball, 8-ball, or 9-ball options but
will do that later . The other thing is that this is the first
complete X Windows program that I wrote. I am still learning how to develop
graphics program for X Windows, so if you find some stuff that can be done  
more efficiently, please tell me. Future release will have the options that
I just mentioned and better performance with your ideas. And also, I will refine
the code to increase the performance.
OK, let's talk about the code. Originally, I did this program in C++ for
DOS. I was going to port this code in C++ for un*x, but not everybody has 
C++ up and running on his/her machine, so I emulated (is that the word ?)
C++-like programming in C. I actually don't know why I did this, I guess
I just got used to C++. 
 
Before we go on, I should mention that I don't know the original dimensions
of a pool table, so if anybody knows, please send me those dimensions
so that next release will have correct dimensions for the balls and table.

Now it is time to crank up the good old compiler and build this sucker.
I don't have a complicated Makefile or an Imakefile ,so if you just type
   make
it should do it. I also tried GNU C compiler, it works just fine.
I compiled the code on RS6000, DEC 3100  and NeXT (under X Windows).
It runs on these machines just fine.
I don't think you will have any problem with the other machines too since
I don't use any machine dependent stuff. It is just pure number crunching.
I will also post the Windows 3.0 version later.


bugs:
   Xpool currently has a some bugs. If you want to move the cue ball,
   and you move your mouse fast, program thinks that you want to 
   use the cue stick so it shows the stick. Move the cue ball slowly.
   And I am really concerned about the balls chopping each other.
   In fact you will see some balls passing by and cutting pieces from
   another ball even if they thouch each other,that is because of the fact that 
   they don't create enough force to move the stopped ball. Since we don't
   want to wait 'till everybody reachs 0.0000 speed, I wrote that part
   such that if the ball speed drops under 1.0000, it means that ball is
   stopped and has 0.0000 velocity. You can change these limits in 
    definition.h   ....
   
   When I have the time, I'll fix these problems and  
   others coming from you.

   As I said there are some other options that I want to add to this program
   but for now, they have to wait. You will see that there is some
   code in the program that is commented out for this 'version'. I am going to
   use most of it  later.
 
rules:
   With the current setup, we have two sets of balls, red and blue ( for
   color display ). I didn't label the balls yet, do that later...
   whoever  gets his/her balls in first and then gets the
   black ball in last wins. 
   If you want to see where your ball will go, click on 'Cheat' ( or 'No Cheat')
   button to get a trajectory of your shot.

  
Any idea for speeding up the graphics  will be
cheerfully accepted and any recommendations which could 
benefit overall performance will be appriciated.

Happy playing, Guys............
IstakayI kIrma Haaaaa..!!!!( Don't break the stick OKKKKKKKK.!!)

Ismail ARIT  
iarit@slate.mines.colorado.edu

note:
   when you run the program, you are gonna see a layout on the main
   window  "SALOON HIDIR". in case if you wonder what the hell that thing is,
   it is the place that we used to play pool when I was in High School back
   home.

