Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7689905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:16:24+00:00 2026-05-31T20:16:24+00:00

Code This is my little game of pig. I only got it coded for

  • 0

Code
This is my little game of pig. I only got it coded for 2 players. I have ran multiple scenarios and it seems to work out good.
I just can’t seem to exit the while loop

I am having trouble at line #109.

I set it to break, but i believe it may be break from the small if statement, which I don’t want.

I am wanting to break from the large while loop ( game loop ) line #100

I also want to use pygame to add some graphics of dice i have created.

I was wondering if I can keep my code as is and just modify it to work with pygame easily or do I have change the entire code to work with pygame?

I just want to do a simple interface
It will be similar to this : http://cs.gettysburg.edu/projects/pig/pi…

but I will add in dice, simulation of dice rolling 2d, sounds, a win state graphics and sounds, and input, mainly mouse toggle.

Any tips on how to do the pygame portion is much appreciated.

I have read many tutorials on pygame, but I just don’t feel confident to get it to work with my own game.

I have made a ball bounce, but I really don’t understand what some of pygame’s code mean.

I am a little confused on display screen vs background

screen would be pygame.display.set_mode((some size))

then background will capture the exact size of the screen, but not really sure.

I have figured out how to put dice on the screen, and change face every half a second, but that’s it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:16:25+00:00Added an answer on May 31, 2026 at 8:16 pm

    nice little program. it seems to work fine for me (break exits for and while loops, not if).

    when you play the game it’s a little confusing because the check to see if someone has won comes only after the other player plays and then you enter ‘hold’. perhaps that is what made you think it wasn’t working? it might be better (i don’t know the exact rules of pig) to put the check for winning right after the code that runs on ‘hold’?

    sorry can’t help with pygame; just wanted to post to say it seems to work.

    also, if you wanted, you could put the two players in an array:

    players = [player1, player2]
    

    and then the current player would be:

    players[player_turn-1]
    

    and you could use the same code for either player, duplicating the logic in the main loop. so the code would be more like:

    if players[player_turn-1].winner():
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

its a little bit hard to understand. in the header.php i have this code:
I have a little archer game I'm working on, and previously in my code
I have profile pages for users of my little card game, like this one
I'm writing code like this, doing a little quick and dirty timing: var sw
Ok, this situation is a little weird but anyway. This PHP code generates several
First a little intro: Last year i wrote this http://dragan.yourtree.org/code/canvas-3d-graph/ Now, i want to
I am a little confused by this snippet of code (presented in the CocoaFundamentals
I'm trying to get this piece of code working a little better. I suspect
Here's my code: #This is a game to guess a random number. import random
I want to code a little Game, dealing with fonts and letters. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.