Java Snake Xenzia Game . Jar . 128x160 . May 2026

MIDlet-1: SnakeXenzia, icon.png, com.snakexenzia.SnakeMIDlet
MIDlet-Jar-Size: 45678
MIDlet-Jar-URL: SnakeXenzia.jar
MIDlet-Name: SnakeXenzia
MIDlet-Vendor: YourName
MIDlet-Version: 1.0.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
import javax.microedition.lcdui.*;
import java.util.*;

public class SnakeCanvas extends Canvas implements Runnable private final int WIDTH = 128, HEIGHT = 160, CELL = 8; private final int ROWS = HEIGHT / CELL; // 20 private final int COLS = WIDTH / CELL; // 16

private LinkedList snake;
private int appleX, appleY, direction, score;
private boolean running;
// Implementation of game loop (move snake, spawn apple, check collision)
// Draw using fillRect with scaled cells to fit 128x160

Reset size check: Max X = (COLS-1)*CELL, Max Y = (ROWS-1)*CELL → snake never goes outside 128x160. Java Snake Xenzia Game . Jar . 128x160 .

public void generateRandomFood(Snake snake) 
    Random r = new Random();
    while(true) 
        int fx = r.nextInt(GRID_W);
        int fy = r.nextInt(GRID_H);
        if(!snake.occupies(fx, fy)) 
            setPosition(fx, fy);
            break;

Optimization for 16x20 grid:
Max loop iterations ~400, fine for small grid. For low memory devices, track empty cells. MIDlet-1: SnakeXenzia, icon