program Vingt-et-un is a dice game (known as Blackjack in the USA), where a player competes against the computer (house). The goal of the game is to score 21 points, or as near as possible without going over. The two players take turns throwing two dies as many times as desired and adding up the numbers thrown on each round. A player who totals over 21 is bust and loses the game. The player whose total is nearest 21, after each player has had a turn, wins the game. In the case of an equality high total, the game is tied. The game is over at the end of a round when: One or both players are bust. Both players choose to stay. Notes Once a player totals 14 or more, one of the dies is discarder for the consecutive turns. The house must throw the dice until the total is 17 or higher. At 17 or higher, the house must stay. Project Requirements The program will start by prompting the user for the name of the player. The game will be implemented using a menu-driven interface that provides the following options: See the Rules. Play Vingt-et-un. Quit. If the user chooses 1 from the menu, display the rules of the game. If the user chooses 2 from the menu Go into a loop of rounds where player & house will take turns throwing the dice. At each turn the system will ask the player/house whether to stay or roll. If the house has a running total of 17 or higher, it stays, and the turn passes to the player. If the player/house option is to roll, the program simulates the roll of the two dies and updates & displays the player’s running total. If the player/house starts the round with an accumulated total of 14 points or more, only one die will be rolled. Once the game is over the system will display the result Winner Loser Tie If the user chooses 3 from the menu, display a good-bye message and quit. The users can play the game as many times as they wish until they choose 3 to Quit. For PYTHON

Respuesta :

Program Vingt-et-un is a dice game

#import modules

import random

#define variables

playerName = ""

playerTotal = 0

houseTotal = 0

dice1 = 0

dice2 = 0

menuOption = 0

#display the menu

def displayMenu():

   print("\nVingt-et-un Game Menu \n")

   print("1. See the rules. \n")

   print("2. Play Vingt-et-un. \n")

   print("3. Quit. \n")

#get the name of the player

def getPlayerName():

   global playerName

   playerName = input("Please enter your Name: ")

#display the rules of the game

def showRules():

   print("Vingt-et-un is a dice game where a person faces off against the computer (known as Blackjack in the USA) (house). The objective of the game is to score 21, or as close to it as you can without going over. The two players alternately toss two dice as many times as they like, summing up the results after each round. If a player's total exceeds 21, they bust and lose the round. After each player has had a turn, the game is won by the one whose total is closest to 21. The game is tied if both teams have a high total. When either one or both players are bust, the round is done and the game is ended. Both players decide to continue.")

#roll the dice

def rollDice():

   global dice1

   global dice2

   dice1 = random.randint(1,6)

   dice2 = random.randint(1,6)

   print("Dice 1: " + str(dice1))

   print("Dice 2: " + str(dice2))

#calculate the players total

def calculatePlayerTotal():

   global playerTotal

   global dice1

   global dice2

   playerTotal += dice1 + dice2

   print("\nYour total is: " + str(playerTotal))

#calculate the house total

def calculateHouseTotal():

   global houseTotal

   global dice1

   global dice2

   houseTotal += dice1 + dice2

   print("\nHouse total is: " + str(houseTotal))

#player turn

def playerTurn():

   global playerTotal

   while True:

       playerChoice = input("\nDo you want to stay or roll? (s/r): ")

       if playerChoice == "s":

           print("\nYou chose to stay.")

           break

       elif playerChoice == "r":

           if playerTotal >= 14:

               rollDice()

               calculatePlayerTotal()

           else:

               rollDice()

               calculatePlayerTotal()

       else:

           print("\nPlease enter either s or r.")

#house turn

def houseTurn():

   global houseTotal

   while True:

       if houseTotal >= 17:

           print("\nHouse chose to stay.")

           break

       else:

           rollDice()

           calculateHouseTotal()

#print the winner

def printWinner():

   global playerTotal

   global houseTotal

   if playerTotal > 21:

       print("\n" + playerName + " is bust. House won!")

   elif houseTotal > 21:

       print("\nHouse is bust. " + playerName + " won!")

   elif playerTotal == houseTotal:

       print("\nIt's a tie.")

   elif playerTotal > houseTotal:

       print("\n" + playerName + " won!")

   else:

       print("\nHouse won!")

#main function

def main():

   global menuOption

   getPlayerName()

   while menuOption != 3:

       displayMenu()

       menuOption = int(input("\nPlease select an option (1-3): "))

       if menuOption == 1:

           showRules()

       elif menuOption == 2:

           playerTurn()

What is program?

 Program is a set of instructions that are followed by a computer to execute a task or perform a specific function. Programs are typically written using a programming language, composed of a set of instructions that a computer can understand and execute. Programs range from simple, single-line commands to complex and lengthy applications. Programs are essential for the operation of modern computers, as they provide the instructions that allow computers to perform useful tasks, such as running software applications, processing data, and connecting to the internet.

to learn more about program

https://brainly.com/question/28224061

#SPJ4