Calendar April 25, 2015 10:29

Blogger Blogger

Yahtzee Assignment Version 1.5


So I don't know if you can tell the difference, but I kept working on my Yahtzee assignment from last night and I have added two more buttons: New Game and Quit. These buttons do exactly what they say, one lets you start a new game without quitting the game and the other lets you quit the game.

I should add that there are now three ways to quit the game: pressing the esc button on your keyboard, pressing the red x on the window, or pressing the new quit button.

The New Game button was probably the trickiest one to make since I had to make it so it would reset everything correctly. Mainly resetting your score to 100 (this was easy) and resetting the value of the dice to 1. This took me a bit to figure out, but I did it.

I still haven't been able to implement the loss window that checks after every round if your points are 0 or lower.

I will continue to work on this and hopefully have a new version done in a few days. That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar April 25, 2015 01:50

Blogger Blogger

Yahtzee With a Twist - Homework 7 Finished

So I have finished the last homework assignment for my Python class. This doesn't mean that I'm done with the class, since we still have to finish our final project, but at least this was the last single assignment.

This time around we had to build on top of the last assignment and make a full blown Yahtzee game, but we had to add a few extra rules. For example, there is now 7 dice and 4 rolls per round. There is also new scoring or win conditions since there are more dice involved with the game.

This time around there is too much code involved with this assignment that I will not display all the code on this entry like usual. Instead if you would like to look my code, feel free to go here:

https://github.com/fushinoryuu/DiceGame.git

This time I uploaded my code for the assignment to GitHub and made it public, this way if anyone really wants to look at the code they can just download it and open it in IDLE or PyCharm. Here are a few screenshots from my program:

How the game looks like on start-up.

How the game looks like when you won a round.

At the time that I wrote this entry I turned in my assignment, but I didn't have time to finish all the things I wanted to include. I still have to add a way for the player to start a new game at any time without quit the game and a button to quit the game at anytime. I also need to check for a loss state if the player's points go to 0 after a round is over.

I will continue to work on it and update it. If you are interested in this, you should be able to see the latest version of game with the GitHub link above. That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar April 22, 2015 02:30

Blogger Blogger

Texture Tuesday - April 21



So I haven't posted anything in a while for Texture Tuesday, mainly because I have been very busy with work.

This time I used Substance Designer to make this simple texture. I have to say that its really cool that I was able to make this in about an hour when it would have taken me much longer to do it all. Its also cool that I was able to make the normal and diffuse maps in the same application without jumping back and forth between multiple applications.

Anyways, that's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar April 16, 2015 01:08

Blogger Blogger

Pascal's Triangle Extra Credit Assingment

After doing some research, I finally finished another extra credit assignment. We have to create a small program that would make a given amount of rows in Pascal's Triangle.

I went a step further and made it so the user can actually decide how many rows they want generated. And it gives the user a chance to run the program again and choose how many rows again.

That's all for now, thanks for reading!

Here is my code:

Replies 0 Comments Reply Reply

Calendar April 1, 2015 21:49

Blogger Blogger

Version Control for our Final Project

If any of you have started to write code for your project, you may have already ran into the same problem that we did on how we are going to share the code and make sure that everyone has the most updated version with the least amount of trouble.

We tried to use DropBox, but this didn't really work for us so I looked into GitHub and we have decided to use it for our final project. The advantage to using GitHub is that a lot of studios use similar systems for version control and it will give us exposure to tools that industry pros use.

This will first require everyone in your team to set up a GitHub account, which is free. Since we are all students, you can also go to https://education.github.com/pack (Links to an external site.) and apply for a student pack that will give you access to a higher tier of GitHub for free that normally cost money. The advantage to this student account, is that you are able to make up to 5 private repositories, otherwise any repositories that you make on GitHub will be public and anyone can view your code. But the student account is not required for this to work.

Once everyone has an account, only ONE person from your team will have to go set up the repository on GitHub. There is a simple tutorial on the website on how to set up the repository. You will then be able to add people as "contributors" to the project.

Here is steps that I wrote on how to get GitHub and Pycharm to work on your computer. There is some initial set-up required, but it won't be too bad:
1. Download and install the latest version of Pycharm 4.0.6: https://www.jetbrains.com/pycharm/download/ (Links to an external site.) Don't open Pycharm until you have completed step 2.

