Questions tagged [coin-flipping]

Coin flipping is the process of programmatically simulating a coin flip, that is randomly picking a choice among two possibilities.

Coin flipping is the process of programmatically simulating a coin flip, that is randomly picking a choice among two possibilities.

118 questions
0
votes
2 answers

How can I get a list with m tails? Python

So I need to create a list with m tails. The elements of the list will be a random choice between tail and head. I did like : Def S(m): list=[] counter=0 signs=["head","tail"] while counter<(m): …
werlless
  • 47
  • 6
0
votes
0 answers

C# flipping mainwindow

this is my very first entry here, may it not be the last.... I am having a bit of a struggle with some GUI stuff. I really have an animation up front my eyes and it should look like the following: using c# with desktop application. This Form looks…
0
votes
1 answer

Declaring a winner in a coin toss game

So, I'm running into an issue with the end of this program. It is supposed to award ten points for each correctly guessed coin flip, and at the end of the 100 tosses, a percentage of correct answers for each player as well as a total score, and…
0
votes
2 answers

Coin Toss JavaScript with user input

Write a program to simulate a coin toss. First, ask the user to "call" or predict the toss. Next, let the user know you are tossing the coin. Then report whether the user was correct. Example: Please call the coin toss (h or t): h Tossing... …
user9465883
0
votes
2 answers

Why my loop doesnt work properly in my coin toss game?

I've started a bachelor degree in a computer science related field so I ought to code and everything is quite new for me, but I guess we all started from scratch. I'm having a hard time making my code function the way it should. I have to program a…
Vas
  • 13
  • 3
0
votes
1 answer

How to use coin-slider plugin dynamically?

i have used coin slider for my application.My application supported for all resolution .But if i wants to use coin-slider i have to be set width or else it takes its default width 585.But according to my application i have to be set width…
0
votes
2 answers

Longest expected head streak in 200 coinflips

I was trying to calculate the expected value for the longest consecutive heads streak in 200 coin flips, using python. I came up with a code which I think does the job right but it's just not efficient because of the amount of calculations and data…
0
votes
2 answers

generate sum of results in python

We have a game, the game consists of 500 rounds. In each round, two coins are being rolled at the same time, if both coins have 'heads' then we win £1, if both have 'tails' then we lose £1 and if we have a situation where one coin shows 'heads' and…
0
votes
3 answers

Python - Repeat a biased coin flip experiment

I'm trying to write a function that simulates X number of biased coin flip experiments (H=0.6, T=0.4), which consists of N coin flips, to answer the question "What is the expected value of the number of groups after N coin flips." Group, by…
0
votes
2 answers

How do I make a coin flip race in getting two heads and two tails consecutively in Java

I just started coding with more complex methods than the main method. I was given an assignment to make a race with three coins. Whichever coin flips 2 heads and 2 tails first in that order wins. I coded an if else statement to determine which coin…
Nub
  • 85
  • 1
  • 3
  • 11
0
votes
1 answer

Understanding Event Coincidence Analysis from CoinCalc R package

I have two binarized events (eventA and eventB), I want to know if there is any coincidence in these two events. So I'll use the new Package CoinCalc to investigate the potential relation between these two. library(CoinCalc) #note that the package…
LuluPor
  • 165
  • 1
  • 11
0
votes
1 answer

Print number of times while loop executes

In the following code, the while loop will print the value of z until z reaches 0 or 11, as its value is added or subtracted to by flips of a fair coin. How would one also make this function print the number of times the coin is flipped? z <-…
the_darkside
  • 5,688
  • 7
  • 36
  • 83
0
votes
1 answer

How to display associative array in a table?

Can anyone help me? I'm writing a script for a "Luck Game" with the objectives Take user input of any number they wish, generate a random number from 0 to the number they input and display it in a result array. Simulate a game of "Heads or Tails"…
5120bee
  • 619
  • 1
  • 10
  • 28
0
votes
5 answers

Coin toss using random numbers does not appear exactly random

I wanted a random number generator to simulate a coin toss and here's what i did public class CoinToss { public static void main(String args[]) { int num=(int)(1000*Math.random()); if(num<500) …
adeen-s
  • 156
  • 5
  • 13
0
votes
3 answers

Why is Python not printing out the correct answers?

I cant understand why Python is not printing out how many heads and tails there have been in my coin toss game? and is consistently printing out 0, 100 # part 2 import random heads = 0 tails = 0 flip_coin = ['heads', 'tails'] while (heads + tails)…
NewUser123
  • 35
  • 6