Results 1 to 4 of 4
- 01-12-2012, 04:50 AM #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.
- 01-12-2012, 04:53 AM #2
Re: Are these well written algorithms?
What exactly is the algorithm? And how are you looking to define 'good'?
- 01-12-2012, 07:16 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Re: Are these well written algorithms?
You should describe your question properly.
- 01-12-2012, 08:27 AM #4
Similar Threads
-
Sorting Algorithms
By fam2315 in forum New To JavaReplies: 7Last Post: 07-27-2011, 05:55 AM -
Threaded algorithms
By TerTer in forum Threads and SynchronizationReplies: 0Last Post: 04-20-2010, 02:58 PM -
Compression Algorithms
By kishan in forum Advanced JavaReplies: 1Last Post: 09-21-2009, 09:13 AM -
genetic algorithms
By nurfadhillah in forum Advanced JavaReplies: 1Last Post: 10-19-2008, 04:13 PM -
Iterative Algorithms
By Zosden in forum AlgorithmsReplies: 1Last Post: 07-05-2008, 06:29 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks