In the Game of Pig, two opposing players attempt win by being the player with the most total points after at least one player exceeds 100 total points.
At the beginning of the game, both players have 0 total points. In each round, player 1 takes a turn, and player 2 takes a turn. The game ends if at the end of a round, at least one of the players has 100 or more points. The winner is the player with the most total points.
The player begins a turn with 0 turn points. The player rolls a six sided die. If the die roll produces a 1, then the player’s turn pointsare removed, and their turn is over. If any other number is rolled (2-6), the roll is added to the player’s turn points. The player now chooses whether to quit the turn, or continue the turn. If the player quits the turn, their turn points are added to their total points. If the player continues, then the player rolls the die again, and follows the above outline based on the value rolled.
In this assignment, you will create a computer program that will allow two users to play the Game of Pig against each other.
Click here for more details of this assignment
AssignmentThis assignment is to make your computer program guess a number that the user chooses between 1 and 1000 in no more than 10 guesses.
The algorithm used in this assignment is called a binary search. After each guess, the algorithm cuts the number of possible answers to search in half.
Your program should start by printing instructions to the screen, explaining that the user should pick a number between 1 and 1000 and the computer will guess it in no more than 10 tries. It then starts making guesses, and after each guess it asks the user for feedback. The user should be instructed to enter -1 if the computer needs to guess a lower number, 0 if the computer guessed correctly, and 1 if the computer needs to guess a higher number.
When the program guesses correctly, it should report how many guesses were required. If the user enters an invalid response, the instructions should be repeated and the user allowed to try again. You may assume that the user never gives a false answer.
(Read the full assignment here)
This quarter we are going to create simple games that you run in the terminal. You should program these games in a folder connected to your git hub to add them to your portfolio.
Mad Lib Game
The first game you will write is a mad lib game.
This course is a full year. Students will be studying the basics of computer programming. The programming tool we will use is the popular and powerful language called Python (Python.org). Students will be exploring the fundamental logical concepts of programming that apply to any programming language.