# Thread: Are these well written algorithms?

1. Member
Join Date
Dec 2011
Posts
28
Rep Power
0

## Are these well written algorithms?

I have to write algorithms for my grade11 java class and i just wanted to know if these are good algorithms?

1. Declare all variables needed.
2. Declare all the arrays .
3. Initialize arrays as needed.
4. Initialize variables as needed.
5. Prompt user for their name.
6. Declare a if statement with 2 city outputs.
7. Initialize array.
8. For city chosen add the Sp and Hp to array.
9. Calculate random number.
10. Declare a if statement if the number even continue if odd press enter.
11. Declare a for loop (villain greater than or = to 5) and go into loop if less than 5.
12. Initialize a array with 1hp and 1 sp.
13. Prompt user to press enter to hit.
14. Subtract sp of players array by villains hp array.
15. Prompt User with win screen.
16. Add Sp chosen and add hp chosen at beginning of game.
17. If more than 5 continue.
18. Calculate random Number between 1-10.
19. Initialize variable If number is 1 or 10 continue if not go in to loop and redo step ``18``.
20. If 1 0r 10 Continue.
21. Prompt User with screen to show the villain.
22. Initialize a array with 24 hp and 6sp.
23. Prompt to press enter to hit.
24. Minus players sp from array by villains hp.
25. Minus villains sp from array by players hp.
26. If villain array value of hp is 0 or less continue or else if 1or more in hp repeat step ``23``.
27. Prompt User with winning screen to Praise them.

2. ## Re: Are these well written algorithms?

What exactly is the algorithm? And how are you looking to define 'good'?

3. ## Re: Are these well written algorithms?

You should describe your question properly.

4. ## Re: Are these well written algorithms?

Write the algorithm first before we can tell you if they are well written. It looks like you have well organized ideas so far.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•