# 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.

363 questions
Filter by
Sorted by
Tagged with
73 views

### Improving performance for social network simulation program

I'm an undergraduate student with little to no experience in formal computer science or coding, and I specialise in quantitative social science research. Our professor asked us to fabricate some ...
1 vote
46 views

### Optimize narrow phase contact detection for phyiscs simulation code

I'm trying to optimize the narrow phase of the contact detection in my code. I'm using OpenMP for multithreading. That is the starting code: ...
• 111
139 views

### A simple multithreaded openrct2 maze simulator

I found these two videos by Marcel Vos: (1) (2) that show how you can make hedge mazes that are very hard for the simple roller coaster tycoon 2 park guest AI to solve. Long story short, he eventually ...
• 33
2k views

### Python - 2D Elastic Collision Simulation

I am currently a Python beginner, who just finished a script simulating collisions between circles (balls) in 2 dimensions. I would appreciate comments on overall structure, variable names and really ...
• 151
60 views

### How can I shorten the runtime of my simulation?

Before you read the code below, note the following explanation: I have three classes: Driver, Vehicle, and ...
172 views

### Hex boardgame with fast random rollouts (OpenAI gym framework)

I implemented the boardgame Hex using the OpenAI gym framework with the aim of building a bot/AI player that can learn through self-play and expert iteration (details Note: not my paper; I am merely ...
• 1,051
75 views

### Monte Carlo Simulation of a Markov Process

A 1D binary string has the following dynamics $$1100 \to 1010,\quad 1101\to 1011$$ each with rate $p<1$. That is if we see $110$ in the string, then we change to $101$ with probability $p$....
1 vote
287 views

### Given the arrival times of people at a door, resolve their passage times

I was trying to solve the following question: You are given 2 arrays: one representing the time people arrive at a door and other representing the direction they want to go (in or out) You have to ...
• 177
60 views

### Ensure that column names in output retain original variable names, instead of using arbitrary X1, X2, etc

Is there a more elegant way to ensure that colnames(output) of a output R dataframe retains the original column variable names ...
• 61
1k views

### Monty Hall implementation

To get a feel of Monty Hall problem, I've implemented Monty Hall simulator in Python, using only two strategies: never switch the door or always switch the door. Please review it with an eye towards ...
261 views

### Maxwell's distribution using Box-Muller transform

I am given the following problem to solve (This text is translated from Russian. So, there may be some translation issues): ... Another method to draw from the normal distribution is to draw two ...
• 575
1 vote
45 views

### conditional simulation(path dependent simulation) in R

My codes are not good, I want to konw how to solve my problem efficicently and learn writing some elegant R codes.Thanks in advance! "r" is the starting value in ...
103 views

### Dangers of increasing fishing on a fish population simulation

Setup The following code implements the algorithm described in this and this paper. The first paper describes how the evolution of a fish population can be simulated, while the second paper introdues ...
• 384
1 vote
132 views

### Monte Carlo Simulation of "DNA Mutation" Game Mechanic

The game Space Station 13 (on the Paradise Station codebase) contains a DNA mechanic. Every carbon-based lifeform with DNA has 55 "blocks" that can be altered in a DNA Modifier, giving the mob ...
• 43
898 views

### C++/SFML Boid/Flocking Simulation

I have created a flocking simulation based on Craig Reynolds Boids. Could you give me some feedback on my code? I am a newbie and would really appreciate some criticism. Files: Boid - this is the ...
• 151
310 views

### Simulation of virus growth

The gist of my program is to simulate the growth of some virus. I used (attempted) OOP concepts to break down the problem into chunks and have the chunks talk to each other. Not sure if my ...
189 views

### Molecular dynamics simulation

I'm looking for some fresh ideas on how to optimize a couple of functions in my C++ code. I run the code through a profiler and it shows that they take 20% and 40% of the time respectively. The ...
• 33
1 vote
67 views

### Simulation of Central Limiting Theorem (CLT)

The following is the simulation of Central Limiting Theorem from Statistics: ...
• 575
1 vote
63 views

### Statistical sampling from a vector

I have written a function/script to simulate data for sample size estimation. The following code samples from a vector of generated values with varying numbers of sample sizes and then concatenates ...
• 111
1k views

### N-Body Gravitational Simulation of Point-Masses in Python

I made an n-body gravitational simulation in python. The algorithm does produce an approximate solution, which is shown at the bottom of the post. Additional methods to produce animations (among other ...
296 views

### A type of game simulation dropping disks

Quincunx is that little game where you drop a ball or disk down rows of nails in a pyramid formation until they land in a slot. This was a project for my class, but it's already been submitted. I am ...
243 views

### Generating Infinite Procedural Terrain Using Command-Line Graphics

Continuing my trend of (ab)using the Windows command-line interface to do fancy graphics-related things with my command-line-graphics library, CLIGL, I've created an infinite procedural terrain ...
• 15.8k
178 views

### Gamblers ruin, parallel compute trials

Context The following script is a quick implementation of the gambler's ruin problem. For each given upper bound on the number of rounds in a game max_iter, ...
• 153
1 vote
82 views

### Simulation to find the minimum number of patrollers to cover a wall

Problem description Scarpi, who owns a restaurant, decided to remodel it with his friends because the interior of the restaurant is too old. The place where the restaurant is located is a ...
• 31
7k views

### Simple n-body class in C++

As part of my training, I implemented a n-body class in C++ to simulate gravitational interaction of bodies and to get more familiar with features that C++ offers such as object oriented programming. ...
• 1,125
4k views

• 405
304 views

### Particle simulator using Python - Why is the NumPy version slower than pure Python?

This is an interesting example from G.Lanaro's book, Python High Performance. The program is a simple simulator which describes movement of particles based on their positions and angular velocities (<...
• 159
1 vote
2k views

### Bank account class

Simple object-oriented, money management code where a user can deposit money in, withdraw from, show, and exit the balance. ...
• 605
1k views

### Schelling's model of Segregation Python implementation with Geopandas (Follow-up)

This is the repost of the following question as suggested by @HoboProber . Again, if you don't know what is Schelling's model of segregation, you can read it here. The Schelling model of ...
263 views

### Champions League Simulation [closed]

Here is my first attempt at creating a full Champions League Simulation, including drawing the groups and subsequent games and playing all matches. The code is very, very long and I am sure there must ...
• 349
5k views

### Fast Food Order Simulator

I have been trying learn OOP lately, and have made a simple program that simulates some sort of drive thru experience using a 9 digit keypad to add, delete, and pay for items ordered from the menu. ...
• 359
1k views

### Chip8 Emulator in C++

I wrote this chip8 emulator as practice recently since my coursework is mostly console programs. I've tested it with roms off Zophar's Domain and it appears to work with my limited testing. I'm hoping ...
349 views

I was hoping to get some feedback on my basic recreation of the google homepage. Im doing the Odin Project learning course and this was the first project trying to use the basics of HTML/CSS HTML ...
• 505
6k views

### Premier League simulation

I've created a simulator for the Premier League, which takes in all of the 20 teams and plays them against each other, recording the results and outputting a table at the end. The skill levels are ...
• 349
312 views

### Simplified three-body simulation

The code below simulates a given Newtonian 3 body system. Each row per slice is supposed to represent a Cartesian component for the initial trajectory vector and for the distance vectors to the other ...
• 153
554 views

### Schelling's model of Segregation Python implementation with Geopandas

If you don't know what is Schelling's model of segregation, you can read it here. The Schelling model of segregation is an agent-based model that illustrates how individual tendencies regarding ...
34 views

### Simulation of splitting particles (MATLAB - Fortran) [closed]

I'm trying to write a code where a charged particle (charge=+20 called dimers), after a certain time, will split into a neutral particle and a smaller charged particle (charge=-10 called monomer). I ...
• 121
122 views

### Monty Hall problem in Python3

Some years ago I made a Monty Hall simulations in Java, and now I decided to give it a go in Python, after learning (yet another) the language at university. I decided to make a generalized, object-...
• 263
305 views

### Simple spatial grid for particle system

I am going to simulate a particle system, the particles are infinitesimal points which apply forces on the neighbors and I need a fast way of making proximity checks, they are going to have a maximum ...
312 views

### Agent based model in Python

My model is based on the Ultimatum Game. I won't go into the intuition behind it but generally speaking it functions as follows: The game consists of a n × n lattice on which an agent is placed at ...
1k views

### Razzle Dazzle simulator

Inspired by the video from Scam Nation and James Grime from Numberphile, I tried to make a Razzle Dazzle simulator. Razzle Dazzle is a scam in the form of a game. Per turn, the player pays a fee and ...
• 201
153 views

### Simple function that simulates survey results based on sample size and probability

What is this: This is a simple function, part of a basic Monte Carlo simulation. It takes sample size and probability as parameters. It returns the simulation result (positive answers) plus the input ...
305 views

### Animation of an incremental rotary encoder

While reworking my teaching materials for an exercise of an introductory course on mobile robotics, I recently created a animation/simulation of an incremental rotary encoder, e.g. often used for ...
• 7,234
326 views

### Population dynamic simulation on biological information maintenance 2

This question is the follow-up to this previous question. Background Using this simulation I investigate a system in which enzymes proliferate in cells. During the replications of enzymes, ...
• 325
118 views

• 31
194 views

### Population dynamic simulation on biological information maintenance

Background Using this simulation I investigate a system in which enzymes proliferate in cells. During the replications of enzymes, parasites can come to be due to mutation. They can drive the system ...
• 325
218 views

I'm writing a simulator which checks how many balls we need to occupy every box or how many balls we need for any box has at least 2 balls (birthday paradox). I wrote the script in python and it is so ...
193 views

### Simulation of forest growth and pruning

I was wondering how I could streamline the following code. This was the project assigned to us: The Canadian Forest Service wants to do a simple simulation of the growth and pruning of forests. ...
• 71
2k views

### Simulate round-robin tournament draw

I decided to implement the round robin algorithm in Python. My code takes a list of teams as input and prints the schedule. This is my first try to write something by my own after taking some online ...
• 73