2. Download and install GitHub for Windows: https://windows.github.com/ (Links to an external site.) Once this has been installed, it will ask you for you login information for your account. Once you have entered that information, you can exit the program.

3. When you open Pycharm for the first time, it will ask you what you want to do on the "Welcome Window". Fist go to: "Configure" -> "Settings" -> "Version Control" -> "GitHub"

4. Make sure the "Host" is "github.com (Links to an external site.)" and then type in your username and password for your GitHub account. Click on the "Test" button to make sure your login information is correct, and then click "Apply" at the bottom.

5. Under the same section of "Version Control", go to "Git".

6. On the section where it asks for the "Path to Git executable" you will have to change the path to the exe file.

7. The exe file can be found under: C:\Users\<username>\AppData\Local\GitHub\PortableGit_<numbersandletters>\bin\git.exe Make sure that you update the parts that are in red text to the correct information on your system.

8. Click on the "Test" button to make sure that the exe file runs. If its successful, then you can click "Ok" at the bottom and go back to the original welcome screen.

9. Once that has been set up, now you are ready to download the code from GitHub. Click on "Check out from Version Control" and select "GitHub" from the little drop-down list.

From here it really simple to clone the repository from GitHub. It will ask you for a "Master Password", this is a new password you are making for your system that will be used anytime that you need to get or push changes to the code. It doesn't have to be the same as your GitHub account, but it can.

You will also have to choose a place to clone the repository. I would suggest that you save it to your Documents and you don't have to make a new folder, but you can if you want. Once that is done, you will be able clone the repository and it will download all the files on the repository (if any).

You will be able to add new Python files to your project in Pycharm, and you will be able to push and pull changes to the code using the "VCS" menu in Pycharm at the top of the window. Or you can use "Ctrl + T" to pull and "Ctrl + K" to push/commit changes to the code.

If you guys have any questions, just let me know. Thanks for reading!

Replies 0 Comments Reply Reply

Calendar March 16, 2015 22:51

Blogger Blogger

Studying for Python Mid-Term

So I will have my mid-term for my Python class soon and I wanted to share a script that will most likely be on the test.

This semester we have been working a little with Pygame, and this script uses Pygame to load an image and essentially change the color of the image depending on the color temperature. Here is what I have:


Here is what I got from this script:

Before and After
Pygame is still really new to me, but its really cool to be able to do this. Anyways, that's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar March 13, 2015 23:21

Blogger Blogger

Graphic Dice - Homework 6 Finished

This week we had to turn in the homework for making a set of graphic dice using Pygame. We had to make a total of 3 files that would work. Below are the three files that I made: a class file, an interface, and the main game file.


I will have to go back and fix some of the code since if I scale down the size of the window, the position of the dice breaks and it doesn't look like it should.

That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar March 10, 2015 21:52

Blogger Blogger

Final Project - Group Created

So a couple weeks ago we got some details on what our final project for our Python class will be. Essentially we will be building on top of some past assignment and build our own game using Pygame. 

My team started to brainstorm some ideas and today we had a Skype meeting to finalize what we will be doing. Here are the game ideas we had:

Christian:

Here is my idea. We could do a top-down space shooter. This way we don’t have to worry about animating any of the sprites we use for the game. If we nail down the idea, it could also give us a bunch of time to polish the game and get the level design just right.

http://static.gamesradar.com/images/mb//GamesRadar/us/Games/R/Raiden%20III/Everything%20Else/PS2/2007-04-24/raideniii_04--screenshot_large.jpg

Steve:

I really like that idea, I think we could have one, or maybe even two solid levels and it would be great!

My idea is that we could make a simple 2d side-scroller platformer that we could do a level or two in. That would keep most animation down to either going left or going right, and a jump or death animation.

Hiro:

Those are some awesome ideas. I was thinking we could do something like a simple 2D, 3rd person shooter type game like this:

http://www.crazymonkeygames.com/Boxhead-The-Zombie-Wars.html

The setting can be completely like space or medieval or stuff like that. I know the animation and coding will be kind of tough but I think if we can figure how to randomly make sprites appear and start moving it would be a pretty cool game.

Final Idea:

Top Down Shooter that will switch to vehicle combat. We are still not sure if it will be a plane, but it will be a vehicle where the player has another mode of playing. The player will start by walking around and killing enemies as the player moves to the goal. We plan on having a few different types of enemies and weapons.

