battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.


battle programming a forum for elite programmers with extreme will power to sharpen their skills
 
HomeGallerySearchRegisterLog in
 

 DIGamer skill v1 050420

Go down 
AuthorMessage
kurosen
codding
codding
kurosen

Posts : 292
Join date : 2012-04-17

DIGamer skill v1 050420 Empty
PostSubject: DIGamer skill v1 050420   DIGamer skill v1 050420 EmptySun Apr 05, 2020 8:56 pm

DIGamer (java)

Code:
package chobit;

import java.util.ArrayList;
import java.util.Random;

public class DIGamer extends DISkill {
 private int mode = 0;
 private Random rand = new Random();
 public DIGamer(Kokoro kokoro) {
 super(kokoro);
 }

 @Override
 public void input(String ear, String skin, String eye) {
 switch (ear) {
 case "coin toss":
 mode = 1;
 break;
 case "dice roll":
 mode = 2;
 break;
 default:
 break;
 }
 }

 @Override
 public void output(Neuron noiron) {
 switch (this.mode) {
 case 1:
 int x = rand.nextInt(2);
 String sTemp = x == 0 ? "heads" : "tails";
 noiron.algParts.add(verbatimGorithm(new APVerbatim(sTemp)));
 mode = 0;
 break;
 case 2:
 int x2 = rand.nextInt(6) + 1;
 String sTemp2 = x2 + "";
 noiron.algParts.add(verbatimGorithm(new APVerbatim(sTemp2)));
 mode = 0;
 break;
 default:
 break;
 }

}

 private Algorithm verbatimGorithm(AbsAlgPart itte) {
 // returns a simple algorithm for saying sent parameter
 // AbsAlgPart itte = new APVerbatim("I am");
 String representation = "about";
 ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
 algParts1.add(itte);
 Algorithm algorithm = new Algorithm("about", representation, algParts1);
 return algorithm;
 }
}

https://streamable.com/0udcbc

cool pepe
Back to top Go down
 
DIGamer skill v1 050420
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: the LivinGrimoire-
Jump to: