mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-25 20:34:32 -08:00
Added history and porting comments
This commit is contained in:
@@ -1,3 +1,36 @@
|
||||
########################################################
|
||||
#
|
||||
# Slots
|
||||
#
|
||||
# From Basic Computer Games (1978)
|
||||
#
|
||||
# "The slot machine or one-arm bandit is a mechanical
|
||||
# device that will absorb coins just about as fast as
|
||||
# you can feed it. After inserting a coin, you pull a
|
||||
# handle that sets three indepent reels spining. If the
|
||||
# reels stop with certain symbols appearing in the pay
|
||||
# line, you get a certain payoff. The original slot
|
||||
# machine, called the Liberty bell, was invented in 1895
|
||||
# by Charles Fey in San Francisco. Fey refused to sell
|
||||
# or lease the manufacturing rights, so H.S. Mills in
|
||||
# Chicago built a similar, but much improved, machine
|
||||
# called the Operators Bell. This has survived nearly
|
||||
# unchanged to today.
|
||||
# On the operators Bell and other standard slot
|
||||
# machines, there are 20 symbols on each wheel but they
|
||||
# are not distributed evenly among the objects(cherries,
|
||||
# bar, apples, etc). Of the 8000 possible combinations,
|
||||
# the expected payoff(to the player) is 7049 or $89.11
|
||||
# for every $100.00 put in, one of the lowest expected
|
||||
# payoffs of all casino games.
|
||||
# In the program here, the payoff is considerably more
|
||||
# liberal; indeed it appears to favor the player by 11%
|
||||
# -- i.e., an expected payoff of $111 for each $100 bet."
|
||||
# The program was originally written by Fred Mirabelle
|
||||
# and Bob Harper
|
||||
#
|
||||
########################################################
|
||||
|
||||
from random import choices
|
||||
from collections import Counter
|
||||
import sys
|
||||
@@ -112,3 +145,15 @@ while keep_betting:
|
||||
keep_betting = False
|
||||
|
||||
final_message(profits)
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# Porting notes
|
||||
#
|
||||
# The selections of the fruits(Bar, apples, lemon, etc.) are made
|
||||
# with equal probability, accordingly to random.choices documentation.
|
||||
# It could be added a weights list to the function and therefore
|
||||
# adjust the expected payoff
|
||||
#
|
||||
######################################################################
|
||||
|
||||
Reference in New Issue
Block a user