Inspiration

I wanted to make an investment simulator since I am interested in finance, so I tried doing that for this hackathon.

What it does

In this simulator, the stocks are fake, and their prices are also fake. The prices are actually randomly generated by adding a number (based on the stock's description and risk) to the current price. This makes the prices unpredictable at times. You can also look at info for each stock to see which ones are good investments, and which ones might be risky. You also have to try and make $250,000 before the computer does in order to win the game.

How I built it

I built it using HTML, CSS, and Vanilla JavaScript. This project might have been easier if I had used React, but I haven't learned it yet.

Challenges I ran into

I ran into some challenges in the winning system, as well as a bit on the transaction function. For the winning system, I originally wanted there to be a countdown timer and whoever had the most money at the end of the timer would win, but the timer wasn't working for me and I didn't have time to troubleshoot it. I had a bit of trouble at the beginning in the transaction function since it was a large and complex block of code, but after a few refinements, I made it more optimized with less inputs.

Accomplishments that I'm proud of

I'm proud of making an investment simulator game in just one day! I'm also very happy that I pulled this off as this has been one of my more complex projects in JavaScript so far, and I got to use my JavaScript knowledge to built this.

What I learned

I learned that making a simulator is actually surprisingly easy compared to what it sounds like, although you might need to change the stock price ranges to make sure that some stocks aren't overpowered while others always crash. I also learned yet again that I just cannot get countdown timers working for some reason :(

What's next for Stock Simulator Game

A future release will have mobile compatibility, a countdown timer feature, and different computer modes (easy, medium, hard). There might also be graphs based on the stocks' performance!

Share this project:

Updates