Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the code in Kotlin for the challenge at the end of chapter 8. Do the three moods and three titles that are suggested in

Write the code in Kotlin for the challengeimage text in transcribed at the end of chapter 8. Do the three moods and three titles that are suggested in the book and then add one more mood and one more title of your own design.

NyetHack currently has five narrator moods and four titles that it can assign to players, but the sky is the limit. Get creative and add more narrator moods and player titles to your heart's content. Here are some ideas you can use for narrator moods: - lazy: The narrator will only say the first half of the message being narrated. (Hint: Take a look at String's take or substring functions.) - leet (or 1337): The narrator will speak in leetspeak, replacing letters with numbers and symbols that look similar. For example, 'L' becomes '1'; 'E' becomes '3'; 'T' becomes '7'. (Hint: Take a look at String's replace function. There is a version that accepts a lambda as the second parameter.) - poetic: The narrator will insert line breaks between words in a way that looks vaguely like poetry. Unfortunately, because of the complexity of language and meter, the narrator will likely not be very good at this. (Hint: There are many solutions here, but one option is to combine the replace function with the Random class you saw earlier in the chapter.) Likewise, here are some ideas for titles that you can assign to players: - "The Bold": Assigned to a player if all the letters in their name are capitalized. - "The Verbose": Assigned to a player if they have many letters in their name ( "many" being whatever threshold you choose). - "Bringer of Palindromes": Assigned to a player if their name is a palindrome. (Hint: Take a look at String's reverse function. Also, remember that strings are case sensitive.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions