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
2 votes
1 answer
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 ...
C. Babbage's user avatar
1 vote
1 answer
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: ...
David's user avatar
  • 111
3 votes
2 answers
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 ...
Anamne's user avatar
  • 33
5 votes
1 answer
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 ...
JSogaard's user avatar
  • 151
2 votes
0 answers
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 ...
grimrol123's user avatar
3 votes
2 answers
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 ...
FirefoxMetzger's user avatar
3 votes
0 answers
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\$....
Kartik Chhajed's user avatar
1 vote
4 answers
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 ...
coder1532's user avatar
  • 177
3 votes
1 answer
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 ...
sjedi's user avatar
  • 61
10 votes
2 answers
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 ...
LetMeSOThat4U's user avatar
2 votes
1 answer
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 ...
user366312's user avatar
1 vote
0 answers
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 ...
XUN ZHANG's user avatar
6 votes
1 answer
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 ...
Sito's user avatar
  • 384
1 vote
2 answers
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 ...
nokko's user avatar
  • 43
3 votes
1 answer
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 ...
expl0it3r's user avatar
  • 151
4 votes
1 answer
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 ...
Bob Jeans's user avatar
3 votes
1 answer
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 ...
ad1v7's user avatar
  • 33
1 vote
1 answer
67 views

Simulation of Central Limiting Theorem (CLT)

The following is the simulation of Central Limiting Theorem from Statistics: ...
user366312's user avatar
1 vote
1 answer
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 ...
JLC's user avatar
  • 111
3 votes
1 answer
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 ...
user avatar
5 votes
2 answers
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 ...
Daedric_Man_guy's user avatar
7 votes
1 answer
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 ...
Ethan Bierlein's user avatar
5 votes
1 answer
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, ...
Quetzalcoatl's user avatar
1 vote
1 answer
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 ...
김태홍 KIM's user avatar
33 votes
9 answers
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. ...
Gilfoyle's user avatar
  • 1,125
12 votes
1 answer
4k 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 ...
Neinstein's user avatar
  • 405
3 votes
1 answer
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 (<...
Omid's user avatar
  • 159
1 vote
1 answer
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. ...
notak's user avatar
  • 605
8 votes
2 answers
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 ...
Kartikeya Sharma's user avatar
-1 votes
1 answer
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 ...
woody101298's user avatar
6 votes
2 answers
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. ...
RobotMan's user avatar
  • 359
5 votes
2 answers
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 ...
CygnusDawn's user avatar
2 votes
3 answers
349 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 ...
Yummy275's user avatar
  • 505
19 votes
6 answers
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 ...
woody101298's user avatar
3 votes
1 answer
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 ...
Layman's user avatar
  • 153
6 votes
1 answer
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 ...
Kartikeya Sharma's user avatar
2 votes
0 answers
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 ...
mojojojo's user avatar
  • 121
2 votes
1 answer
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-...
mazunki's user avatar
  • 263
4 votes
2 answers
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 ...
StackOverflowToxicityVictim's user avatar
5 votes
1 answer
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 ...
Sasquatch's user avatar
16 votes
3 answers
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 ...
user2966394's user avatar
7 votes
2 answers
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 ...
Lorinc Nyitrai's user avatar
3 votes
0 answers
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 ...
AlexV's user avatar
  • 7,234
13 votes
1 answer
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, ...
rokamama's user avatar
  • 325
2 votes
1 answer
118 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 ...
jamie's user avatar
  • 31
9 votes
1 answer
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 ...
rokamama's user avatar
  • 325
5 votes
2 answers
218 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 ...
Artur Owczarek's user avatar
4 votes
3 answers
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. ...
Corbin's user avatar
  • 71
7 votes
1 answer
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 ...
Eldar's user avatar
  • 73
10 votes
5 answers
3k views

Ising model simulation

I have written this code to simulate Ising Model at one particular temperature in presence of magnetic field to observe hysteresis effect using the metropolis algorithm. While the code runs and gave ...
aargiee's user avatar
  • 101

1
2
3 4 5
8