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.

364 questions
Filter by
Sorted by
Tagged with
1 vote
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 ...
• 205
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 ...
• 255
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 ...
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 ...
• 533
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 ...
• 141
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 - #...
• 171
1 vote
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 ...
1 vote
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 ...
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 ...
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 ...
• 43
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 ...
• 133
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 ...
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 ...
• 203
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 ...
• 329
1 vote
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 ...
• 129
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 ...
• 27k
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 ...
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 ...
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 ...
• 219
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 ...
• 75
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 ...
• 27k
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 ...
• 2,154
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 ...
• 31
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. ...
• 602
1 vote
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 ...
• 27k
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 ...
• 5,087
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 ...
• 27k
443 views

...
• 281
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 ...
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 ...
• 73
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 ...
• 16.2k
1 vote
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 ...
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 ...
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 ...
• 51
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 ...
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 ...
• 589
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 ...
• 63
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. ...
187 views

Random Dice Simulation

I extended the example in 04-random.elm to support N dice and to draw the results using SVG. ...
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. ...
• 175
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 ...
• 42.8k
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 ...
• 323
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? ...
• 277
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 ...
• 383
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 ...
• 171
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 ...
• 21.8k
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 ...
• 27.4k
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 ...
• 171
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 ...
• 71