At this time everything is very basic and open, but this is the basic idea of what we are planning to do and we think it will be a good project. That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar March 10, 2015 03:41

Blogger Blogger

Grey Fox Helmet - ZBrush Sculpt

So for this week we had to make a hard surface model of some kind in ZBrush, so I decided to make some fan art of Grey Fox's helmet.

In my model I tried to make it look like he had been in a fight and part of it was damaged. I will have to go back and add more damage since at the moment its a little too smooth for it to be real. Anyways, here is what I have so far:



Anyways, that's all for now and thanks for reading!

Replies 0 Comments Reply Reply

Calendar February 25, 2015 01:21

Blogger Blogger

Obama ZBrush Caricature

Front

Side

This week we had to submit a caricature of a famous person for our homework, I decided to do a ZBrush model of President Obama.

I did this bust using Dynamesh and then did a quick polypaint coat. That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar February 23, 2015 23:34

Blogger Blogger

Python Extra Credit Assignment - EC0

So I had some free time today and I decided to do one of the extra credit assignments for my python class.

The assignment is to write two different variations of functions that take in two numbers and compares them returning True if they are the same value and False if not. The trick is that we can't use the regular cooperators. Ex: ==, >=, <=, >, <, !=, etc. 

I decided to use "is" and "is not" to compare the input by the user. Here is the code I wrote and thanks for reading:


#EC0_ChristianMunoz.py
#02/23/2015

import sys
import time

def sleeper(seconds):
    """This functions suspends the thread for a given amount of seconds."""
    time.sleep(seconds)


def make_list(user_input):
    """This function takes the input by the user and makes it into a list."""
    user_input = user_input.split()
    return user_input


def play_again():
    """This function will run the next session if the user wants to continue."""
    decision = input("Would you like to play again? Y/N\n").lower()

    if decision == "yes" or decision == "y":
        main()
    elif decision == "no" or decision == "n":
        print("See you later!")
    else:
        print("That is not a valid entry!\n")
        play_again()

def variation_one(list):
    """This function uses the Identity Comparison "is" to compare both number."""
    if int(list[0]) is int(list[1]):
        return True
    else:
        return False


def variation_two(list):
    """This function uses the Identity Comparison "is not" to compare both number."""
    if int(list[0]) is not int(list[1]):
        return False
    else:
        return True


def main():
    player_input = input("Enter two numbers that you would like to compare:\n")
    player_input = make_list(player_input)
    print("Variaton one is :",variation_one(player_input))
    print("Variaton two is :",variation_one(player_input))
    play_again()


if __name__ == "__main__":
    main()
    sleeper(1.0)
    sys.exit()

Replies 0 Comments Reply Reply

Calendar February 21, 2015 04:02

Blogger Blogger

Blackjack & Yahtzee - Homework 5 Finished

So this week's homework was to build upon a couple different homework assignments, mainly making a simple Blackjack game out of the "card game" we made a few weeks ago and to add a way to track your Yahtzee score without losing it between games and without using global variables.

The score for Yahtzee was really simple, but Blackjack was really challenging and I think that I couldn't have done the scoring of cards better since its hard coded at this time and the function has to switch through a bunch of different if statements.

This time around I used Pycharm, which is a really nice IDE for Python. Folding code and having the IDE correct you while you are coding makes it a lot easier than having to dig through a text editor to figure out what you did wrong!

We also had to draw up a design paper that would explain how you build the process of the game. It doesn't have to be perfect, but it was just to illustrate that you put some thought into how we build the game. Here is mine:


Anyways, here is what I made and thanks for reading:



#Assignment005_ChristianMunoz.py
#02/20/2014

import random
import math
import sys
import time


def sleeper(seconds):
    """This function suspends the thread for a given amount of seconds."""
    time.sleep(seconds)


def make_deck():
    """Makes the list of Cards"""
    card_symbols = '''AS AH AD AC
                      KS KH KD KC
                      QS QH QD QC
                      JS JH JD JC
                      10S 10H 10D 10C
                      9S 9H 9D 9C
                      8S 8H 8D 8C
                      7S 7H 7D 7C
                      6S 6H 6D 6C
                      5S 5H 5D 5C
                      4S 4H 4D 4C
                      3S 3H 3D 3C
                      2S 2H 2D 2C'''
    card_symbols = card_symbols.split()
    return card_symbols


