Client-server application based on TCP/Sockets in Linux. Server simulates horse races. Each player and hors must be handled by separate thread. Client program is telnet.
Configuration of server: setting number of horses, names of horses and frequency of races (how many races per hour) – reading from configuration file. Server chooses up to 8 horses to each each and then simulates it real-time (each 1 second the position of horses is updated and informs about this players). Between races server handles client registration and receiving bets from players (Clients).
Each horse has strength factor. At start every horse has equal strength but running horses lose strength - the faster they run the more they lose. Strength of a particular horse is regenerated when it’s racing. The more strength has horse, the faster it runs. Additional there must be some random factor implemented. Players don’t see random factor but it can be seen on server output console.
Between races players register to the game (login without password). They can deposit and withdraw virtual money from system, can see next race horses and results from last race. They can check at what time next race is held. They can bet on horse in the next race. During race players receive real-time (every 1 second) data about horse positions, players cannot take any action in that moment except disconnect. During race new connections cannot be made.
After race server calculates bet money, all paid money is divided equally for all winner bets. If nobody wins in particular race the money is added to the money available for win in the next race.