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
3
votes
1answer
44 views

Finding number of possible arrangements of books on a shelf with a Monte-Carlo approach

The Problem I am trying to determine numerically how many possible ways a number of books can be arranged on a shelf. Specifically, there are x3 categories "physics", "sci-fi", and ...
4
votes
1answer
49 views

Python Genetic Algorithm Implementation

I've made this to pick the LQR parameters for my self balancing robots simulation. So to break down what I have done, Randomly Create Population I create a random population. The population is a list ...
11
votes
1answer
155 views

From Hummingbirds to Ornithopters: Simulating the Aerodynamics of Flapping Wings

Ptera Software A Flapping Wing Aerodynamics Simulator Written in Python Motivation About a year ago, I became fascinated by how animals fly. As an aerospace engineering student, it surprised me that ...
3
votes
1answer
63 views

Discrete event simulation framework for discrete times in Julia

I would like to receive constructive feedback on my simulation framework (this is for my thesis work). I have no formal background in programming, and I am wondering if there is a more effective and ...
2
votes
1answer
56 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
1answer
36 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: ...
3
votes
2answers
51 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 ...
5
votes
1answer
139 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 ...
2
votes
0answers
53 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 ...
3
votes
2answers
63 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 ...
3
votes
0answers
63 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\$....
3
votes
1answer
45 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 ...
10
votes
2answers
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 ...
2
votes
1answer
59 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 ...
1
vote
0answers
36 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 ...
6
votes
1answer
83 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 ...
1
vote
2answers
69 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 ...
3
votes
1answer
219 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 ...
5
votes
1answer
192 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 ...
3
votes
1answer
104 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 ...
1
vote
1answer
35 views

Simulation of Central Limiting Theorem (CLT)

The following is the simulation of Central Limiting Theorem from Statistics: ...
1
vote
1answer
55 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 ...
3
votes
1answer
579 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 ...
5
votes
2answers
272 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 ...
7
votes
1answer
161 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 ...
5
votes
1answer
122 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, ...
1
vote
1answer
79 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
votes
9answers
5k 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. ...
12
votes
1answer
1k views

Predator-prey simulation

I made a random-walk predator-prey simulation that focuses on individual animals instead of the (maybe) more common array-based approach. I'd like to hear your opinion about this: how could the ...
3
votes
1answer
147 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 (<...
1
vote
1answer
882 views

Bank account class

Simple object-oriented, money management code where a user can deposit money in, withdraw from, show, and exit the balance. ...
8
votes
2answers
628 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 ...
-1
votes
1answer
106 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 ...
6
votes
2answers
1k 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. ...
5
votes
2answers
540 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 ...
2
votes
3answers
211 views

Google homepage beginner project

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 ...
19
votes
6answers
4k 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 ...
3
votes
1answer
166 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 ...
6
votes
1answer
319 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 ...
2
votes
0answers
24 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 ...
2
votes
1answer
101 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-...
4
votes
2answers
77 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 ...
4
votes
1answer
158 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 ...
16
votes
3answers
949 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 ...
7
votes
2answers
144 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 ...
3
votes
0answers
153 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 ...
13
votes
1answer
282 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, ...
2
votes
1answer
93 views

Code which creates the Game Of life In Java

Link to github Link to github: https://github.com/zombi3123/Game-Of-Life/ Source code: Window.Java ...
9
votes
1answer
170 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 ...
5
votes
2answers
162 views

Birthday paradox simulation

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

1
2 3 4 5
7