def shuffle_deck(input_decks):
    """This function shuffles the deck of cards"""
    random.shuffle(input_decks)

    return input_decks


def roll_die():
    """Assigns a random number to the dice"""
    return random.randint(1, 6)


def make_reroll_list(player_input):
    """Makes the list of which dice to roll"""
    #tempString = tempString.split()

    #return tempString
    return [int(s) for s in player_input.split()]


def score_dice(dice_list, y_score):
    """Score the player's current set of dice."""
    #temp_score = y_score
   
    for i in range(1, 6):
        count_i = dice_list.count(i)
        #checks for Yahtzee
        if count_i == 5:
            y_score += 50
            print("YAHTZEE!\nYour Score is:", y_score, "\n")
            return y_score

        #checks for Four of a Kind
        elif count_i == 4:
            y_score += 25
            print("FOUR OF A KIND!\nYour score is:", y_score, "\n")
            return y_score

        #checks for Full House or Three of a Kind
        elif count_i == 3:
            for j in range(1, 6):
                if dice_list.count(j) == 2:
                    y_score += 30
                    print("FULL HOUSE!\nYour score is:", y_score, "\n")
                    return y_score
            else:
                y_score += 20
                print("THREE OF A KIND!\nYour score is:", y_score, "\n")
                return y_score

    #checks for Small Straight
    small = [1, 2, 3, 4, 5]
    for s in small:
        if s not in dice_list:
            break
    else:
        y_score += 35
        print("SMALL STRAIGHT!\nYour score is:", y_score, "\n")
        return y_score

    #checks for Large Straight
    large = [2, 3, 4, 5, 6]
    for l in large:
        if l not in dice_list:
            break
    else:
        y_score += 40
        print("LARGE STRAIGHT!\nYour score is:", y_score, "\n")
        return y_score

    #this just adds the faces together
    y_score += sum(dice_list)
    print("CHANCE!\nYour score is:", y_score, "\n")
    return y_score


def query_reroll():
    """Ask the use which dice they want to reroll."""
    reroll_list = input("Which die/dice would you like to reroll? Or just press enter to keep what you have.\n")
    reroll_list = make_reroll_list(reroll_list)
    return reroll_list


def reroll_dice(dice_list, reroll_list):
    """Reroll the given dice."""
    for r in reroll_list:
        dice_list[r - 1] = roll_die()
    dice_list.sort()


def deal_card(deck,hand):
    """This function will check if the deck has enough cards and then deal one card.
        In order to stop people from counting cards, this functions shuffles a new
        deck if it goes below 26 cards"""
    if int(len(deck)) > 26:
        hand.append(deck.pop())
        return deck, hand
    else:
        print("The deck is getting low, shuffling a new deck!\n.")
        deck = make_deck()
        deck = shuffle_deck(deck)
        sleeper(.5)
        print("..")
        sleeper(.5)
        print("...\n")
        sleeper(.5)

        print("The deck has been shuffled!\n")
        hand.append(deck.pop())
        return deck, hand


def get_values(hand):
    """Get the value of the cards"""
    aces = 0
    score = 0

    aces += int(hand.count("AS"))
    aces += int(hand.count("AH"))
    aces += int(hand.count("AD"))
    aces += int(hand.count("AC"))

    for card in hand:
        if card == "2S" or card == "2H" or card == "2D" or card == "2C":
            score += 2
        elif card == "3S" or card == "3H" or card == "3D" or card == "3C":
            score += 3
        elif card == "4S" or card == "4H" or card == "4D" or card == "4C":
            score += 4
        elif card == "5S" or card == "5H" or card == "5D" or card == "5C":
            score += 5
        elif card == "6S" or card == "6H" or card == "6D" or card == "6C":
            score += 6
        elif card == "7S" or card == "7H" or card == "7D" or card == "7C":
            score += 7
        elif card == "8S" or card == "8H" or card == "8D" or card == "8C":
            score += 8
        elif card == "9S" or card == "9H" or card == "9D" or card == "9C":
            score += 9
        elif card == "10S" or card == "10H" or card == "10D" or card == "10C":
            score += 10
        elif card == "JS" or card == "JH" or card == "JD" or card == "JC":
            score += 10
        elif card == "QS" or card == "QH" or card == "QD" or card == "QC":
            score += 10
        elif card == "KS" or card == "KH" or card == "KD" or card == "KC":
            score += 10

    if aces == 1 and score <= 10:
        score += 11
    elif aces > 0 and score > 10:
        score += aces

    return score


