Problem Solving for Scripting

Problem Solving is important for Programming and Scripting here in ROBLOX.

by setmetatab1e

Author Avatar

Hi. In this tutorial you will learn what Problem Solving refers to and the basics to it. No experience required, just some thinking and your own time.

Introduction - What in the world is Problem Solving?

Well if you didn't know what Problem Solving is, it's basically the method or a solution to a problem that you encounter. You may brush over it, but in reality, all of us do Problem Solving in Programming. We just don't realize it.

A real example

Say that you wanted to assign half of the players to a team and the rest to the other team. The method used to solve this problem is called the solution. You would need to come up and brainstorm a solution in order to solve it.

The real issue here is - How do I come up with a solution?, Where do I even begin?, How do I approach it? Now that you understood what Problem Solving and Solutions are, let's get into the techniques, perspectives and more.

Let's take the first example. How do I balance teams equally? Take note of key words - equally, balance

What normally a quick fix to this solution is to split up half the players into two groups and then assign teams for them.

There's a flaw with this "quick solution" though. How do you know if one team is full? It's MUCH harder to deal with that then to come up with another solution.

However, a well thought and planned Solution can be - Loop through the players, if we reach a certain amount of tolerancy between one team, we assign the player to the other team.

You can see now that good Solutions are harder to come up with.

Note 1: Get your perspectives flying

What I mean by this is to look at the problem in how many ways possible. I wouldn't of came up with a good solution by just studying the problem for a bit. I realized that it's just more than spliting up the groups of players.

The Goose, Fox and Food Problem.

Imagine a farmer with a boat and their fox, goose and food. The farmer needs to take all of his pets and food with him accross the river.

However, he can only take one thing at a time, he also needs to make sure that the fox does not eat the goose and the goose does not eat the food.

Usually your first thought was to take the goose first, but that wouldn't work since either if the food or the fox comes next to the other side, the goose will eat the food or the fox will eat the goose, resulting in people saying this problem is impossible.

But did you know you can transfer things back and forth accross each sides? The problem becomes MUCH easier now.

Here's what the solution was:

  1. Take the goose first to Side B
  2. Come back to Side A and take the fox to Side B
  3. Take the goose back to Side A
  4. Take the Food to Side B
  5. Take the goose back to Side B

The perspective could be under your noses, and you couldn't even realize!

Set up a plan

This may be an obvious one but it is REALLY powerful. A plan for problem solving is Step 1 for your solution.

Sit down, write on a piece of paper on what you think you SHOULD do and what you CAN do. Imagine the end result for your solution. Also write down the tools needed for solving the problem, it can be a simple loop or a complex algorithim.

Problems vary from eachother.

Ask the Problem what it wants

Do you fully understand the Problem? Is there any holes that you can't figure out? If so then solving those "holes" are also Step 1 for the solution.

Many times I've seen people with their scripting problems not fully knowing what the problem is asking. They guess what it's asking, that can lead to a very poor solution.

This one is simple since you can just study your problem and see if you fully know what your doing.

A wrap-up

Problem Solving is important in Scripting since you can effectievly solve a coding barrier that most people just brush over. We do problem solving in Scripting but we just don't realize it.

A solution is the final step to Problem Solving. Many steps are required further back to help understand the Solution and the Problem itself and also provide a basic understanding of what needs to be done.

Look into the perspectives, set up a plan and really try to understand what the Problem is asking you to do.

Do not get discouraged, I myself do Problem Solving and I am getting better at it everytime I solve one. I also feel very good once I learn what it was. It's going to be hard for beginners, but that's the truth. No one should brush over Problem Solving.

Please leave comments on which Problem I should feature, suggestions and feedback on this tutorial.

View in-game to comment, award, and more!