This question is impossible to completely answer, thanks to FIFA's Law Five, which enumerates all authority to the referee. He can do what he wants, basically, so there's no way to simulate every referee's behavior in response to every action that merits a foul.
However, there are certain procedures to follow in certain cases. If the ball is kicked completely over the touch line (sideline, goal line, whatever you want to call it), the team that didn't kick it out is awarded a throw-in at that spot.
Fouls are a different matter, though. They are general violations of personal conduct on the field. They can include hand balls, pushing, shielding off the ball, punching, elbowing, etc. Based on the severity of the misdeed, either a direct or an indirect free kick is awarded to the team that did not commit the foul. An indirect kick is a free kick that requires a teammate's touch before it can be scored. Basically, a direct kick can be a shot on goal, whereas an indirect kick has to be a pass. If a foul is committed within the goal box, the other team is awarded a penalty kick, which is a direct kick taken twelve yards from the center of the opposing team's goal.
Also, if the foul is severe enough, the referee has the power to award yellow and red cards (bookings). A yellow card, usually awarded for somewhat severe foul, is known as a "caution," primarily because it doesn't do anything. Two yellows equal a red card, though, and a red results in automatic and permanent ejection from the match. Red cards can be given without having earned two yellows, though. This is called a straight red, and is generally awarded for exceptionally flagrant offenses.
The technicalities of bookings vary from league to league and tournament to tournament. For example, in the World Cup, a yellow card is merely a caution of a red card, and the only danger in racking up single yellows throughout the tournament is a predetermined number of yellows each player is allowed to accrue before he or she is suspended. However, in high school American games, the yellow card sends a player off the field until the team's next substitution.
Clearly, the specifics of bookings are rather ambiguous, but just remember that two yellows equal a red, and a red is an automatic and permanent ejection from the match.
Chat with our AI personalities
Player can receive penalties, a foul, Technical Foul (more serious, 2 Technicals and you are ejected)
According to the NBA rules, you may be ejected by breaking one of these rules
EXCEPTION: Rule 12A--Section V--l(5)
l. A player, coach or trainer must be ejected for:
(1) A punching foul
(2) A fighting foul
(3) An elbow foul which makes contact above shoulder level
(4) An attempted punch which does not make contact
(5) Deliberately entering the stands other than as a continuance of play
The other team is given possession of the ball and depending on the type of foul committed the other team may be awarded with free throw oppourtunities
If it's a violation on the defense, the other team keeps the ball and they just inbound the ball again. If it's a violation on offense, the other team gets the ball.