You would have to ask the developers regarding how it is programmed. My guess is it takes into account the placement, direction, exit velocity, distance, etc. , in judging hits or outs. Obviously it doesn't account for things like errors or bad hops, but it does award infield hits/bunts if they are placed correctly at a certain speed.
In no way does it compare to a real game. After all, it is played within a cage with a pitching machine using technology to score. However, it does give certain valuable metrics and does provide statistical information. It's just better than just hitting in a cage and a lot more fun.