Search Results

Search found 9122 results on 365 pages for 'sound card'.

Page 97/365 | < Previous Page | 93 94 95 96 97 98 99 100 101 102 103 104  | Next Page >

  • Blackjack game reshuffling problem

    - by Jam
    I am trying to make a blackjack game where before each new round, the program checks to make sure that the deck has 7 cards per player. And if it doesn't, the deck clears, repopulates, and reshuffles. I have most of the problem down, but for some reason at the start of every deal it reshuffles the deck more than once, and I can't figure out why. Help, please. Here's what I have so far: (P.S. the imported cards and games modules aren't part of the problem, I'm fairly sure my problem lies in the deal() function of my BJ_Deck class.) import cards, games class BJ_Card(cards.Card): """ A Blackjack Card. """ ACE_VALUE = 1 def get_value(self): if self.is_face_up: value = BJ_Card.RANKS.index(self.rank) + 1 if value > 10: value = 10 else: value = None return value value = property(get_value) class BJ_Deck(cards.Deck): """ A Blackjack Deck. """ def populate(self): for suit in BJ_Card.SUITS: for rank in BJ_Card.RANKS: self.cards.append(BJ_Card(rank, suit)) def deal(self, hands, per_hand=1): for rounds in range(per_hand): for hand in hands: if len(self.cards)>=7*(len(hands)): top_card=self.cards[0] self.give(top_card, hand) else: print "Reshuffling the deck." self.cards=[] self.populate() self.shuffle() top_card=self.cards[0] self.give(top_card, hand) class BJ_Hand(cards.Hand): """ A Blackjack Hand. """ def init(self, name): super(BJ_Hand, self).init() self.name = name def __str__(self): rep = self.name + ":\t" + super(BJ_Hand, self).__str__() if self.total: rep += "(" + str(self.total) + ")" return rep def get_total(self): # if a card in the hand has value of None, then total is None for card in self.cards: if not card.value: return None # add up card values, treat each Ace as 1 total = 0 for card in self.cards: total += card.value # determine if hand contains an Ace contains_ace = False for card in self.cards: if card.value == BJ_Card.ACE_VALUE: contains_ace = True # if hand contains Ace and total is low enough, treat Ace as 11 if contains_ace and total <= 11: # add only 10 since we've already added 1 for the Ace total += 10 return total total = property(get_total) def is_busted(self): return self.total > 21 class BJ_Player(BJ_Hand): """ A Blackjack Player. """ def is_hitting(self): response = games.ask_yes_no("\n" + self.name + ", do you want a hit? (Y/N): ") return response == "y" def bust(self): print self.name, "busts." self.lose() def lose(self): print self.name, "loses." def win(self): print self.name, "wins." def push(self): print self.name, "pushes." class BJ_Dealer(BJ_Hand): """ A Blackjack Dealer. """ def is_hitting(self): return self.total < 17 def bust(self): print self.name, "busts." def flip_first_card(self): first_card = self.cards[0] first_card.flip() class BJ_Game(object): """ A Blackjack Game. """ def init(self, names): self.players = [] for name in names: player = BJ_Player(name) self.players.append(player) self.dealer = BJ_Dealer("Dealer") self.deck = BJ_Deck() self.deck.populate() self.deck.shuffle() def get_still_playing(self): remaining = [] for player in self.players: if not player.is_busted(): remaining.append(player) return remaining # list of players still playing (not busted) this round still_playing = property(get_still_playing) def __additional_cards(self, player): while not player.is_busted() and player.is_hitting(): self.deck.deal([player]) print player if player.is_busted(): player.bust() def play(self): # deal initial 2 cards to everyone self.deck.deal(self.players + [self.dealer], per_hand = 2) self.dealer.flip_first_card() # hide dealer's first card for player in self.players: print player print self.dealer # deal additional cards to players for player in self.players: self.__additional_cards(player) self.dealer.flip_first_card() # reveal dealer's first if not self.still_playing: # since all players have busted, just show the dealer's hand print self.dealer else: # deal additional cards to dealer print self.dealer self.__additional_cards(self.dealer) if self.dealer.is_busted(): # everyone still playing wins for player in self.still_playing: player.win() else: # compare each player still playing to dealer for player in self.still_playing: if player.total > self.dealer.total: player.win() elif player.total < self.dealer.total: player.lose() else: player.push() # remove everyone's cards for player in self.players: player.clear() self.dealer.clear() def main(): print "\t\tWelcome to Blackjack!\n" names = [] number = games.ask_number("How many players? (1 - 7): ", low = 1, high = 8) for i in range(number): name = raw_input("Enter player name: ") names.append(name) print game = BJ_Game(names) again = None while again != "n": game.play() again = games.ask_yes_no("\nDo you want to play again?: ") main() raw_input("\n\nPress the enter key to exit.")

    Read the article

  • Looking for Kiosk-style / camera store easy photo memory card to CD/DVD burning program for Windows-7 Notebook? For non techie user.

    - by Rob
    I'm looking for a Kiosk-style / camera shop easy photo memory card to CD/DVD burning program? For non technie user. The kind of system you see in a camera shop / store, e.g. in the UK, Jessops and Boots stores. This is for my Dad who is adept at general PC usage as a notebook owner, but would prefer something fairly simple. The task of burning photos to CD/DVD, in their original photo file .jpg form, i.e. NOT as CD or DVD video or slideshow, is what I'm looking for. I'm guessing this might be possible in Picasa, but all the options available might be superfluous and confusing. He could probably learn to use that but thought I would try simpler options first. Looking for something that guides the user through the steps/stages of the process, 'Wizard' style. Any suggestions? Platform: HP Windows 7 Home notebook with CD/DVD burner and SD memory card slot.

    Read the article

  • Can I use PayPal to charge a Credit Card automatically?

    - by Mark
    If I have a Visa card number saved in my database, is there a way I can charge that Visa automatically through the PayPal API without the user having to enter anything? We want to keep this site as easy and hassle-free to use as possible. It would be a variable amount, based on how they use the site. (Don't worry, proper disclaimers will be in place, and the user will be notified) What about these "recurring payments"? That way I don't have to store the CC info on my website, but do they allow variable amounts that I could periodically send to PayPal?

    Read the article

  • Does all the network card use the same frequency to send signals to wire?

    - by smwikipedia
    Hi, I am comparing my cable TV wire to my network wire. In a TV cable wire, different frequencies are used by different TV channels. And since a certain channel use a fixed frequency, I think the only left way to represent different signal is with the carrier wave's amplitude. But what about the network wire? For all the network card with the same type, do they also use different frequencies to send signals just like TV cable? I vaguely remember that they use frequency adjustment to represent signals. So the frequency should not be a fixed one. So how did all the network cards that sharing the same medium differentiate their own signal from others?

    Read the article

  • how to configure IP cam to stream using right network card?

    - by robin hood
    I have IP cam that supports RTSP streaming. It's connected to router with 2 network cards with IP1 and IP2 addresses. I make 2 connections to IP cam by IP1 and IP2 addresses from the same IP and I need to receive corresponding streams thru correct network card, but both streams (RTP over UDP) go thru IP1. How this can be resolved? I don't know if RTSP server binds UDP sockets to corresponding IP and I don't know what IP stack is in IP cam (weak end system or strong end system). I haven't found anything interesting in router configuration. As I understand, routing table cannot help me cos I'm connected from the same IP, is it right? Also Sorry for incomplete info but it's all I have at the moment. Thanks for your time.

    Read the article

  • Third monitor on onboard VGA ?

    - by e-turhan
    Hello guys, I'am using dual monitor setup with a radeon 5770 vga card, also I have an onboard vga card on ASUS M4A785TD EVO mainboard. Now I want to add one more monitor to my system. Can I use the onboard vga for third monitor or I need to buy a new vga card? If I need to buy new vga card which one would you suggest for least price? I am using windows 7.

    Read the article

  • Load balancing with 2 wireless cards

    - by user2544786
    I'm thinking about building a wireless load balancer (if that makes sense). For example, the first wireless card will accept all connections for ip 192.168.1.1 and the second card will serve requests for 192.168.1.2. I know that I can assign both IPs to a single card and all requests will be served by a single wireless card. Would it be better (more bandwidth, more stable connection, etc?) to have two physical cards instead?

    Read the article

  • How to stretch the image from one screen to two screens

    - by wxiiir
    I want to be able to stretch the image from one monitor to a second monitor even if i have to use some software to do it. For example i want the top half of the image that is now shown on my first monitor to occupy the whole second monitor and i want the bottom half to occupy the whole first monitor, or the other way around i don't really care as long as it works. I would be cool to know how to do the same stuff but to the left half and right half. I know that image pixels would have twice the lenght or height this way but i don't really care about it as long as it works so basically i want the stuff to show on both monitors but with the same pixels as before. I have a hd4870 and windows7 and hd4000 family doesnt support having two monitors behaving like a large one, only hd5000 upwards, this would solve my problems without any of the drawbacks but it just can't be done (or maybe it can via software but i'm just too tired of searching). A solution to make almost any graphic card have two monitors behaving like a large one is matrox dualhead2go but that's just as expensive as a good hd5000 card so it's not worth it. thanks in advance EDIT I guess that nobody so far was able to fully comprehend my problem that was very explicitly written but i will elaborate some more. My hd4870 can have 2 monitors working with it but some stuff like games won't run on both monitors, which sucks. There are some ways to circumvent this problem and two of them are perfect or almost perfect but expensive and the third would be a software solution that would make it possible. The first one is to have and hd5000 family video card which will work just fine with both monitors. The second is to have a matrox dualhead2go that will make my hd4870 detect my two monitors as a large monitor. The third is to have a software that makes my two displays be detected as a large display and then captures the output of the video card, splits the images and renders them as 2d images to both monitors OR a simpler one but that would make outputted pixels double the width or height would be to capture the output of the graphics card to one screen, split it in two and enlarge it to fit both monitors and then output it to the monitors. p.s. By capturing the output of the video card i mean just make the video card process the stuff in a certain way. Making the video card detect two monitors as a large one via software may be a bit impossible or impracticable but stretching the output as a 2d image from one to both monitors for some coders should be a walk in the park so it would be likely that such program would exist or that some widespread softwares for dual monitor would have such function in them.

    Read the article

  • How to play sounds in locked mode on iPhone

    - by Joe Mallik
    Everybody knows the standard procedure to keep your app alive, after the user pressed the lock button (silent sound). If I start a sound with AVAudioPlayer (before the iphone is locked), the sound plays till it's end (after locking). The app is still running. If I try to start another sound while the iPhone is locked, it will never get played. All the other things work as well but the sound doesn't. How can I play a sound while the iphone is locked?

    Read the article

  • C#: What is the preferred way to handle this error?

    - by Ash
    I have a class 'Hand' that consists of two playing cards as below: public class Card { public char r, s; public Card(char rank, char suit) { r = rank; s = suit; } } public class Hand { public Card c1, c2; public Hand(Card one, Card two) { c1 = one; c2 = two; } } In a 52 card deck we can't have two identical cards. How should I deal with an error where I accidentally instance a class with two identical cards, e.g (Ah, Ah)? Thanks, Ash

    Read the article

  • Error in playing a swf file on internet explorer

    - by Rajeev
    In the below code i get an error saying Error #2007: Parameter url must be non-null on Ineternet explorer only.What am i doing wrong here html <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH="50" HEIGHT="50" id="myMovieName"> <PARAM NAME="movie" VALUE="/media/players/testsound.swf" /> <PARAM NAME="quality" VALUE="high" /> <PARAM NAME="bgcolor" VALUE="#FFFFFF" /> <EMBED href="/media/players/testsound.swf" src="/media/players/testsound.swf" flashvars="soundUrl=sound.mp3" quality=high bgcolor=#FFFFFF NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"> </EMBED> </OBJECT> mxml ; import flash.net.; import mx.controls.Alert; import mx.controls.Button; import flash.events.Event; import flash.media.Sound; import flash.net.URLRequest; private function clickhandler(event:Event):void { var musicfile:String; var s:Sound = new Sound(); s.addEventListener(Event.COMPLETE, onSoundLoaded); var req:URLRequest = new URLRequest("/opt/cloodon/site/media/players/sound.mp3"); //musicfile = stage.loaderInfo.parameters["soundUrl"]; //var req:URLRequest = new URLRequest(musicfile); s.load(req); } private function onSoundLoaded(event:Event):void { //Alert.show("1"); //var localSound:Sound = event.currentTarget as Sound; var localSound:Sound = event.target as Sound; localSound.play(); } ]]> </fx:Script> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <!--<mx:Button id="play" label="PLAY" click="clickhandler(event)" />--> <mx:Image id="loader1" source="@Embed(source='/opt/cloodon/site/media/img/speaker.gif')" click="clickhandler(event)" /> </s:Application>

    Read the article

  • Writing a simple incrementing counter in rails

    - by Trip
    For every Card, I would like to attach a special number to them that increments by one. I assume I can do this all in the controller. def create @card = Card.new(params[:card]) @card.SpecNum = @card.SpecNum ++ ... end Or. I can be blatantly retarded. And maybe the best bet is to add an auto-incremement table to mysql. The problem is the number has to start at a specific number, 1020. Any ideas?

    Read the article

  • Toggling audio on click?

    - by angela
    please look at this fiddle http://jsfiddle.net/rabelais/yLdkj/1/ The above fiddle shows three bars that on hover play audios. How do I change this so the music plays and pauses on click instead. Also if one audio is playing and another is clicked how can the already playing song pause? $("#one").mouseenter(function () { $('#sound-1').get(0).play(); }); $("#one").mouseleave(function () { $('#sound-1').get(0).pause(); }); $("#two").mouseenter(function () { $('#sound-2').get(0).play(); }); $("#two").mouseleave(function () { $('#sound-2').get(0).pause(); }); $("#three").mouseenter(function () { $('#sound-3').get(0).play(); }); $("#three").mouseleave(function () { $('#sound-3').get(0).pause(); });

    Read the article

  • Python Tkinter after loop not working fast enough

    - by user2658538
    I am making a simple metronome where it plays a tick sound every few milliseconds depending on the bpm and plays the sound using the winsound module. I use tkinter because there will be a gui component later but for now the metronome code is working, it plays the sound at a constant rate, but even though I set the after loop to play the sound every few milliseconds, it waits longer and the beat is slower than it should be. Is it a problem with the code or a problem with the way I calculate the time? Thanks. Here is my code. from Tkinter import * import winsound,time,threading root=Tk() c=Canvas(root) c.pack() class metronome(): def __init__(self,root,canvas,tempo=100): self.root=root self.root.bind("<1>",self.stop) self.c=canvas self.thread=threading.Thread(target=self.play) self.thread.daemon=True self.pause=False self.tempo=tempo/60.0 self.tempo=1.0/self.tempo self.tempo*=1000 def play(self): winsound.PlaySound("tick.wav",winsound.SND_FILENAME) self.sound=self.c.after(int(self.tempo),self.play) def stop(self,e): self.c.after_cancel(self.sound) beat=metronome(root,c,120) beat.thread.start() root.mainloop()

    Read the article

  • Writing a simple incrementer counter in rails

    - by Trip
    For every Card, I would like to attach a special number to them that increments by one. I assume I can do this all in the controller. def create @card = Card.new(params[:card]) @card.SpecNum = @card.SpecNum ++ ... end Or. I can be blatantly retarded. And maybe the best bet is to add an auto-incremement table to mysql. The problem is the number has to start at a specific number, 1020. Any ideas?

    Read the article

  • [jQuery] Descriptions on Hover

    - by Nimbuz
    <form action=""> <input type="text" value="" class="card-num" /> <input type="text" value="" class="card-cvv2"/> </form> <div class="description"> <p class="card-num">Enter your 16 digit card number</p> <p class="card-cvv2">Enter the 3 digit number at the back of your card</p> </div> All descriptions are hidden initially. But when hovered on an element that has a matching tag, display description? I'd really appreciate any help. Many thanks!

    Read the article

  • Is there a limit for the number of files in a directory on an SD card?

    - by jamesh
    I have a project written for Android devices. It generates a large number of files, each day. These are all text files and images. The app uses a database to reference these files. The app is supposed to clear up these files after a little use (perhaps after a few days), but this process may or may not be working. This is not the subject of this question. Due to a historic accident, the organization of the files are somewhat naive: everything is in the same directory; a .hidden directory which contains a zero byte .nomedia file to prevent the MediaScanner indexing it. Today, I am seeing an error reported: java.io.IOException: Cannot create: /sdcard/.hidden/file-4200.html at java.io.File.createNewFile(File.java:1263) Regarding the sdcard, I see it has plenty of storage left, but counting $ cd /Volumes/NO_NAME/.hidden $ ls | wc -w 9058 Deleting a number of files seems to have allowed the file creation for today to proceed. Regrettably, I did not try touching a new file to try and reproduce the error on a commandline; I also deleted several hundred files rather than a handful. However, my question is: are there hard limits on filesize or number of files in a directory? am I even on the right track here? Nota Bene: The SD card is as-is - i.e. I haven't formatted it, so I would guess it would be a FAT-* format. The FAT-32 format has hard limits of filesize of 2GB (well above the filesizes I am dealing with) and a limit of number of files in the root directory. I am definitely not writing files in the root directory.

    Read the article

  • java.awt -- when java outputs an image to my monitor (screen), where is the file that is output to the monitor card?

    - by user1405870
    Suppose that I am drawing a set of images using java graphics objects. Suppose that I java is outputting these images to my monitor. Where is the file or files that are sent to the monitor card (the graphical representation files). How can I take this file and save it to disk, or how can I take this file and write it to an array, or how can I take these files and combine the results of their output (to the monitor) into a single file for saving? I don't want to use a screen shot feature, I want to be able to redirect (xor capture also) the output to the monitor to some sort of byte-stream. I note that monitors are much better than semaphores, when you are talking about display capabilities; I don't need a counter example. I might not be asking the correct question. It might be that I want to capture the file while it is still in User Space, before it is put into 'Device Space'. I would like to try and capture the byte stream so that I can convert it to MPEG-4 format. I either need a streaming output from the MPEG-4 converter, coming from the streaming input, or else, I need to take static images at discrete times and convert the images. What format will the output from User Space be in? What format will the Device Space output be in? Try to keep speculation to a minimum. http://docs.oracle.com/javame/config/cdc/opt-pkgs/api/jsr927/index.html I guess that Java has made a means of displaying AWT objects on a television screen. Thank you. Ryan Zoerner

    Read the article

  • Can I use a mini PCI-E card in a standard motherboard with PCI/PCI Express slots?

    - by White Phoenix
    I'm helping someone build a computer and they absolutely insist on having an internal Bluetooth adapter. I've been searching around for a PCI-E/PCI based Bluetooth adapter but I've had no luck finding one - I've found some discontinued ones but they have giant antennas coming out the back - the person I'm building the computer for doesn't want that. I've been repeatedly insisting on him simply getting a USB Bluetooth dongle, but he doesn't want one taking up his external USB slots. This is the motherboard I'm using for his build: http://www.newegg.com/Product/Product.aspx?Item=N82E16813157303 My question is if it's possible to use one of those laptop PCI-E cards in a motherboard like this that has PCI-E and PCI slots, or if the form factor is completely different and won't fit?

    Read the article

  • how to use winpcap to send EAPOL packets on windows 7 with wireless card?

    - by caimengru0807
    I want to implement a 802.1X wireless client on Windows 7 using PEAP/MSCHAPv2. The 802.1X protocol is a data link layer protocol, it uses the EAPOL protocol to encapsulate the packets. I use the WinPcap to send and receive the EAPOL packets, however I fail to do it with the wireless NIC. It can work fine to send the EAPOL packets use wired NIC. It can also work fine to send the EAPOL packets on Windows XP using wireless NIC. So what's wrong with it on Windows 7?

    Read the article

  • Can I get 4 screens running on an ATI Radeon HD 5700 series video card?

    - by Wayne
    I have successfully run 3 displays using the 5700, but i want to run a 4th screen off the HDMI Port. Mainly I would like it to Mirror the primary monitor onto the TV connected to the HDMI Port. Any help at all would be greatly appreciated. I can get a signal to it, i just have to disable one of my original 3 monitors. Im not willing to do that. So other than disabling one of my monitors, does anyone have any suggestions?

    Read the article

  • Is it possible to provide a wired ethernet connection to external devices with an extra LAN card?

    - by Ben McCormack
    I'm trying to provide a wired ethernet connection (wireless is not an option for this device) to a device (Samsung blu-ray player) without running Cat5 cable all over the home. I have a PC sitting next to this device and the PC is connected to the network via a wireless USB adapter. Is it possible to provide a wired connection from the PC to the wired device using the (currently unused) ethernet port in the back of the computer? Here's how I envision the device getting connected to the internet via my network: Linksys WRT54G v8 Wireless Router | ``--> Windows 7 PC connected via wireless | ``--> Blu-ray player connected via wired connection to the ethernet port on the PC. If so, how is this done? Will I need a crossover cable? What settings will I need to change in Windows 7 so that the device can connect? NOTE: I'm trying to avoid having to buy a wireless bridge and/or hacking a router with an open-source firmware to get this to work. See my previous question for more details.

    Read the article

< Previous Page | 93 94 95 96 97 98 99 100 101 102 103 104  | Next Page >