Results 1 to 10 of 10
  1. #1
    zephyr is offline Member
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

    Question new to java. please help me.

    hi people,

    i am new to java, i got to know this forums through my friend. he told me that i be able to know more about jave through this forums and so i give it a try.

    i am currently doing java in school. however, i am never good at it. the worst is i was given a project to try. so i decide to give it a try and do my best, and of course i need help from u people.

    the project that i was given required me to write a Java computer program that plays a word game called FindYourWords. The following are the characteristics of the game and the intended computer program :

    1) This game must be able to be played by 2 players.




    2) Each player will take turns to form valid words from a pool of 10 letters.

    -The 10 letters for each player is randomly selected and assigned to each player by the computer program. Of the 10 letters, the computer program will make sure that at least 2 of the letters are vowels. A letter can also appear more than once.




    3) For each word formed by a player, the computer program must :

    -Check that the word is a valid word.

    -Check that the word is formed using only letters assigned to the player.

    -If the word formed is invalid for any of the reasons above, the reasons must be displayed.

    -If the word formed is not valid, the player will be allowed to try again unless he/she passes the turn. See (6).




    4) To check that a word is valid, the computer program must read and store a list of valid words from a text file. The Java code to read words from a text file into string array is given in dictionary.jar. The computer program will use it for comparing with words formed by each player.




    5) When a valid word has been formed, the computer program will calculate the score for the word. Each letter in this game is assigned a numerical value, similar to Scrabble (Scrabble letter distributions - Wikipedia, the free encyclopedia). The score for a word is simply the summation of the value of each individual letter in the word.

    -The computer program will display the score obtained for the valid word formed by each player.

    -The computer program will also display the total score for the game by each player.



    6) Each player will take turn to form a valid word unless a player decides to pass his/her turn (or quit. See (7)). If a person passes his/her turn, it is the next player’s turn.

    -If a player passes, he/she will have scored 0 at that turn.



    7) The computer program will sum the score for each player’s valid word until the program stops. The program stops when any player decides to quit.




    8) When the program stops, it will display the score of both players and indicate which player won.





    the following are how the output should look like when i run the code:


    FindYourWords
    Letters of player 1 : a c f h i n p r s w
    Enter your word (or ‘@’ to pass or ‘!’ to quit) : saw
    Total score for word : 6
    Total score for game : 6

    Letters of player 2 : b c e g n n o t x z
    Enter your word (or ‘@’ to pass or ‘!’ to quit): bench
    Error : A valid word is formed but one or more letter(s) used are not yours
    Enter your word (or ‘@’ to pass or ‘!’ to quit): benc
    Error : An invalid word is formed
    Enter your word (or ‘@’ to pass or ‘!’ to quit): bet
    Total score for word : 5
    Total score for game : 5

    Letters of player 1 : c e f g h i n p r t
    Enter your word (or ‘@’ to pass or ‘!’ to quit): @
    Total score for word : 0
    Total score for game : 6

    Letters of player 2 : a c i g n n o v x z
    Enter your word (or ‘@’ to pass or ‘!’ to quit): gain
    Total score for word : 5
    Total score for game : 10

    Letters of player 1 : c e f g h i n p r t
    Enter your word (or ‘@’ to pass or ‘!’ to quit): !

    Total score for player 1: 6
    Total score for player 2: 10
    Player 2 won!



    please help me

    thank you.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,589
    Rep Power
    23

    Default

    Do you have any specific questions about your project?
    What kind of help are you looking for?

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,005
    Blog Entries
    7
    Rep Power
    20

    Default

    What have you tried? I'd concentrate on dealing those letters to the two players first: at least two vowels and exactly ten letters. I assume there are a finite number of letters, e.g. 2 As, 1 X etc. and I also assume that there are points associated with a letter, e.g. E == 1, Q == 8 etc.

    Try to complete that part of your program first.

    kind regards,

    Jos

  4. #4
    zephyr is offline Member
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

    Default

    i need help in writting out the code for the program...


    i have done abit of the program i have given a head start.

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,589
    Rep Power
    23

    Default

    Most of us are here to help people write their own code.

    It sounds like you need to hire a programmer to write your program.

  6. #6
    zephyr is offline Member
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

    Default

    haha....i sound too serious.......is a word game actually....jus that i don't know how to continue to write the code starting from the part where 2 player must be able to play the game.

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,005
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by zephyr View Post
    haha....i sound too serious.......is a word game actually....jus that i don't know how to continue to write the code starting from the part where 2 player must be able to play the game.
    No matter what, you have to write a Player class so you can create two Players. You have to give letters to those Players so they can play their game. We are not going to do that for you. It's your assignment so you do the work.

    kind regards,

    Jos

  8. #8
    poisson is offline Member
    Join Date
    May 2010
    Location
    Singapore
    Posts
    31
    Rep Power
    0

    Exclamation Isn't your wordGame similar to mine?

    I have a project and it is similar to yours, you should come and read my post : New to java and does not know how to write the code ...

    It teaches you how to create the Player class for the two players!! I hope it helps, but you have to play your part as well in writing the code since this is your assignment.

    Only will the people who are in good in java here will be able to help you further in informing you of how you can improve your code or what has gone wrong.

    Try showing us your codes so far ...

  9. #9
    zephyr is offline Member
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    No matter what, you have to write a Player class so you can create two Players. You have to give letters to those Players so they can play their game. We are not going to do that for you. It's your assignment so you do the work.

    kind regards,

    Jos


    hmm....haha dun get me wrong i am not asking u all to do tat for me jus asking for tips and hint as i have no one to turn to......thanks btw for the above tips....

  10. #10
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,005
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by zephyr View Post
    hmm....haha dun get me wrong i am not asking u all to do tat for me jus asking for tips and hint as i have no one to turn to......thanks btw for the above tips....
    You're welcome of course and you have work to do: start designing your game and when you're stuck with certain implementation details feel free to come back here and someone will help you out.

    kind regards,

    Jos

Posting Permissions

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