aspose file tools
The moose likes Game Development and the fly likes Monster game java code required Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Game Development
Reply Bookmark "Monster game java code required" Watch "Monster game java code required" New topic
Author

Monster game java code required

kris chait
Greenhorn

Joined: Nov 24, 2008
Posts: 4
I need java source for this problem..

Eating monsters, rules:
- There are 5 monsters, each monster having 5 calories to start with.
- Each monster is served a packet of food per round
- The food packet contains everything from 0 to 2 calories
- Each monster waits some random time before starting to eat their food
- When the food is eaten by a monster, it's number of calories will
increase with the number of calories contained in the food packet
- A monster will burn one calorie each time it eats
- Statistically, every 5th packet of food is poisoned
- If a monster eats a poisoned packet of food, it will loose that number of calories
- All monsters must finish eating before the next round of servings
- The strongest monsters eats statistically first, the time to wait from they
are served their food is calculated from how many calories they have in them.
- One monster will also steal food from another random monster per round of serving.
It is the first monster waking up that will steal from the others. This is done before
it will eat its own packet of food.
- If either the monsters food or the stolen food, the combimed food packet
will also be poisoned.
- A monster is dead if it no longer has any calories, and it will no
longer be a participant in the food fight

Out put example :
Monster 0 stole the food from monster 3
Oh no, monster 1 was poisoned: 2 calories left
monster 0(6) monster 1(2) monster 2(4) monster 3(4) monster 4(6)
Monster 2 stole the food from monster 4
Oh no, monster 2 was poisoned: 1 calorie left
monster 0(6) monster 1(3) monster 2(1) monster 3(3) monster 4(5)
Monster 4 stole the food from monster 1
Oh no, monster 4 was poisoned: 3 calories left
Oh no, monster 3 was poisoned: 2 calories left
Oh no, monster 2 was poisoned and died
monster 0(6) monster 1(2) monster 2(X) monster 3(2) monster 4(3)
Monster 0 stole the food from monster 1
Oh no, monster 4 was poisoned and died
monster 0(8) monster 1(2) monster 2(X) monster 3(1) monster 4(X)
Monster 1 stole the food from monster 0
monster 0(7) monster 1(2) monster 2(X) monster 3(X) monster 4(X)
Monster 1 stole the food from monster 0
monster 0(7) monster 1(5) monster 2(X) monster 3(X) monster 4(X)
Monster 0 stole the food from monster 1
monster 0(6) monster 1(5) monster 2(X) monster 3(X) monster 4(X)
Monster 0 stole the food from monster 1
monster 0(7) monster 1(5) monster 2(X) monster 3(X) monster 4(X)
Monster 0 stole the food from monster 1
monster 0(7) monster 1(5) monster 2(X) monster 3(X) monster 4(X)
Monster 1 stole the food from monster 0
Oh no, monster 1 was poisoned: 3 calories left
monster 0(7) monster 1(3) monster 2(X) monster 3(X) monster 4(X)
Monster 1 stole the food from monster 0
Oh no, monster 1 was poisoned and died
monster 0(7) monster 1(X) monster 2(X) monster 3(X) monster 4(X)
The winner is monster 0 with 7 calories left
Tom Johnson
Ranch Hand

Joined: May 11, 2005
Posts: 142
How is this:


Nobody is going to help you if you just keep asking for the code to an entire application!


<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank" rel="nofollow">Use Code Tags!!</a>
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10040
    
    6

We are not a code mill here. Most folks who hang out are either students or professional developers, who get paid for their work. We will bend over backwards to help you learn or write the code yourself, but nobody here will write the code for you. You may want to read this to get an idea how we work.

If all you want to do is hire someone to do the work for you, there are otehr sites to try - perhaps www.monster.com.


Never ascribe to malice that which can be adequately explained by stupidity.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8290

Kris has posted this same question twice before in two other forums and gotten the same answer.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16811
    
  19

Well, hopefully, Kris will get the message soon -- and start the homework assignment. We at the ranch are very helpful with providing hints, when people get stuck, during an assignment... but this assumes that the person is actually doing the assignment.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Monster game java code required
 
Similar Threads
Puzzle
regarding negation operation
Java code reuqired urgently
Eating monsters problem solution
[Easy] Eating books.