Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

3
votes
2answers
228 views

Multifunctional Monty Hall Simulator

Based on this question on math.SE regarding probabilities in variations on the Monty Hall problem, I cobbled up a simulator in Ruby to give myself an introduction to the language. Since this is my ...
7
votes
1answer
425 views

Simulations and game code

I will like to improve my code in Java involving creating simulations and games. This is a problem-solving code so far in interest and percentage calculations. ...
1
vote
2answers
554 views

Monte Carlo dice [closed]

For this lab you should re-use your Dice class from the previous week. The user inputs a number n which determines the number of groups of 6 dice to be rolled. The program should output x, ...
2
votes
1answer
930 views

Simulation Framework

I started creating a small abstract simulation framework and would be happy if someone could take a look at the code and give me feedback on it. The code can be found here, and it is currently not in ...
4
votes
1answer
481 views

Vehicle-crossing simulation

It seems like this code should be shorter, but with all the error checking it is long and hard to follow. This is for a simulation of vehicles crossing a bridge, and this part is dealing with mutexes. ...
8
votes
1answer
351 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 ...
9
votes
5answers
887 views

Probabilistic matchmaking simulation

The following is a problem I found on this wiki. What can I do to optimize my algorithm, and make this code more C++11? Write a program to discover the answer to this puzzle:"Let's say men and ...
11
votes
2answers
837 views

Espresso Queue simulation

