The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
38
votes
5answers
24k views

Designing a coffee machine

I was recently rejected from what looked like a really promising string of interviews. I did very well in a questionnaire style review, and then they handed me this assignment (more or less): ...
11
votes
1answer
133 views

MAC1 simulator/debugger

In constructing an answer to this question, I wrote a small debugger/simulator for the MAC-1 instruction set. There are a number of simulators already out there, but most are either too old to be ...
9
votes
2answers
1k views

Monte Carlo virus infection simulation

I am learning C++ from a C background, and I was wondering if I could convert this old C program I'd written into C++ as a personal exercise. The original C program is a simple Monte Carlo simulation ...
8
votes
1answer
389 views

Multiplayer bowling in Ruby (follow-up: injection, single responsibility)

This is a multiplayer bowling simulator in Ruby. It allows for variable skill levels, and produces weighted random results for each player's rolls based on those skill settings. This is a complete ...
8
votes
1answer
233 views

Simulating a GUI windowing system

I was eager to learn the implementation details behind windowing GUI systems. Because I am mostly a high level programmer having not much experience in low-level stuff, I had to simulate it instead of ...
7
votes
1answer
323 views

Model simulation using Java annotations

A couple of days ago I posted my code that models systems made up of moving parts. I got several great tips and ideas and here is my latest version. My actions are now methods annotated with @Action (...
9
votes
2answers
4k views

Ant Colony Simulator

This program is a simulation of an ant colony, inspired by SimAnt. It doesn't do it off the batch; there must be code that instructs the ants to follow scent tiles in particular and react to the food. ...
18
votes
2answers
5k views

Barnes-Hut N-body simulator

I've written an n-body simulator, implementing the Barnes-Hut algorithm. Please comment on anything you can see wrong with this. Wikipedia Barnes-Hut page This is a screen shot of the simulation 20 ...
5
votes
3answers
796 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? ...
9
votes
3answers
3k views

Simulation of an ocean containing sharks and fish

As part of my Java learning, I tried solving Part I of problem description here. The only issue that I see now is that I could not close the button of Frame. ...
5
votes
2answers
299 views

Randomizing and mutating algo class - style

I've updated this question to be about code style only, as all of it's answered focused on this aspect. For the codes function, see Randomizing and mutating algo class - functionality ...
14
votes
3answers
582 views

Suggestions needed after modification of Simulation of an Ocean

After suggestions given in this question, modifications to the code has been done. Only thing I could not do is to decide, where to place the starveTime property (...
12
votes
2answers
2k views

Random D20 number generator

I'm teaching myself code using Zed Shaw's Learn Python The Hard Way, and I got bored during one of the memorization lessons so I thought I would make a random D20 number generator for when I play RPGS....
10
votes
0answers
180 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, ...
9
votes
1answer
156 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 ...
8
votes
2answers
711 views

Epidemic simulation

The purpose of this code is to simulate epidemics across a population. There are 625 (pop) individuals at random locations. The epidemic parameters are infectious period (inf_period), trans (...
6
votes
2answers
299 views

Skill Upgrades for Strategy Game

I built a simple class to handle skill increases for the workers in a strategy game for iOS. The basic idea is that whenever a worker finishes a job, their skill (which starts at 0) will increase by ...
5
votes
2answers
152 views

Change random list of numbers into all 5's using simple evolution simulation

This is supposed to be an evolutionary algorithmic program, and I'm not sure if it does what it's supposed to do. It is supposed to take a random list of numbers (containing at least one 5), and over ...
4
votes
2answers
195 views

Python object-oriented pipe cooling simulations

Here is my code simulating liquid in a pipe cooling under different conditions. How did I do approaching this in an object orientated way? Is there any way I can improve this code? ...
3
votes
2answers
489 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 ...
2
votes
2answers
444 views

Genetic Drift simulator

Genetic drift — along with natural selection, mutation, and migration — is one of the basic mechanisms of evolution. In each generation, some individuals may, just by chance, leave behind a few ...
1
vote
2answers
315 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 ...
8
votes
1answer
1k views

Discrete event simulation of a prioritized lunch queue

Note This post is a continuation of Discrete event simulation of a prioritized lunch queue in Java (Data structures). Please refer to it for problem description. This part about "algorithms": all ...
6
votes
1answer
69 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 ...
5
votes
1answer
193 views

Randomizing and mutating algo class - functionality

See Randomizing and mutating algo class - style I'm looking for a review of the functionality of this code, answers to the above question which also describes the code use focus on style instead. ...
5
votes
1answer
98 views

Vectorization for temperature simulation

I'm new to Matlab and I would like to know tips in order to reduce the processing time of such program. The scheme of the actual code is very similar to typical C++ code and I would like to vectorize ...
4
votes
2answers
1k 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 ...
4
votes
2answers
394 views

Worker AI and Job Queue Management for Simulation Game

So I've been working on AI for a Tower Building simulation game for quite a few days, and I think the code would really benefit from review. I'm a hobbyist programmer, but I really care about doing ...
4
votes
2answers
119 views

Follow up Implementation on Monty Hall Simulation

I have taken your inputs on my original question and formed a new implementation of the Monty Hall Simulation: Again keep an eye on CleanCode and OOP The Price to be won: ...
3
votes
1answer
227 views

Classic Hundred Doors Simulation

I am doing the 100 Doors problem as an exercise to practice user input and loops. I do understand the problem can be solved by outputting every square number up to the maximum number, but it defeats ...
3
votes
1answer
283 views

Ruby program to simulate a game of Narcotic Solitaire

In the game of Narcotic Solitaire, played with a standard 52-card deck, the player deals a row of four cards onto the table, from left to right. If all four cards are of the same value, they are ...
3
votes
2answers
566 views

Simulating a random packet routing algorithm and printing packet statistics in Java

I have this short program for simulating a random packet routing algorithm: Packet.java ...
1
vote
2answers
457 views

Implement operation and simulation mode in an interface [closed]

Context: I have to create an interface between devices and a client. My package is composed of: Device.py Error.py DeviceA.py (for example) DeviceB.py ... Basically each ...
1
vote
1answer
234 views

Discrete event simulation of a prioritized lunch queue in Java (Data structures)

(See also the Algorithms part.) Post details The program I am putting for being reviewed does not fit entirely in a single post, so I have to resort to the equation by Niklaus Wirth: Algorithms + ...