Questions tagged [simulation]

Simulation is the imitation of some real thing, state of affairs, or process. The act of simulating something generally entails representing certain key characteristics or behaviours of a selected physical or abstract system.

Filter by
Sorted by
Tagged with
1 vote
1 answer
329 views

Rock Climbing Simulation Game

I am a rock climber so I made a rock climbing game. I have two conceptual objects; the climber and the route. I ended up putting them both into a single Climber ...
Erich Purpur's user avatar
9 votes
2 answers
243 views

Simulating surname convergence in a population

I was curious a few weeks ago about how surnames come and go (mostly on the go). I wanted to know how quickly surnames die out, because (in my simplified simulation world) once the last person with a ...
Drise's user avatar
  • 255
11 votes
3 answers
3k views

Coding exercise to simulate animal population

(This is all available in a github repo if that's easier: https://github.com/paulnicholsen27/SpeciesSimulator) I am submitting this as a code sample for a possible job, so I'm just looking for any ...
thumbtackthief's user avatar
4 votes
1 answer
700 views

Concise Proof of the Monty Hall Problem in R

This is an attempt at a concise proof of the Monty Hall problem in probability and statistics in R. For those unfamiliar, the scenario is this: There exists a contestant on a game show. This ...
Miller's user avatar
  • 533
4 votes
1 answer
519 views

C++ Grid gravity simulation opzimization (Kattis Falling Apples)

I have a solution for the Kattis Falling Apples problem (link). The input is a grid of R rows (up to 50000) by C columns (up to 10). At each timestep, apples (indicated by ...
Oreborous's user avatar
  • 141
7 votes
2 answers
1k views

The performance of the simulation for an ant's random walk on a 5x5 grid

I have written a simulation in order to solve the 280th problem in Project Euler, and the simulation basically repeat the given experiment 5m times, and for each experiment, writes the ExpNo - #...
Our's user avatar
  • 171
1 vote
2 answers
121 views

Calculating the connectance of a matrix iteratively

I have a performance issue in R. I have a function that iterates over a dataframe for different levels of "site" and "method". The function samples 1:1000 interactions (rows), converts these to ...
user avatar
1 vote
1 answer
1k views

A 3D Random walk simulation

I was referring to the book Computational Physics by Nicholas J. Giordano and was studying the simple Random Walk model. (Pg. 169 - 173) I consider a 3D Random Walk where the probability of moving in ...
Indranil Ghosh's user avatar
5 votes
1 answer
988 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 ...
Erotokritos Vallianatos's user avatar
4 votes
2 answers
1k views

Rolling 100-sided "dice" until they are the same number

I've just begun my journey into python (1 week now) and I've written couple of lines incorporating everything I've learned so far. It would be greatly appreciated if anyone could guide me in writing a ...
John Lee's user avatar
3 votes
1 answer
151 views

Simulated race among three robots making random steps

At a job interview, I was asked to code the following algorithm: Given are three robots which advance across a 1km lane at a different pace respectively. Each pace made by a robot is of a random ...
gnzg's user avatar
  • 133
3 votes
2 answers
646 views

Simulating a system of moving points

This is an update of the code from my previous question. I'm simulating a system of particles which interact with each other and move and rotate due to the interaction. There are 2000 particles in ...
codder code's user avatar
2 votes
0 answers
1k views

Lotto simulator in Python

I wrote a rather inapt lotto simulator in Python, showing how long it would take to win the jackpot. I ran a similar application implemented in C and it is so much faster. I know you can't compare the ...
royskatt's user avatar
  • 203
8 votes
2 answers
444 views

Hotel power management

A Hotel needs to reduce the overall power used by the equipments installed in its many floors. So the Hotel Management has installed sensors, like Motion Sensors, etc at appropriate places .I have to ...
Tiny Rick's user avatar
  • 329
1 vote
2 answers
394 views

Simulation of interacting particles [closed]

I'm simulating a system of particles which interact with each other and move and rotate due to the interaction. There are 2000 particles in total but each particle interacts with other particles and ...
Oliver Range's user avatar
9 votes
2 answers
3k views

A C++ library for simulating logical circuits

I have this library/program that allows a client programmer to simulate logical circuits. Without further ado, here is my code: AbstractCircuitComponent.hpp ...
coderodde's user avatar
  • 27k
2 votes
2 answers
3k views

Simulating motion of particles

Description The code does particle simulation. In this code, some particles take steps with a certain distribution length. if particles go beyond a curve, the code put them back. Code ...
codder code's user avatar
4 votes
2 answers
4k views

Simulates flipping a coin repeatedly and continues until however many consecutive heads are tossed

This program simulates flipping a coin repeatedly and continues until however many consecutive heads are tossed. I'm wondering if there are any issues when initializing a variable in a ...
Alexander John's user avatar
4 votes
2 answers
2k views

Generating stock prices using geometric brownian motion

I am writing a c++ class of "A simple least squares approach" by Longstaff and Schwartz. I have only finished writing a function for creating the stock price paths using geometric brownian motion. I ...
Wolfy's user avatar
  • 219
2 votes
1 answer
121 views

Analog watch simulation

I wrote an analog watch simulation in C# and Monogame as exercise. The application consists of a background texture. On top of that I have the hour-, minute- and second hand. The program gets its ...
Gustaf's user avatar
  • 75
3 votes
0 answers
1k views

A Java library for simulating logic circuits

I have this Java library for building logic circuits and running binary data through them: AbstractCircuitComponent.java ...
coderodde's user avatar
  • 27k
3 votes
2 answers
2k views

Counting consecutive streaks in random numbers

I heard that when you toss a die often enough, you could get the value "one" a million times in a row. I am a beginner in Python 3 and I tried to write a little program that generates 1 or 2 randomly ...
Dexter Thorn's user avatar
  • 2,154
2 votes
1 answer
1k views

Simulation study in R with two variables and 10000 iterations

The generic version of what I am trying to do is to conduct a simulation study where I manipulate a few variables to see how that impacts a result. I'm having some speed issues with R. The latest ...
Josh's user avatar
  • 31
11 votes
2 answers
5k views

C++ Beginner Bunny Exercise

I recently completed (somewhat) an exercise I found on a C++ forum. The exercise is found at the end of the list of exercises and is called "Graduation" and is about bunnies in a linked list. ...
Equilibrium's user avatar
1 vote
1 answer
260 views

Closed particle system simulation in vanilla Javascript

I have ported my simulation from Java to vanilla Javascript. The most important aim was to keep the sum of all energies constant. I have this: simulation.js ...
coderodde's user avatar
  • 27k
3 votes
2 answers
5k views

Designing a call center in object oriented way

Description: Below is one of the interview practice question. I think questions like these are to test the candidate's capability to write object oriented code. I being a candidate right now don't ...
CodeYogi's user avatar
  • 5,087
4 votes
3 answers
1k views

Simulating a closed particle system in Java

I have this program that simulates a closed particle system. Closed in this context means that the sum of all energies is constant. My primary concern is code itself, yet I would like to hear comments ...
coderodde's user avatar
  • 27k
2 votes
1 answer
443 views

Dice roll simulator (updated) created using Python 3.5 and PyQt5

...
DaveyH-cks's user avatar
8 votes
2 answers
3k views

UEFA Champions League Draw Simulator

I'm new to Python and have written a UEFA Champions League draw simulator. It receives input for 32 teams from 14 countries, and then randomly distributes them into groups of 4, never putting two ...
MuckinAround145's user avatar
7 votes
1 answer
2k views

Python CS GO Case Simulator

I'm a beginner in Python, 1-2 months experience. Please assess my code. I used a dictionary to store cases. The cases_data is stored in another file. Is the structuring right? My code seems to have a ...
Ali S's user avatar
  • 73
3 votes
1 answer
234 views

Monopoly Movement Simulation

A few days ago, I read something to the effect of "everyone knows orange tiles are the most frequently landed on of any property". I was skeptical of this claim, so I decided to test it! This program ...
Carcigenicate's user avatar
1 vote
1 answer
290 views

Coin tossing simulation to get x heads in a row, ten times - timely at higher amount of heads

I have created a program to simulate a coin being tossed to land on heads/tails x amount of times in a row, where x can be defined by the user. The program then gets x amount of heads in a row, a ...
August Williams's user avatar
4 votes
1 answer
324 views

(SBCL) ASCII Game of Life

I'm implementing Conway's Game of Life in Lisp to familiarize myself with the language, with the eventual goal of hosting it on a website with a pretty GUI. I'm a hobbyist and inexperienced (this is ...
plishplop's user avatar
5 votes
0 answers
794 views

Customizable Multi-Agent Predator/Prey Simulation

I am trying to create a highly customizable "battle simulator". The default setup is a predator/prey relationship (no births); however, I am trying to create code such that it's easy to add and ...
Swerve's user avatar
  • 51
3 votes
2 answers
363 views

Investment/betting simulation

I am creating an investment/betting simulation; since is the first I create , I am sure it can be done better, both from a coding and a simulation point of view. I would like to ask you what you ...
CronosVirus00's user avatar
11 votes
4 answers
4k views

Doodlebug vs. ant population simulation

I am looking for a review on one of my homework assignments for this semester. This homework has already been submitted and graded and my final has already been submitted so there is no cheating or ...
StormsEdge's user avatar
2 votes
0 answers
609 views

Routing simulation (Distance vector)

I am trying to write simulation for routing algorithm by distance vector. I will explain my class and how it works a bit, and then, introduce three main issues I encouter. Important to mention that ...
Unknown's user avatar
  • 63
2 votes
2 answers
5k views

My first Physics Engine C++

I have made my first physics engine for simulating circles in a plane. Let me know what you think about it. ...
Harmohit Singh's user avatar
7 votes
1 answer
187 views

Random Dice Simulation

I extended the example in 04-random.elm to support N dice and to draw the results using SVG. ...
Dušan Rychnovský's user avatar
5 votes
1 answer
2k views

Monty Hall Simulator - Python

I'm pretty new to Python (I've been doing it for about 4 months, but not every day) and I've been struggling to get to grips with how to use functions and deploy them efficiently to solve problems. ...
Nellington's user avatar
7 votes
1 answer
912 views

Monty Hall simulation with any number of doors

After answering Monty hall python simulation I wondered what the outcome were to be if there were more than three doors, say four or seven. And so I decided to modify the problem slightly to adjust ...
Peilonrayz's user avatar
  • 42.8k
22 votes
4 answers
7k views

C++ Coin flip simulator and data collector

Asks the user for the chance of a coin landing on heads, the number of trials per experiment, and the number of experiments. For example, given 5 trials per experiment and 20 experiments, the program ...
Daniel's user avatar
  • 323
6 votes
4 answers
1k views

Monty hall python simulation

I have the following code that simulates the monty hall problem (see google for more details). I used sets to do it but is there a more intuitive or efficient way to do it? ...
user3079275's user avatar
10 votes
2 answers
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 ...
user91656's user avatar
  • 383
6 votes
4 answers
2k 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 ...
Explosion's user avatar
  • 171
7 votes
1 answer
3k views

4-Bar Mechanism Generation

For a school project, I will design and prototype a bicycle brake that uses a four-bar linkage to accomplish its goal. My Python 3 code does this mechanism generation, and implements methods to ...
syb0rg's user avatar
  • 21.8k
3 votes
1 answer
480 views

Lissajous pattern simulator

I had seen a YouTube video making actual Lissajous patterns with sand falling from a pendulum with 2 different periods and looking in the Wikipedia page the looked very easy to simulate. I made a ...
Caridorc's user avatar
  • 27.4k
7 votes
1 answer
7k views

Football game simulation

I'm working on a text-based football simulation game along the lines of Football Simulator. Below is a subset of my total code, specifically the functions used to create a new player. I also have ...
drewd423's user avatar
  • 171
6 votes
3 answers
748 views

Distance and force calculation for a molecular dynamics simulation

I'm writing an MD-like simulation and I'm having some difficulties in making this code run faster. I profiled the code using callgrind and kcachegrind, and it appears I'm using about 30% of my time on ...
K. Kim's user avatar
  • 71
6 votes
1 answer
248 views

Simple game outcome simulator

I am trying to improve the performance of a monte carlo search algorithm that simulates random gameplays in a simple optimization game until a time limit is reached, and then returns the best outcome. ...
Ukster's user avatar
  • 61

1 2 3
4
5
8