id
stringlengths
36
36
text
stringlengths
1
1.25M
56d90d36-3bd0-4974-8a81-6ce1970f59fb
public void setNachname(String nachname) { this.nachname = nachname; }
e778bb6d-7c28-4a7b-924a-d23d23606b20
public void setRolle(String rolle) { rolle = "lehrer"; this.rolle = rolle; }
55c460b9-930c-41cc-9147-1f5612a77d56
public String getRolle() { return rolle; }
a5093470-1d93-451a-b33e-551b8b5c9675
public void setGeburtstag(String geburtstag) { this.geburtstag = geburtstag; }
7ae4c668-4aaf-4385-962a-7b68af0ad0f1
public String getGeburtstag() { return geburtstag; }
62ef8d27-d78d-4701-92f6-9aad9459314c
public String getKlasse() { return klasse; }
af848bd5-b9f3-4062-8515-eb7875b815a2
public void setKlasse(String klasse) { this.klasse = klasse; }
555f5b19-2ad3-48d7-871f-c735adaffd62
public String getKonfession() { return konfession; }
abf316a4-64ca-4e16-9bde-f219d8901805
public void setKonfession(String konfession) { konfession = "N.A."; this.konfession = konfession; }
84546454-41d2-4047-a54d-95383ad4abff
public String getGebDay() { return gebDay; }
fe5d2fe0-e307-498f-b5cb-e25191a2cc11
public String getGebMonth() { return gebMonth; }
cfd98cc4-fb99-4531-b973-23555b43cbfd
public String getGebYear() { return gebYear; }
c5e9bec3-ad52-4c44-9762-4639654fd908
public void setGebDay(String gebDay) { this.gebDay = gebDay; }
9aadf6a3-59be-4040-8af5-dc8870f64c97
public void setGebMonth(String gebMonth) { this.gebMonth = gebMonth; }
fa149af1-e3b9-4fb4-8b18-1478b44ff11e
public void setGebYear(String gebYear) { this.gebYear = gebYear; }
a3837233-324d-4022-83f5-0e3cbed8dfe2
public String sendTeacher() { String rolle = "lehrer"; // DEBUG System.out.println("Klasse: " + klasse); System.out.println("Nachname: " + vorname); System.out.println("Vorname: " + nachname); System.out.println("Geburtstag: " + geburtstag); geburtstag = gebYear + gebMonth + gebDay; // Geburtstag formatieren //DatabaseHandler.SQLConnection(); dbh.addUser(klasse, nachname, vorname, geburtstag, konfession, rolle); //DatabaseHandler.SQLConnectionClose(); logger.info("Lehrer: " + vorname + " " + nachname + " angelegt"); return "teacheraddsuccess"; }
73215ecd-abc8-4d43-b281-86c20676759e
public String addToTeachers(){ dbh.addToTeachers(klasse, nachname, vorname, geburtstag, konfession, "lehrer"); return kuwasysControllerBean.goTeachers(); }
320f2aa2-37c1-4e67-b467-48c3a2ccdfb6
public Teacher (int id, String vorname, String nachname, String geburtstag, String konfession, String klasse, String username, String passwort, String rolle) { _id = id; _nachname = nachname; _vorname = vorname; _geburtstag = geburtstag; _klasse = klasse; _username = username; _passwort = passwort; _rolle = rolle; _konfession = konfession; }
0ef0c8a5-cef9-4d5e-96cf-67680b9465ca
public int get_id() { return _id; }
b6c7166e-71fc-4fcc-9b72-5f787e059be5
public void set_id(int _id) { this._id = _id; }
29dcc9fa-ed70-43d7-bca5-e72b9f8067dc
public String get_nachname() { return _nachname; }
7d4de151-5499-4e93-908a-a9d124981192
public void set_nachame(String _nachname) { this._nachname = _nachname; }
49611ba4-2e86-4e3c-ab39-e59d08220e29
public String get_vorname() { return _vorname; }
11b00b5c-34d1-40cc-80fa-23617625f6e8
public void set_vorname(String _vorname) { this._vorname = _vorname; }
7e94b909-e6a1-4983-afd6-b2a6a128a96c
public String get_geburtstag() { return _geburtstag; }
4dd39fb0-725b-43c4-aa21-f9cd18457c96
public void set_geburtstag(String _geburtstag) { this._geburtstag = _geburtstag; }
9b7f42c7-85ea-46d5-ae3c-04d33d5d84a0
public String get_klasse() { return _klasse; }
215f0d16-2e36-4e3b-910b-77115e69614c
public void set_klasse(String _klasse) { this._klasse = _klasse; }
7ec9dd80-9cdc-4bf1-8429-3bff05ab6976
public String get_username() { return _username; }
29b7add7-bae1-4eb1-8dbf-f1989e5ba01f
public void set_username(String _username) { this._username = _username; }
40f5dd5d-daaa-426d-8065-6572bab45731
public String get_passwort() { return _passwort; }
af9014f8-73eb-4412-868f-9dde6baddd26
public void set_passwort(String _passwort) { this._passwort = _passwort; }
3079f59f-61cd-4a6b-b746-dec2441d13b0
public String get_rolle() { return _rolle; }
08184a5d-b0b2-42ab-b930-172585c7523f
public void set_rolle(String _rolle) { _rolle = "lehrer"; this._rolle = _rolle; }
7d9cd35a-0912-4d87-b785-0ee672274d79
public String get_konfession() { return _konfession; }
5008e759-94f8-49f6-a9a1-30fe397e18cc
public void set_konfession(String _konfession) { _konfession = "lehrer"; this._konfession = _konfession; }
7d67737b-dfe9-4a38-823d-e54216c3b0a7
public QueensLogic() { // constructor }
ce182704-3a0b-48a6-af64-942e4936ccfb
public void initializeGame(int size) { this.x = size; this.y = size; this.board = new int[x][y]; bdd = new BDDBuilder(size);// create the BDD board and the rules if (bdd.rulez.isZero()) {// check if the whole board is not satisfiable like when the size is 2*2 setValues(this.board, -1);// put crosses on all the squares in the board } bdd.findCrosses(board,numberOfQueens());// check for squares that should be crossed }
f33ca129-29c5-44a9-8d9f-896f8a658b21
public int[][] getGameBoard() { return board; }
85471546-a9ca-46c2-82a9-83cf827e1a12
public boolean insertQueen(int column, int row) { if (board[column][row] == -1 || board[column][row] == 1) { return true; } board[column][row] = 1; bdd.satisfiable(column, row); bdd.findCrosses(board, ++numberOfQueens); return true; }
3e7a69f4-bf4f-4b76-b780-658657cef5b1
private void setValues(int[][] board, int value) { for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[i].length; j++) { board[i][j] = value; } } }
f4f19c64-c285-47bf-a9ee-541d351fe226
private int numberOfQueens() { int count=0; for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[i].length; j++) { if(board[i][j]==1){ count++; } } } return count; }
89bc1136-d8cc-421d-8411-ac7837766fa9
public static void main() { int boardSize = 5; int nodesCount = boardSize * boardSize; nodesCount = nodesCount == 1 ? 10 : nodesCount; BDDFactory fact = JFactory.init(nodesCount, nodesCount); fact.setVarNum(nodesCount); BDD[][] board = new BDD[boardSize][boardSize]; // init the board for (int i = 0, varIndx = 0; i < board.length; i++) { for (int j = 0; j < board[i].length; j++, varIndx++) { board[i][j] = fact.ithVar(varIndx); } } // BDD rulez = checkBDD(board, fact); BDD True = fact.one(); BDD False = fact.zero(); // the expression x0 BDD x_0 = fact.ithVar(0); // the expression not x1 BDD nx_1 = fact.nithVar(1); BDD nA = fact.nithVar(2); BDD A = fact.ithVar(2); BDD nB = fact.nithVar(3); BDD nC = fact.nithVar(4); BDD nD = fact.nithVar(5); BDD nE = fact.nithVar(6); BDD AHor = (nA.or(nB)).and(nA.or(nC)).and(nA.or(nD)).and(nA.or(nE)); // Checks whether or not expression is unsat System.out.println("b is unsat? : " + True.isZero()); // checks whether expression is tautology System.out.println("b is tautology? : " + True.isOne()); // the expression (not x1 or x0) and (True or false) // BDD b = nx_1.or(x_0).and(True.or(False)); // BDD b = True.or(False).or(AHor); BDD b = A.or(nA); A = fact.one(); BDD c = A; System.out.println("b is tautology? : " + b.isOne()); System.out.println("b is tautology? : " + c.isOne()); // Checks whether or not expression is unsat System.out.println("b is unsat? : " + b.isZero()); // checks whether expression is tautology System.out.println("b is tautology? : " + b.isOne()); // In order to restrict or quantify the expression to a given assignment // we give the assignment as a conjunction where positive variables // indicate that the variable should be restricted to false, and vice // versa. BDD restriction_x1_true_x0_false = fact.ithVar(1).and(fact.nithVar(0)); BDD restricted = b.restrict(restriction_x1_true_x0_false); BDD existed = b.exist(x_0); // Exist. should be tautology System.out .println("Existiential quant. cause taut: " + existed.isOne()); // Restriction shoule be unsat: System.out.println("Restriction caused unsat: " + restricted.isZero()); // how to perform replacement BDDPairing replacement = fact.makePair(); int[] from = { 1 }; int[] to = { 0 }; replacement.set(from, to); BDD b_replaced = existed.replace(replacement); }
87b83a27-d92b-4577-8ca7-e34b33e989dd
public static void main(String[] arg) { QueensLogic l = new QueensLogic(); int size =8; l.initializeGame(size); QueensGUI g = new QueensGUI(l); // Setup of the frame containing the game JFrame f = new JFrame(); f.setSize(200 + size * 100, 200 + size * 100); f.setTitle("Queens Problem"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(g); f.setVisible(true); }
13f80d17-9b31-4ab8-b070-164e2bc53540
public QueensGUI(QueensLogic logic) { part = Toolkit.getDefaultToolkit().getImage("imgs/maze.png"); queen = Toolkit.getDefaultToolkit().getImage("imgs/queen.png"); invalid = Toolkit.getDefaultToolkit().getImage("imgs/invalid.png"); backgroundW = Toolkit.getDefaultToolkit().getImage("imgs/backgroundWhite.png"); backgroundB = Toolkit.getDefaultToolkit().getImage("imgs/backgroundBlack.png"); border_left = Toolkit.getDefaultToolkit().getImage("imgs/board_left.png"); border_right = Toolkit.getDefaultToolkit().getImage("imgs/board_right.png"); border_top = Toolkit.getDefaultToolkit().getImage("imgs/board_top.png"); border_bottom = Toolkit.getDefaultToolkit().getImage("imgs/board_bottom.png"); corner_left_top = Toolkit.getDefaultToolkit().getImage("imgs/corner_top_left.png"); corner_left_bottom = Toolkit.getDefaultToolkit().getImage("imgs/corner_bottom_left.png"); corner_right_top = Toolkit.getDefaultToolkit().getImage("imgs/corner_top_right.png"); corner_right_bottom = Toolkit.getDefaultToolkit().getImage("imgs/corner_bottom_right.png"); this.logic = logic; this.addMouseListener(this); }
86bca2d3-b337-41f2-8561-c8e64e5cc0ec
public void paint(Graphics g){ this.setDoubleBuffered(true); Insets in = getInsets(); g.translate(in.left, in.top); int[][] gameboard = logic.getGameBoard(); int cols = gameboard.length; int rows = gameboard[0].length; //draw borders for (int i = 0;i<cols;i++) { g.drawImage(border_left, 0, 100+100*i, this); g.drawImage(border_right, 100 + gameboard.length *100, 100+100*i, this); g.drawImage(border_top, 100+100*i, 0, this); g.drawImage(border_bottom, 100+100*i, 100+gameboard.length*100, this); } //draw board for (int c = 0; c < cols; c++){ for (int r = 0; r < rows; r++){ int player = gameboard[c][r]; if ((c+r)%2==0) g.drawImage(backgroundW, 100+100*c, 100+100*r, this); else g.drawImage(backgroundB, 100+100*c, 100+100*r, this); if (player == 1) // red = computer g.drawImage(queen, 100+100*c, 100+100*r, this); if (player == -1)//invalid g.drawImage(invalid, 100+100*c, 100+100*r, this); g.drawImage(part, 100+100*c, 100+100*r, this); } } //draw corners g.drawImage(corner_left_top, 0, 0, this); g.drawImage(corner_left_bottom, 0, 100+rows*100, this); g.drawImage(corner_right_top, 100+100*cols, 0, this); g.drawImage(corner_right_bottom, 100+100*cols, 100+rows*100, this); }
98e4af82-a366-4a32-b71e-9b03429a385f
public void mouseClicked(MouseEvent e){ chosenColumn = e.getX()/100 - 1; chosenRow = e.getY()/100 - 1; //this method connects the UI with the logic int size = logic.getGameBoard().length; if ((chosenColumn >= 0) && (chosenColumn < size) && (chosenRow >= 0) && (chosenRow < size)) { //this is the main method that connects the UI with the Logic. logic.insertQueen(chosenColumn, chosenRow); repaint(); } }
ba0e7482-4a0a-421a-9ad0-55b4d447cdc2
public void mouseEntered(MouseEvent e){}
3abee9ee-6226-46e9-a810-0a8ece27f933
public void mouseExited(MouseEvent e){}
06380887-8966-41f3-9ae6-59d96350ec38
public void mousePressed(MouseEvent e){}
d98b62bb-0bb2-432b-a2ca-0f174a6267f3
public void mouseReleased(MouseEvent e){}
7f1fb581-920b-4817-9d77-9b39abb018bf
public BDDBuilder(int boardSize) { this.boardSize = boardSize; int nodesCount = boardSize * boardSize; nodesCount = nodesCount == 1 ? 2 : nodesCount;// to make it work for size 1*1 int size = 782 * (int) Math.pow(2, boardSize); fact = JFactory.init(size * 10, size); fact.setVarNum(nodesCount);// create a variable for each square in the board buildBDD(); }
7eba6731-69f8-4524-b50e-5e06ad6eb4ed
private void buildBDD() { rulez = fact.one(); //vertical rulez.andWith(buildVerticalBdd()); //horizontal rulez.andWith(buildHorizontalBdd()); // positive diagonal rulez.andWith(buildPosDiagonalBdd()); // negative diagonal rulez.andWith(buildNegDiagonalBdd()); // at least one queen in each row rulez.andWith(buildMinCountBdd()); }
a73a6417-6918-407c-8bd7-d9ea5aed3b4d
private BDD buildVerticalBdd() { BDD temp = fact.one(); for (int i = 0; i < boardSize; i++) { for (int j = 0; j < boardSize; j++) { for (int k = j + 1; k < boardSize; k++) { temp.andWith(fact.nithVar(j * boardSize + i).or( fact.nithVar(k * boardSize + i))); } } } return temp; }
7f7ed2a2-746b-4ac4-b858-89deb88d190f
private BDD buildHorizontalBdd() { BDD temp = fact.one(); for (int i = 0; i < boardSize; i++) { for (int j = 0; j < boardSize; j++) { for (int k = j + 1; k < boardSize; k++) { temp.andWith(fact.nithVar(i * boardSize + j).or( fact.nithVar(i * boardSize + k))); } } } return temp; }
d3a5ae40-5db8-476f-b65d-c031e6d4a9aa
private BDD buildPosDiagonalBdd() { BDD temp = fact.one(); for (int i = 0; i < boardSize; i++) { for (int j = 0; j < boardSize; j++) { for (int _i = i + 1, _j = j + 1; _i < boardSize && _j < boardSize; _i++, _j++) { temp.andWith(fact.nithVar(i * boardSize + j).or( fact.nithVar(_i * boardSize + _j))); } } } return temp; }
c479b5a4-026b-4049-b7be-aa125f63789b
private BDD buildNegDiagonalBdd() { BDD temp = fact.one(); for (int i = 0; i < boardSize; i++) { for (int j = boardSize - 1; 0 <= j; j--) { for (int _i = i + 1, _j = j - 1; _i < boardSize && 0 <= _j; _i++, _j--) { temp.andWith(fact.nithVar(i * boardSize + j).or( fact.nithVar(_i * boardSize + _j))); } } } return temp; }
03e6e45b-336e-4f5e-be48-22f7b9ef1f7e
private BDD buildMinCountBdd() { BDD temp = fact.one(); for (int i = 0; i < boardSize; i++) { BDD rowBdd = fact.zero(); for (int j = 0; j < boardSize; j++) { rowBdd.orWith(fact.ithVar(i * boardSize + j)); } temp.andWith(rowBdd); } return temp; }
c0739b1b-8a96-4006-a7f7-3851044f3238
public boolean satisfiable(int x, int y) { this.rulez.restrictWith(fact.ithVar(x * boardSize + y)); return !this.rulez.isZero();// return true if its satisfiable }
80028544-e5ff-4b74-9275-6f4481759def
public void findCrosses(int[][] board2, int numberOfQueens) { int emptySpaceCounter = 0; for (int i = 0; i < boardSize; i++) { for (int j = 0; j < boardSize; j++) { if (board2[i][j] != 1) { // a counter for checking if all the sat have zero value int count = 0; for (byte[] list : (LinkedList<byte[]>) rulez.allsat()) { // check all the sat for putting a cross in the board if (list[i * boardSize + j] == 1) { break; } else { count++; } } if (count == rulez.allsat().size()) { board2[i][j] = -1;// put a cross in that position } if (board2[i][j] == 0) { emptySpaceCounter++; } } } } if (emptySpaceCounter == board2.length - numberOfQueens) { // when the number of queens left is equal to the empty spaces putQueens(board2); } }
49b63e08-ef13-4c51-87cc-4aafb1fd2b47
private void putQueens(int[][] board2) { for (int i = 0; i < boardSize; i++) { for (int j = 0; j < boardSize; j++) { if (board2[i][j] == 0) { board2[i][j] = 1; } } } }
5e9aaf98-94b9-4b78-8f08-c5d928861a83
@Override public void order(Order order) { log.info("Save order record to ZoneB Ordering database. \n" + "orderId: " + order.getOrderId() + "\n" + "itemId: " + order.getItemId() + "\n" + "orderNum: " + order.getItemId() ); }
4e7ddd78-3efc-4d3d-9157-c79ac2789b8b
public void order(Order order);
ea05a731-aec6-4f87-b97f-a8639c467886
public void order(Order order);
504942b9-b93f-42e0-8ba9-23721f121cf0
@Override public void order(Order order) { log.info("Save order record to ZoneA Ordering database. \n" + "orderId: " + order.getOrderId() + "\n" + "itemId: " + order.getItemId() + "\n" + "orderNum: " + order.getItemId() ); }
21899012-7e2f-48fc-b14d-13a42a722f2b
public void order(Order order);
cb551939-1f27-458a-9bad-07a2e1ae26a8
public String getOrderId() { return orderId; }
1c05daa8-2ef3-4f1e-9b46-7c93bccab0f9
public void setOrderId(String orderId) { this.orderId = orderId; }
d7f12e39-8939-4554-8b35-8f6f5918f789
public String getItemId() { return itemId; }
09ca6b18-6182-4756-b162-e8c3b20e4385
public void setItemId(String itemId) { this.itemId = itemId; }
9f04e225-8e24-4cf9-9fba-3d8b527aa779
public String getOrderNum() { return orderNum; }
ac37c879-9fb9-416b-99fb-9ebed0f8f76b
public void setOrderNum(String orderNum) { this.orderNum = orderNum; }
3e8363b6-8b3e-4b0e-914f-62f46343a340
public String getCustomerId() { return customerId; }
5a5c146b-42b0-4bfa-8851-ecdfa8ea7cf8
public void setCustomerId(String customerId) { this.customerId = customerId; }
f3854195-a74e-487b-82f5-7d753c307e3e
public String getZipCode() { return zipCode; }
a823e38a-0516-48d2-a6e7-e4b90d8a2fce
public void setZipCode(String zipCode) { this.zipCode = zipCode; }
b4c29ba1-c15d-46f6-b60f-632cbbcd897a
@Override public String toString() { return "Order [orderId=" + orderId + ", itemId=" + itemId + ", orderNum=" + orderNum + ", customerId=" + customerId + ", zipCode=" + zipCode + "]"; }
28b17f49-c76d-4a00-b356-5033ace7df2c
public Food(GameCanvas gameCanvas, Player player) { super(gameCanvas); this.player = player; placeFood(); }
bbb73082-1fde-418b-97e3-658695b5c7cb
private void placeFood() { Random rand = new Random(); int xPos; int yPos; do { xPos = rand.nextInt(gameCanvas.X_GRID_SIZE); yPos = rand.nextInt(gameCanvas.Y_GRID_SIZE); } while( player.occupies(xPos, yPos) ); this.xPos = xPos; this.yPos = yPos; }
ad56cf0e-01aa-4550-9059-c9cafd3ede2b
@Override public void update() { gameCanvas.drawBlock(xPos, yPos, COLOR); if( player.occupies(xPos, yPos) ) { System.out.println("Food found"); player.foundFood(); placeFood(); } }
0899e216-1622-4c4c-a807-23eda7208d27
public GuiApplication() { gameEntities = new ArrayList<>(); }
a5cd5731-deec-4aa9-b97c-73451f434280
@Override public void start(Stage stage) { StackPane root = new StackPane(); Scene scene = new Scene(root, 300, 300); GameCanvas canvas = new GameCanvas(); GraphicsContext gc = canvas.getGraphicsContext2D(); root.getChildren().add(canvas); stage.setTitle("Snake"); stage.setScene(scene); stage.show(); Player p1 = new Player(canvas); Food food = new Food(canvas, p1); scene.setOnKeyPressed(p1); gameEntities.add(p1); Timeline tl = new Timeline(new KeyFrame(Duration.millis(400), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { for(GameEntity e : gameEntities) { food.update(); p1.update(); } } })); tl.setCycleCount(Timeline.INDEFINITE); tl.play(); }
2f84d8fc-d91d-4da8-a472-1d6eb0cfc67a
@Override public void handle(ActionEvent event) { for(GameEntity e : gameEntities) { food.update(); p1.update(); } }
3990348e-2ad9-4cd4-867e-ecfc37b7f46d
public static void main(String[] args) { launch(args); }
e1fb778f-3f9d-4529-9534-ac753ede2c49
public GameEntity(GameCanvas gameCanvas) { this.gameCanvas = gameCanvas; }
aaf2fe4d-a534-40e8-92ab-3463b47f07b8
protected abstract void update();
50f36731-9151-410b-a053-791855f46da5
public BodySegment(int xPos, int yPos, int segmentNr) { this.xPos = xPos; this.yPos = yPos; this.segmentNr = segmentNr; tryGrow(); }
2b451c34-8376-4007-8a72-f4419d0b43c4
private void tryGrow() { int nextSegmentNr = segmentNr + 1; if(nextSegmentNr < bodyLength) { nextSegment = new BodySegment(xPos, yPos, nextSegmentNr); } else { nextSegment = null; tail = this; } }
146ee9d6-72fd-46f0-a1ff-9343153f768f
public void update(int xPos, int yPos) { if(nextSegment == null) { gameCanvas.drawBlock(this.xPos, this.yPos, Color.WHITE); } else { nextSegment.update(this.xPos, this.yPos); } this.xPos = xPos; this.yPos = yPos; gameCanvas.drawBlock(this.xPos, this.yPos, COLOR); }
b1fba796-caa1-4dae-a2a5-1d2d3ec18514
public boolean occupies(int xPos, int yPos) { if(this.xPos == xPos && this.yPos == yPos) return true; else if(nextSegment == null) return false; else return nextSegment.occupies(xPos, yPos); }
75ac4598-05f7-4b30-9d01-ec88cd6e501a
public Player(GameCanvas canvas) { super(canvas); tail = null; body = new BodySegment(xPos, yPos, 0); }
20ae37fa-58a6-4fb7-a597-079cee4e76d3
@Override public void update() { moveDirection = nextMoveDirection; switch(moveDirection) { case UP: yPos--; break; case DOWN: yPos++; break; case LEFT: xPos--; break; case RIGHT: xPos++; break; } body.update(xPos, yPos); }
3e405ad3-2ce4-4be1-9a85-abcc018e64a2
@Override public void handle(KeyEvent event) { final KeyCode keyCode = event.getCode(); switch(keyCode) { case UP: if(moveDirection != Direction.DOWN) nextMoveDirection = Direction.UP; break; case DOWN: if(moveDirection != Direction.UP) nextMoveDirection = Direction.DOWN; break; case LEFT: if(moveDirection != Direction.RIGHT) nextMoveDirection = Direction.LEFT; break; case RIGHT: if(moveDirection != Direction.LEFT) nextMoveDirection = Direction.RIGHT; break; } }
a03ed58a-474a-4211-a34b-d07d0236fd5d
public boolean occupies(int xPos, int yPos) { return body.occupies(xPos, yPos); }
ee2555c4-46cb-40e5-8be3-9d5f44fa0509
public void foundFood() { bodyLength = (int)(bodyLength * GROW_FACTOR); tail.tryGrow(); }
b8d2edcc-8a1a-41d6-bfde-baa4ac970505
public int getXPos() { return xPos; }
eda55ba5-bb0d-419d-aa75-42a3e7d724bc
public int getYPos() { return yPos; }
a834edf6-0923-46f6-bc88-f18b0b92363a
public GameCanvas() { super(WIDTH, HEIGHT); gc = getGraphicsContext2D(); }
df325e35-24b0-4b6e-8466-8a2ea5bbe7c2
public void drawBlock(int xPos, int yPos, Color color) { int x = RECT_WIDTH * xPos; int y = RECT_HEIGHT * yPos; gc.setFill(color); gc.fillRect(x, y, RECT_WIDTH, RECT_HEIGHT); }
753a71e2-e786-4388-a786-44e332276bf9
public void clear() { gc.setFill(Color.WHITE); gc.fillRect(0, 0, WIDTH, HEIGHT); }