def blackjack(y_score):
    """This function will run the card game"""
    player_hand = []
    dealer_hand = []

    deck = make_deck()

    print("Shuffling the deck\n.")
    sleeper(.5)
    print("..")
    sleeper(.5)
    print("...\n")
    sleeper(.5)

    deck = shuffle_deck(deck)

    print("The deck has been shuffled, we are ready to start!\n")

    deck, player_hand = deal_card(deck,player_hand)
    deck, dealer_hand = deal_card(deck,dealer_hand)
    deck, player_hand = deal_card(deck,player_hand)
    deck, dealer_hand = deal_card(deck,dealer_hand)

    player_total = get_values(player_hand)
    dealer_total = get_values(dealer_hand)

    print("Your hand is: ", player_hand)
    print("Dealer's top card is: ", dealer_hand[0])

    if player_total == 21:
        print("You got BLACKJACK!\n")
        sleeper(.5)
        print("The dealer has revealed his full hand: ", dealer_hand)
        sleeper(.5)
        if player_total == dealer_total:
            print("\nThis is a DRAW!\n")
            play_again(y_score)
        else:
            print("\nYou WIN!\n")
            play_again(y_score)
    else:
        while player_total <= 21:
            decision = input("Would you like to HIT or STAY? H/S\n").lower()
            if decision == "h":
                print("You have decided to HIT!\n")
                deck, player_hand = deal_card(deck,player_hand)
                player_total = get_values(player_hand)
                print("Your hand is: ", player_hand)
                if player_total > 21:
                    print("BUST!\nYou LOST\n")
                    sleeper(.5)
                    play_again(y_score)
            elif decision == "s":
                print("You have decided to STAY!\n")
                sleeper(.5)
                break

    print("The dealer has revealed his full hand: ", dealer_hand)
    sleeper(1.0)

    if player_total == 21 and player_total == dealer_total:
        print("This is a DRAW!\n")
        play_again(y_score)
    elif dealer_total == 21:
        print("The dealer got BLACKJACK!\nYou LOST!\n")
        play_again(y_score)
    elif dealer_total > 16:
        print("You got: ", player_total)
        print("The dealer got: ", dealer_total)
        if player_total > dealer_total:
            print("\nYou WIN!\n")
            play_again(y_score)
        else:
            print("\nYou LOST\n")
            play_again(y_score)
    else:
        while dealer_total <= 16:
            print("The dealer has to HIT again!\n")
            sleeper(1.0)
            deck, dealer_hand = deal_card(deck,dealer_hand)
            dealer_total = get_values(dealer_hand)
            print("The dealer's hand is: ", dealer_hand)
            if dealer_total > 21:
                print("The dealer got a BUST!\nYou WIN!")
                play_again(y_score)
        print("You got: ", player_total)
        print("The dealer got: ", dealer_total)
        if player_total > dealer_total:
            print("\nYou WIN!\n")
            play_again(y_score)
        else:
            print("\nYou LOST\n")
            play_again(y_score)


def yahtzee(y_score):
    """This function will run the yahtzee game."""
    print(" ")

    dice_list = [roll_die() for i in range(0, 5)]
    dice_list.sort()

    print("First roll you got:", dice_list, "\n")

    reroll_list = query_reroll()
    reroll_dice(dice_list, reroll_list)
       
    print("Second roll you got:", dice_list, "\n")

    reroll_list = query_reroll()
    reroll_dice(dice_list, reroll_list)

    print("Third roll you got:", dice_list, "\n")

    y_score = score_dice(dice_list, y_score)

    play_again(y_score)


def play_again(y_score):
    """This function will run the next game if the player wants to start again"""
    decision = input("Would you like to play again? Y/N\n").lower()

    if decision == "yes" or decision == "y":
        main(False, y_score)
    elif decision == "no" or decision == "n":
        print("See you later!")
    else:
        print("That is not a valid entry!\n")
        play_again(y_score)


