Various scripts

Polyomino generator

Will generate random Polyominos ("tetris blocks") of any size. Source code
Below an example of a 250-square "tetris" block.
                  #     ###
                # ## #######
                ############
      ###      ########   ####
     #####    ######   ##  ##
     ######    #############
     #####   ###############
        ############   ###
        ############    ##
         ##########
       ############
      ###### ######
     ######  ## ###
     ######  ###
    ## #####  ##
   ##  ### #
   ##  ### #
    #  # ###
##  #  #####
############
  ##########
   # #######
  ###### #
     #

Rule 30 pattern generator

A one-dimensional cellular automaton generating the pattern below. Source code
##  #  ## ## ####  ######### ### ####  ## #  ##### ## #  ###    #   ## ##  #### 
# ######  #  #   ###         #   #   ###  ####     #  ####  #  ### ##  # ###   #
# #     ####### ##  #       ### ### ##  ###   #   #####   ######   # ### #  # ##
# ##   ##       # ####     ##   #   # ###  # ### ##    # ##     # ## #   #### # 
  # # ## #     ## #   #   ## # ### ## #  ### #   # #  ## # #   ## #  ## ##    ##
 ## # #  ##   ##  ## ### ##  # #   #  ####   ## ## ####  # ## ##  ####  # #  ## 
 #  # #### # ## ###  #   # ### ## #####   # ##  #  #   ### #  # ###   ### ####  
##### #    # #  #  #### ## #   #  #    # ## # ####### ##   #### #  # ##   #   # 
      ##  ## #######    #  ## ######  ## #  # #       # # ##    #### # # ### ## 
#    ## ###  #      #  #####  #     ###  #### ##     ## # # #  ##    # # #   #  
 #  ##  #  ####    #####    ####   ##  ###    # #   ##  # # #### #  ## # ## ####
##### ######   #  ##    #  ##   # ## ###  #  ## ## ## ### # #    ####  # #  #   
#     #     # ##### #  ##### # ## #  #  ######  #  #  #   # ##  ##   ### #####  
 #   ###   ## #     ####     # #  #######     ########## ## # ### # ##   #    # 
### ##  # ##  ##   ##   #   ## ####      #   ##          #  # #   # # # ###  ###
    # ### # ### # ## # ### ##  #   #    ### ## #        ##### ## ## # # #  ###  
#  ## #   # #   # #  # #   # #### ###  ##   #  ##      ##     #  #  # # ####  ##
####  ## ## ## ## #### ## ## #    #  ### # ##### #    ## #   ######## # #   ### 
#   ###  #  #  #  #    #  #  ##  #####   # #     ##  ##  ## ##        # ## ##  #
## ##  #############  ######## ###    # ## ##   ## ### ###  # #      ## #  # ###
   # ###            ###        #  #  ## #  # # ##  #   #  ### ##    ##  #### #  
  ## #  #          ##  #      ########  #### # # #### #####   # #  ## ###    ###
 ##  #####        ## ####    ##       ###    # # #    #    # ## ####  #  #  ##  
## ###    #      ##  #   #  ## #     ##  #  ## # ##  ###  ## #  #   ######### ##
#  #  #  ###    ## #### #####  ##   ## ######  # # ###  ###  ##### ##         # 
 #########  #  ##  #    #    ### # ##  #     ### # #  ###  ###     # #       ###
 #        ###### ####  ###  ##   # # ####   ##   # ####  ###  #   ## ##     ##  
###      ##      #   ###  ### # ## # #   # ## # ## #   ###  #### ##  # #   ## # 

Monty Hall problem simulator

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice? The answer is yes as shown by this script. Source code
Tried playing the game 1000 times.
Swapping rendered 672 wins and 328 losses.
Not swapping rendered 328 wins and 672 losses.

Knapsack problem solver

Chotchkies restaurant
-Appetizers-
Mixed fruit	 2.15
French fries     2.75
Side salad       3.35
Hot wings        3.55
Mozarella sticks 4.20
Sampler plate    5.80
You know you'll be having a bad day if a customer asks, "We'd like exactly $15.05 worth of appetizers, please."
This knapsack solver will print all solutions to the problem. Source code
We're trying to order exactly 1505 cents worth of appetizers.
Possible solutions are:
hot wings, hot wings, mixed fruit, sampler plate
mixed fruit, mixed fruit, mixed fruit, mixed fruit, mixed fruit, mixed fruit, mixed fruit