I was asked to do a technical test with the following specification, but my solution was rejected and I was not selected for the available position (Junior to "normal" level, with 4 days of time to ...
6
votes
2answers
207 views

Summator simulation

This is a reference implementation of a summation unit. The algorithm used is a most straightforward carry-propagation. If necessary, a test driving code could be provided. Few notes for the ...
4
votes
1answer
307 views

Simulating the martingale betting system with roulette

I wrote a program that simulates many instances of trying the martingale betting system with roulette in Haskell. At the answerer's suggestion I opted to leave the ...
6
votes
3answers
174 views

90 year data simulation in need of performance increase

I developed some code for my masters project that will simulate 90 years daily data using 1000 different data sets. The code is working fine and gives the correct output that I wanted but the ...
7
votes
1answer
1k views

Algorithm simulator (bubble and selection sorts)

I am concerned where it can be improved. Main concerns are coding style. Any other improvements are welcome too. Priority is on JavaScript, review for HTML/CSS are welcome too. What it does: ...
3
votes
1answer
72 views

Revised worker movement AI for strategy game

A while ago I posted this question about worker AI and Job Queues for a strategy game. I have posted other questions about the Job Queue, and now I would like to post this revised question about ...
7
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 ...
6
votes
2answers
289 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 ...
4
votes
0answers
2k views

Satellite orbit simulation in Matlab using Runge Kutta 4

I have a satellite orbit simulation in Matlab (Using Runge Kutta 4). It seems ugly and I don't know how to fix it. fx.m file: function v = fx(t,x,vx) v = vx; ...
6
votes
2answers
218 views

Taking wind data and simulating future wind profiles

I am new to programming, and am using Python to take wind data and simulate future wind profiles. The code as written takes a while to execute and I was hoping someone could suggest ways to make my ...
8
votes
1answer
20k views

HTML / JS Slot Machine Simulator

This code is a slot machine simulator that uses elements of both HTML and JavaScript. Please pardon the lack of comments. ...
1
vote
2answers
444 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 ...
5
votes
2answers
147 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
385 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 ...
1
vote
0answers
199 views

Template container simulating SQL “select” and “where”

I want to simulate, in C++, the fact that in a form with drop down (or combo boxes), you can filter by selecting items and then projecting on a given set of properties for these item. In a SQL-like ...
5
votes
1answer
339 views

Simulating Pendulum Motion in Android

Quite sometime back I had written an Android application which simulates the path of a pendulum. You can also have look at the complete discussion in my technical blog here. Please review it and ...
5
votes
1answer
259 views

Managing People in a SimCity Clone

So I am working through a few different game ideas as I learn programming, and I could definitely use some feedback on my latest project. This is a simple SimCity clone. So far I have created a City ...
3
votes
1answer
127 views

Single Rotate Method

I just started coding a simulation-like application. It's about our solar system. Right now, I'm working on rotating the moon. I have this constructor ...
1
vote
2answers
280 views

Adding very large arrays

I am writing a stochastic simulation for a Yule process: If you start with a certain number of bins each containing a random number of balls, you add another ball to an existing bin with a ...
11
votes
2answers
21k views

Dice-rolling simulator

I know there is a better way to store data. What is the most concise way to simplify this script? ...
8
votes
1answer
368 views

Switch-case Monstrosity for CPU Emulator

I am still working on A Z80 CPU emulator and I have decided to prototype it in javascript and then translate it into a faster language, It might be ported to C but more likely is Java - this means I ...
11
votes
3answers
14k views

Enigma simulator performance

Here is my implementation of a simple 3 rotor Enigma machine in C++: ...
14
votes
3answers
569 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 (...
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. ...
7
votes
1answer
310 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 (...
15
votes
5answers
39k views

Basic Java dice game

...
8
votes
2answers
235 views

Improvements/suggestions for my CPU emulator

I am trying to emulate a basic CPU (Z80) as close as possible. It currently does not read real assembly code, but that will be implemented. If you have any views on how that could be implemented, I'...
3
votes
2answers
450 views

How can I make my ant simulation faster?

I was not sure if I should post about 200 lines here. I want to make this ant simulation faster. The bottleneck is at Ant.checkdistancebetweenantsandfood(). It ...
1
vote
1answer
942 views

Correct logic in Monty Hall Problem? [closed]

I've written this code in an attempt to create the Monty Hall problem and check the ratios. I would like someone to check the logic on it. I know it isn't organized well at all; I just need to see if ...
4
votes
1answer
6k views

Multithreaded horse race simulation

I'm just starting to get along with threads in Java and I need some code review, about interfaces, classes, managing threads, correct writing, secure threads, exposed objects etc. Horse-Race ...
2
votes
1answer
1k views

Is this an elegant/accurate simulation of the Monty Hall problem?

I'm trying to simulate the Monty Hall problem, to statistically determine if there is any benefit to changing my choice after a door containing a goat is open (testing this guy's Monty Hall theory on ...
2
votes
2answers
280 views

Bouncing-ball simulation

I posted a couple questions about a week ago, but have almost gotten it working. This program is supposed to simulate the following: Ask the user how many balls to drop Drop one ball at a time Allow ...
1
vote
4answers
1k views

Improving Lottery Simulation

I'm working on a project for an Intro to C/Python class and am looking to improve the efficiency of the program. The program is a lottery simulation where the user inputs the number of tickets they ...
5
votes
1answer
2k views

Simple taxi emulator

This app is a simple taxi emulator. The only feedback I've got on it was "bad internal architecture", that's why I would be grateful to receive more adequate and humiliating review. Simply-speaking, ...
3
votes
1answer
3k views

Inventory simulation using Pandas DataFrame

I've been learning Python like for a year and started learning a little about pandas DataFrame. I made this little program to practice all the concepts and would ...
13
votes
1answer
1k views

Haskell Particle Simulation

I recently started learning Haskell and as my first project I decided to port a particle simulation I had written in C. The simulation is pretty simple. We have a cubic box with particles (spheres) ...
1
vote
2answers
201 views

Repeated measures simulator optimisation

I am learning to program in R and to do that and create something useful in the process, I have decided to rewrite this Java applet for repeated measures simulation and to implement some new ...
-1
votes
2answers
213 views

Launching a multithreaded simulation of smokers

Does my main class have too much code? For some reason i have the feeling that I should put all of my thread starts and joins in a for loop just to reduce the amount of code. I dunno if that will hurt ...
22
votes
4answers
10k views

Simple Turing machine simulator

Yesterday I got a sudden urge to go from writing Python to something, well, more UNIX core-ish. I read some examples on here and decided I might as well put some of that stuff to use to test something ...
6
votes
1answer
223 views

Statistical simulation

I've written the following program as a submission to the German Federal Computer Science Competition for highschool students. The program makes the following simulation with a given number of days ...
4
votes
0answers
514 views

Speed up a monte carlo simulation with nested loop

I would like to know if there is a more efficiency way to speed up below code. It uses a procedure where subsampling is required in the nested loop (which a previous answer helped to make more ...
4
votes
1answer
190 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
2answers
297 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 ...