def main(first_time, y_score):
    if first_time == True:
        player_input = eval(input("Press 1 to play the Blackjack or 2 for Yahtzee:\n"))

        #This makes sure that  the number will always be an integer
        player_input = math.floor(player_input)

        #This checks to make sure the entry is a valid entry
        if player_input < 1 or player_input > 2:
            print("That is not a valid entry!\n")
            main(True,y_score)

        #If the entry was valid, then execute code
        elif player_input == 1:
            print("You have chosen Blackjack!\n")
            blackjack(y_score)
        else:
            print("You have chosen Yahtzee!")
            yahtzee(y_score)
    else:
        player_input = eval(input("Press 1 to play the Blackjack or 2 for Yahtzee:\n"))

        #This makes sure that the number will always be an integer
        player_input = math.floor(player_input)

        #This checks to make sure the entry is a valid entry
        if player_input < 1 or player_input > 2:
            print("That is not a valid entry!\n")
            main(False, y_score)

        #If the entry was valid, then execute code
        elif player_input == 1:
            print("You have chosen Blackjack!\n")
            blackjack(y_score)
        else:
            print("You have chosen Yahtzee!")
            yahtzee(y_score)


if __name__ == "__main__":
    main(True,0)
    sleeper(1.0)
    sys.exit()


Replies 0 Comments Reply Reply

Calendar February 18, 2015 22:46

Blogger Blogger

A Blackjack of all Trades

So this week we have build upon the homework we have done on previous weeks and make a text based Blackjack game along with our Yahtzee game that was build before.

The assignment specifies that for the Yahtzee game we have to find a way to make the game memorize the player's total score for all the Yahtzee games he/she has played without using variable.

I know that I will have to go back and make a few changes, but for now this is what I have and thanks for reading:



#Assignment005_ChristianMunoz.py
#02/18/2014

import random
import math
import sys
import time


def sleeper(seconds):
    """This function suspends the thread for a given amount of seconds."""
    time.sleep(seconds)


def makeListOfCards(stringOfCards):
    """Makes the list of Cards"""
    listOfCards = stringOfCards.split()

    return listOfCards


def shuffleDeck(inputDecks):
    """Shuffle code"""
    shuffledDeck = []

    for i in range(len(inputDecks)):

        tempInt = random.randint(0,len(inputDecks) - 1)
        shuffledDeck.append(inputDecks.pop(tempInt))

    return(shuffledDeck)


def roll_die():
    """Assigns a random number to the dice"""
    return random.randint(1, 6)


def make_reroll_list(player_input):
    """Makes the list of which dice to roll"""
    #tempString = tempString.split()

    #return tempString
    return [int(s) for s in player_input.split()]


def score_dice(dice_list, y_score):
    """Score the player's current set of dice."""
    temp_score = y_score
   
    for i in range(1, 6):
        count_i = dice_list.count(i)
        #checks for Yahtzee
        if count_i == 5:
            temp_score += 50
            print("YAHTZEE!\nYour Score is:", temp_score, "\n")
            return temp_score

        #checks for Four of a Kind
        elif count_i == 4:
            temp_score += 25
            print("FOUR OF A KIND!\nYour score is:", temp_score, "\n")
            return temp_score

        #checks for Full House or Three of a Kind
        elif count_i == 3:
            for j in range(1, 6):
                if dice_list.count(j) == 2:
                    temp_score += 30
                    print("FULL HOUSE!\nYour score is:", temp_score, "\n")
                    return temp_score
            else:
                temp_score += 20
                print("THREE OF A KIND!\nYour score is:", temp_score, "\n")
                return temp_score

    #checks for Small Straight
    small = [1, 2, 3, 4, 5]
    for s in small:
        if s not in dice_list:
            break
    else:
        temp_score += 35
        print("SMALL STRAIGHT!\nYour score is:", temp_score, "\n")
        return temp_score

    #checks for Large Straight
    large = [2, 3, 4, 5, 6]
    for l in large:
        if l not in dice_list:
            break
    else:
        temp_score += 40
        print("LARGE STRAIGHT!\nYour score is:", temp_score, "\n")
        return temp_score

    #this just adds the faces together
    temp_score += sum(dice_list)
    print("CHANCE!\nYour score is:", temp_score, "\n")
    return temp_score


def query_reroll():
    """Ask the use which dice they want to reroll."""
    reroll_list = input("Which die/dice would you like to reroll? Or just press enter to keep what you have.\n")
    reroll_list = make_reroll_list(reroll_list)
    return reroll_list


