Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code samples #1

Open
htronjp opened this issue Feb 27, 2015 · 4 comments
Open

Code samples #1

htronjp opened this issue Feb 27, 2015 · 4 comments

Comments

@htronjp
Copy link

htronjp commented Feb 27, 2015

Watched several videos on youtube. then downloaded code samples from this site. I don't know about GitHub and how to use it. Anyhow, there are 3 folders in each lesson. Activities, Examples, and Solution. I just want to know how to use them effectively. Of course, I use NetBeans8. Also, I don't know whether this issue is suitable or not for this type of the question. from [email protected]

@mafudge
Copy link
Owner

mafudge commented Feb 28, 2015

Hi the Examples folder contains the code I use in the videos
The activities folder contains exercises you can try on your own.
The answers to the activities are in the Solutions folder.

@htronjp
Copy link
Author

htronjp commented Mar 1, 2015

Dear Mr. Fudge

Thank you very much for your kind advice. I didn’t know the lesson 00 video. I’ve got the video today and understood the preparation of the environment.

I’ve just started to learn Java after I watched a few video on Youtube. Most interested thing in your video is using “debug” tools. I’ve been learning C# and ASP.NET on the Visual Studio since 2008.

Only purpose to learn Java is to stimulate my brain cells for anti-dementia because I’m 74 years old already.

I’m sure I can enjoy learning Java for long.

Thank you.

Masami kitada

From: Michael Fudge [mailto:[email protected]]
Sent: Saturday, February 28, 2015 10:03 AM
To: mafudge/LearnJava
Cc: masami kitada
Subject: Re: [LearnJava] Code samples (#1)

Hi the Examples folder contains the code I use in the videos
The activities folder contains exercises you can try on your own.
The answers to the activities are in the Solutions folder.


Reply to this email directly or view it on GitHub #1 (comment) . https://github.com/notifications/beacon/AKt18b9h7S6npOFHDVmoZTuztYOKtbKeks5nwQs7gaJpZM4DnTCl.gif

@ctrlunlimited
Copy link

Hi Mike,

Please find code written when following your example and kindly assist rectify as am getting so many red errors.......................
import dungeonhack.*;
import dungeonhack.Actor;
import dungeonhack.Die;
import dungeonhack.Weapon;

/**

  • the beginning of a new super cool dungeon hack simulator
  • Roll 20 side die
  • if ( roll >= monster armor class){
  • inflict damage on monster
  • check if monster is dead
  • else check if you miss
    */

public class DungeonHackRun {

public static void main(String[] args) {
    Weapon sword = new Weapon("Broad Sword","slashes",10);
    Weapon claw = new Weapon("Arm","Claw",6);
    Actor player = new Actor("Conan the Barbarian",5,10,sword);
    Actor monster = new Actor("Grumpy troll",5,8,claw);
    Die d20 = new Die(20);

    int roll = d20.roll();
    //"conan the barbarian slashes is broad sword at the grumpy troll...."

            System.out.printf("%s %s his %s at the %s and",player.name(),player.weapon().action(),
                    player.weapon().action(),monster.name());

            if (roll>= monster.armorClass()){ //hit 
                int damage = player.weapon().hitDamage();
                 monster.takeDamage(damage);
                System.out.printf("hit for %d damage",damage);
                if(monster.isDead()){
                    System.out.println(",killing hit");
                }
            }else{ //miss
                System.out.println("misses");

            }
            System.out.print("!!!");
}

}

@FFForster
Copy link

Yo Mr. Fudge,

new to this. Stumbled over your Java tutorial. Here to learn.
Thanks for helping out and your work.
Appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants