Re: Java Coin Flip Program Programming Software Development by jassonadder … flip == 'Heads': self.heads += 1 else: self.tails += 1 print("\nResults:") print("Total Heads:&…quot;, self.heads) print("Total Tails:", self.tails) # Main program try: flips = int(… Re: Coin Flip (Python Newbie) Programming Software Development by jassonadder …(coin_heads) + " were heads and " + str(coin_tails) + " were tails.") This version should now properly flip a coin 100… times and track how many heads and tails you get. Also, if you're using Python 3 (which… Re: Coin Flip (Python Newbie) Programming Software Development by Dani > Presumably bumping every "coinflip" post to spam their URL Nothing wrong with that!! I'll take a trillion helpful posts if all someone wants in exchange is a free signature link back to their website (that only shows up for logged in members, so no SEO incentive). Re: Coin Flip (Python Newbie) Programming Software Development by woooee while timesflipped < 100: timesflipped += 1 Use a for loop instead. if coin_flips == 0: And no need to add the == 0. Just *if coin_flips* (i.e. not zero) is enough Re: Coin Flip (Python Newbie) Programming Software Development by Reverend Jim When you want to do a loop a given number of times (e.g. 100) but the loop counter is not used you can do for _ in range(100): # rest of code here Re: Java Coin Flip Program Programming Software Development by Dani Better late than never! Thanks for your post. It looks like it's really helped a few people already. Re: Java Coin Flip Program Programming Software Development by Salem > It looks like it's really helped a few people already. Yeah, 4 new members with consecutive user ID's, smelling like sock-puppet accounts. Re: Java Coin Flip Program Programming Software Development by Dani > Yeah, 4 new members with consecutive user ID's, smelling like sock-puppet accounts. I realized that after I posted. I’m on my phone on the sofa so it wasn’t as easy to tell. Although I still can’t see the motivation. Edit: Nevermind. Perhaps they were trying to improve their member reputation/quality score?? (Won’t work because you need… TAILS The Amnesic Incognito Live System Hardware and Software Linux and Unix by elptuxman Have downloaded and burned TAILS both as a DVD and a booting USB stick. Other … Heads and Tails Game Programming Software Development by aree …random_integer; cout << "THE GAME OF HEAD OR TAILS" << endl; cout << "&… a++) { cout << "Call it, Heads or Tails?" << endl; cout << "h… for heads t for tails" << endl; cin >> guess;… Re: Heads and Tails Game Programming Software Development by daviddoria … no_of_plays; a++) { cout << "Call it, Heads or Tails?" << endl; cout << "h for… randomCoin; if (random_integer == 1) { cout << "coin was tails" << endl; randomCoin = 't'; } if (random_integer == 0) { … Max Consecutive Heads/Tails Programming Software Development by anandarose … the result of each flip whether it's heads or tails. I have all of that done i can't figure… step which is to display the maximum consecutive heads and tails that appear in the results from the coin toss'. Here… I have so far: [code] '10/11/2006 'Heads or tails program INPUT "How many times do you want to… Re: Max Consecutive Heads/Tails Programming Software Development by Yankie Dave …' Show Tail LET tcount = tcount + 1 ' and increase tails counter ' Now we make sure we have a value in…we check if it's a run of Heads or tails, if num = 1 then if consec > … is: " ;maxhcount PRINT "The maximum number of consecutive tails for " ; flipq; " coin flips is: "… Coin Toss Simulation, getting all Tails and one Heads Programming Software Development by Rickenbacker360 … between 0 and 1 and they represent the heads and tails respectively. If it's heads print H if it's… tails print T. [code] [COLOR=black]#include<iostream>[/COLOR] [… when I run the program it always gives me all Tails and one head. So if you have any ideas as… To create a game of Heads or Tails against the computer. Programming Software Development by turbomen …. Write a program that asks the user for Heads or Tails, then simulates a toss of a coin and then tells… coming out as zero Ask the user for Heads or Tails INPUT guess Generate a random number less than 2 call… Re: Max Consecutive Heads/Tails Programming Software Development by anandarose … appreciated. Ananda [inlinecode] 'Ananda Bennett '10/11/2006 'Heads or tails program INPUT "How many times do you want to… is: " ;maxhcount PRINT "The maximum number of consecutive tails for " ; flipq; " coin flips is: " ;maxtcounta [/inlinecode… Help Programming a heads or tails game in python Programming Software Development by ITGeEk2020 … the game to ask the user to choose heads or tails, then a coin flips and chooses either one randomly. If… Re: Help Programming a heads or tails game in python Programming Software Development by vegaseat … rn for k in range(16): print rn.choice(['heads', 'tails']) [/code] Re: TAILS The Amnesic Incognito Live System Hardware and Software Linux and Unix by rubberman Sorry, but I'm not familiar with this distribution. Taking a bootable USB stick is not a bad idea. It should work fine in foreign internet cafes, but until you try you won't know for sure. Before you boot the thumb drive, do check with the cafe proprietors as to whether they can let you do this. There may be local/national regulations that will put… Re: TAILS The Amnesic Incognito Live System Hardware and Software Linux and Unix by cereal Aside note: when you go to an internet cafe here in Italy, bring an ID document with you: the operator has to register each user, this is requested by our legislation. For this reason, you cannot use your own laptop, nor your usb distribution: because in these cases the user has the power to fake the mac address, can scan the lan... and can make it… Re: heads or tails Programming Software Development by Aia If I am making heads or tails of what you're saying what you want it is called permutation. There's lots of algorithms out there for it. Use you favorite search engine. Re: Heads and Tails Game Programming Software Development by aree Thank you! you even made it better then what I originally planning to do!! thanks! Re: Max Consecutive Heads/Tails Programming Software Development by Salem This forum is for C and C++. What you've posted seems to be visual basic. Re: Max Consecutive Heads/Tails Programming Software Development by WaltP I agree. Are they really teaching LET for VB? Or is this another version of BASIC? Maybe best in [B]Legacy and Other Languages[/B] [code] DO WHILE count < flipq LET num=INT(RND(0)*2)+1 IF num = 1 THEN PRINT "T" 'LET count = count + 1 [COLOR=red]' put this before the IF[/COLOR] 'LET tcount = … Re: Max Consecutive Heads/Tails Programming Software Development by anandarose [QUOTE=WaltP;269637]I agree. Are they really teaching LET for VB? Or is this another version of BASIC? Maybe best in [B]Legacy and Other Languages[/B] .[/QUOTE]The software is called Liberty Basic. [url]Www.libertybasic.com[/url] Re: Max Consecutive Heads/Tails Programming Software Development by anandarose [QUOTE=WaltP;269637] [code] DO WHILE count < flipq LET num=INT(RND(0)*2)+1 IF num = 1 THEN PRINT "T" 'LET count = count + 1 [COLOR=red]' put this before the IF[/COLOR] 'LET tcount = tcount + 1 [COLOR=red]' uncomment this and duplicate it for heads[/COLOR] 'LET maxtcount = tcount… Re: Max Consecutive Heads/Tails Programming Software Development by anandarose THANK YOU SO MUCH FOR YOUR HELP! :cheesy: :mrgreen: :) :!: :confused: :lol: :p Re: Coin Toss Simulation, getting all Tails and one Heads Programming Software Development by John A Consider initializing your random number generator at the beginning of your program: [code]#include <ctime> srand(time(0));[/code] Your logic is totally weird here: [code] [COLOR=black]toss--;[/COLOR] [COLOR=black] counter++;[/COLOR] [COLOR=black] toss = rand() % 1;[/COLOR][/code] It's useless to deincrement toss when it gets assigned… Re: Coin Toss Simulation, getting all Tails and one Heads Programming Software Development by WaltP Also, your [INLINECODE]coinToss()[/INLINECODE] function needs to be formatted properly. It'll only take you 30 seconds... ;) Re: Coin Toss Simulation, getting all Tails and one Heads Programming Software Development by Dani So where is the function that has no input and no return value and upon calling it asks the user how many coin tosses and then simulates that number of coin tosses?