All Questions
Tagged with simulation c
13
questions
5
votes
4answers
1k views
Monte Carlo estimation of π
My C program uses the Monte Carlo method to approximate the mathematical constant π, the ratio of a circle's circumference to its diameter (and, importantly for this code, 4 times the ratio of a ...
4
votes
0answers
152 views
Fast Hardy-Weinberg equilibrium simulation
I was very bored over one of my breaks this year, so I built a Hardy-Weinberg equilibrium simulator for two unrelated alleles of the same gene. Hardy-Weinberg equilibrium is when there is no evolution,...
1
vote
1answer
433 views
Galton Board Simulation
This program is written for Windows 7 under MinGW using gcc.
I'm seeking recommendations for improving the program's portability.
...
5
votes
1answer
883 views
CPU scheduling simulator
Recently I completed my first assignment at the university. The assignment is :
Write a CPU scheduling simulator that uses the Shortest Job First and Priority scheduling methods. Both of these ...
10
votes
2answers
1k views
Powerball Lottery Simulator in C
I made a Powerball lottery simulator in C. I chose C because it is fast.
Here's how it plays:
The user plays one ticket every day.
The user can choose to play the same ticket every day or a ...
24
votes
4answers
11k views
Simple Turing machine simulator
Yesterday I got a sudden urge to go from writing Python to something, well, more UNIX core-ish. I read some examples on here and decided I might as well put some of that stuff to use to test something ...
7
votes
1answer
708 views
Ad hoc implementation of cruise control
I've written a small C program that has ad hoc implementation of cruise control for my Altera DE2 FPGA. It works alright but there are too many global variables. Preferably there should be no global ...
5
votes
2answers
919 views
Human (imperfect) array (card) shuffle written in C
I've got this humanoid_shuffle I wrote in Python. I've been wanting to learn C so as an exercise I ported it to C. As this is my first venture into C and even the ...
6
votes
1answer
231 views
Statistical simulation
I've written the following program as a submission to the German Federal Computer Science Competition for highschool students. The program makes the following simulation with a given number of days ...
1
vote
2answers
434 views
Adding very large arrays
I am writing a stochastic simulation for a Yule process:
If you start with a certain number of bins each containing a random number of balls, you add another ball to an existing bin with a ...
8
votes
2answers
298 views
Improvements/suggestions for my CPU emulator
I am trying to emulate a basic CPU (Z80) as close as possible. It currently does not read real assembly code, but that will be implemented. If you have any views on how that could be implemented, I'...
3
votes
2answers
317 views
Bouncing-ball simulation
I posted a couple questions about a week ago, but have almost gotten it working. This program is supposed to simulate the following:
Ask the user how many balls to drop
Drop one ball at a time
Allow ...
4
votes
1answer
1k views
Is this an elegant/accurate simulation of the Monty Hall problem?
I'm trying to simulate the Monty Hall problem, to statistically determine if there is any benefit to changing my choice after a door containing a goat is open (testing this guy's Monty Hall theory on ...