def reroll_dice(dice_list, reroll_list):
    """Reroll the given dice."""
    for r in reroll_list:
        dice_list[r - 1] = roll_die()
    dice_list.sort()


def blackjack():
    """This function will run the card game"""
    decksToShuffle = eval(input("Enter how many decks you would like to shuffle at once (1-5):  "))

    print(" ")

    #This makes sure that the number will always be an integer
    decksToShuffle = math.floor(decksToShuffle)

    #This checks to make sure the entry is a valid entry
    if decksToShuffle <= 0 or decksToShuffle > 5:
        print("That is not a valid entry!")

        print(" ")
       
        cardGame()

    #If the entry was valid, then execute code
    else:
        CardSymbols = '''AS AH AD AC
                         KS KH KD KC
                         QS QH QD QC
                         JS JH JD JC
                         10S 10H 10D 10C
                         9S 9H 9D 9C
                         8S 8H 8D 8C
                         7S 7H 7D 7C
                         6S 6H 6D 6C
                         5S 5H 5D 5C
                         4S 4H 4D 4C
                         3S 3H 3D 3C
                         2S 2H 2D 2C'''
       
        listOfCards = makeListOfCards(CardSymbols) * decksToShuffle

        print("Shuffling the deck\n.")
        sleeper(.5)
       
        print("..")
        sleeper(.5)

        print("...")
        sleeper(.5)

        print(" ")
       
        print(shuffleDeck(listOfCards))

        print(" ")

        play_again()


def yahtzee(y_score):
    """This function will run the yahtzee game."""
    temp_score = y_score
    print(" ")

    dice_list = [roll_die() for i in range(0, 5)]
    dice_list.sort()

    print("First roll you got:", dice_list, "\n")

    reroll_list = query_reroll()
    reroll_dice(dice_list, reroll_list)
       
    print("Second roll you got:", dice_list, "\n")

    reroll_list = query_reroll()
    reroll_dice(dice_list, reroll_list)

    print("Third roll you got:", dice_list, "\n")

    temp_score = score_dice(dice_list, temp_score)

    play_again(temp_score)


def play_again(y_score):
    """This function will run the next game if the player wants to start again"""
    temp_yscore = y_score
    decision = input("Would you like to play again? Y/N\n").lower()

    if decision == "yes" or decision == "y":

       player_input = eval(input("Press 1 to play the Blackjack or 2 for Yahtzee:\n"))

       #If the entry was valid, then execute code
       if player_input == 1:
            print("You have chosen Blackjack!\n")
            blackjack()
       else:
            print("You have chosen Yahtzee!")
            yahtzee(temp_yscore)
    else:
        print("See you later!")


def main(first_time):
   
    y_score = 0

    player_input = eval(input("Press 1 to play the Blackjack or 2 for Yahtzee:\n"))

    #This makes sure that the number will always be an integer
    player_input = math.floor(player_input)

    #This checks to make sure the entry is a valid entry
    if player_input < 1 or player_input > 2:
        print("That is not a valid entry!\n")
        main()

    #If the entry was valid, then execute code
    elif player_input == 1:
        print("You have chosen Blackjack!\n")
        blackjack()
    else:
        print("You have chosen Yahtzee!")
        yahtzee(y_score)


if __name__ == "__main__":
    main(True)
    sleeper(1.0)
    sys.exit()

Replies 0 Comments Reply Reply

Calendar February 16, 2015 17:38

Blogger Blogger

Building My PC - It Has a Home!

Before
After
So I finally moved my computer to its permanent home for the foreseeable future. I can't wait to start making 3D art and playing games. Thanks for reading!

Replies 0 Comments Reply Reply

Calendar February 13, 2015 15:30

Blogger Blogger

Building My First PC - It's Alive!


So my computer is finally up and running. I stayed up last night really late hooking up all the wires, and finally getting the courage to start it up and hope that I didn't plug something in the wrong socket. It all worked and I was able to start the BIOS on the computer and set up the operating system followed by a bunch of drivers. I have now finished downloading League of Legends and this my first game on my computer.

For my monitor I decided that I wanted an LED monitor, so I bought the ASUS VN247 monitor, and so far it looks great. I also am so excited to be running SLI on my computer, because it means that I will be able to push higher graphics on games.

At this time my computer is just sitting on my dinning table, so I will have to find a home for it. That's all for now, thanks for reading!

Replies 0 Comments Reply Reply