id
stringlengths
36
36
text
stringlengths
1
1.25M
a81d3e1a-aa7c-4e1e-804e-b612dc93e282
public ItemEBShovel(ToolMaterial material) { super(material); }
69affb8a-b333-42ee-a91e-6035ef03c834
@Override public boolean onBlockDestroyed(ItemStack tool, World world, Block block, int x, int y, int z, EntityLivingBase user) { if(user instanceof EntityPlayer && canMine(block) && !world.isRemote) { EntityPlayer player = (EntityPlayer)user; int lvlE = tool.stackTagCompound.getInteger("lvl"); Block dro...
6a2cb29c-099f-4280-bf92-4fd4bbfbae13
private boolean canMine(Block block) { return block == Blocks.dirt ? true : block == Blocks.sand ? true : block == Blocks.gravel ? true : false; }
f3228e67-5056-455e-9ae2-0cdcf0ecad2d
@Override public void onCreated(ItemStack item, World world, EntityPlayer player) { item.stackTagCompound = new NBTTagCompound(); item.stackTagCompound.setInteger("lvl", 1); item.stackTagCompound.setBoolean("drops", true); }
b821cbba-a298-44c8-99ae-350ca1375cf2
@Override public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { if(player.isSneaking()) { ItemStack result = item; Boolean drops = result.stackTagCompound.getBoolean("drops"); result.stackTagCompound.setBoolean("drops", drops == true ? false : true); return resu...
d26779fc-695e-4b71-9142-b2625a693103
public ItemBBSword(ToolMaterial material) { super(material); this.setCreativeTab(Ref.tab); }
e911517b-66b5-4808-8185-2133e2a130f0
public ItemBBShovel(ToolMaterial material) { super(material); this.setCreativeTab(Ref.tab); }
a637ea74-b5ba-44c6-abe1-da97090340cf
public ItemBBAxe(ToolMaterial material) { super(material); this.setCreativeTab(Ref.tab); }
5c64b73f-b238-4c43-8489-5020093f6e6d
public ItemBBEnchant(int ench) { super(); this.setCreativeTab(Ref.tab); this.setMaxStackSize(1); }
eb48b77b-df65-4ba1-bb00-fe886a876bcd
public ItemThickAxe(ToolMaterial material) { super(EnumHelper.addToolMaterial("thick" + material.name(), material.getHarvestLevel(), material.getMaxUses()*4, material.getEfficiencyOnProperMaterial(), material.getDamageVsEntity(), material.getEnchantability())); this.setCreativeTab(Ref.tab); }
02e8b1cc-1ab2-4a30-bb06-a1bb2ad7eb5c
public ItemBBPick(ToolMaterial material) { super(material); this.setCreativeTab(Ref.tab); }
cf3fb864-97b1-494f-a6cc-cbd55e7cf7ca
public ItemThickPickaxe(ToolMaterial material) { super(EnumHelper.addToolMaterial("thick" + material.name(), material.getHarvestLevel(), (int)(material.getMaxUses()*3.75), (float)(material.getEfficiencyOnProperMaterial()*1.15), material.getDamageVsEntity(), material.getEnchantability())); this.setCreativeTab(Ref...
5a5f28a3-cbaf-4887-a0c8-a290fcaa34be
public ItemSmashedOre() { super(); this.setUnlocalizedName("smashedOre"); }
e873da9e-a81e-42f1-be27-760a6e13af64
@Override public void onUpdate(ItemStack item, World world, Entity entity, int int1, boolean bool) { }
3572ecc2-6e6b-4361-820b-ece45e2ba793
public static void main(String[] args) { PApplet.main(new String[]{ "controller.Main"}); }
821d0fbc-5ad9-4afd-8d1e-4677bcd90439
public void setup() { size(GuiConfig.SCREEN_WIDTH, GuiConfig.SCREEN_HEIGHT); this.screenWidth = GuiConfig.SCREEN_WIDTH; this.screenHeight = GuiConfig.SCREEN_HEIGHT; background(100, 100, 100); env = new Environment(this); }
d9a18927-c9b8-40ad-be95-4e59edd39854
public void draw() { env.draw(); }
bae09bb9-929d-4558-b460-2a28f51768ab
public void mouseClicked() { // testliste mit vordefinierten zuegen!! LinkedList<Symbol> results = new LinkedList<Symbol>(); Minimax mmPlayerMax = new Minimax(Player.MAX, BOARD_SIZE); Minimax mmPlayerMin = new Minimax(Player.MIN, BOARD_SIZE); State prevState = new State(); ...
d5db065c-0ad1-47a0-9206-03f1670e7e8a
private Symbol stateToSymbol(State prevState, State currState) { for(int i=0; i<BOARD_SIZE; i++) { for(int j=0; j<BOARD_SIZE; j++) { if(prevState.field[i][j] != currState.field[i][j]) { if(currState.field[i][j] == 1) return new Cross(i*BOARD_SIZE+j); else...
c6591ced-8b66-4221-b0b1-76826c92a92d
public void draw();
b0aa1ec0-f944-4227-b827-74a9507e3e9f
public Coordinate2D get_clicked_coordinates();
937433eb-63f3-4217-8ac5-aa17cd9cdc9b
void set_results( LinkedList<Symbol> results);
ac81fa08-e822-45bb-9ea8-1708187fbff6
public void draw( PApplet gui, float x, float y, float width, float height, int transparency);
38736ea7-80cb-4252-a741-6a676548b81c
public int get_section();
65a444e1-a3b0-4c6d-aac5-08572a33eb96
public Board2D( PApplet gui) { this.gui = gui; this.mouse_coordinates = new Coordinate2D( ); board_x = (GuiConfig.SCREEN_WIDTH/2) - (GuiConfig.BOARD_WIDTH/2); board_y = (GuiConfig.SCREEN_HEIGHT/2) - (GuiConfig.BOARD_HEIGHT/2); cell_width = GuiConfig.BOARD_WIDTH...
08be7079-bf09-4a0c-8061-704d36ddfac2
public void set_results( LinkedList<Symbol> results ) { this.results = results; this.results_animated = new LinkedList<Symbol>(); }
c7db1974-f9d1-4df7-9c68-c52f3f149174
@Override public void draw() { gui.smooth(); gui.strokeWeight(2); gui.stroke(100, 100, 100); this.draw_plane( board_x, board_y ); this.draw_columns( board_x, board_y ); this.draw_rows( board_x, board_y ); this.draw_symbols(); }
006a20a9-c9d9-4943-92df-7013735e3b5b
private void draw_symbols() { this.fill_results_animated(); Coordinate2D co = new Coordinate2D(); int margin = GuiConfig.MARGIN; Iterator<Symbol> it = this.results_animated.iterator(); int size_counter = 1; while( it.hasNext() ) { Symbol sym = ...
1eccf574-a2b3-4f02-bb93-c7e83f36ded7
private void calculate_transparency_bounds() { int speed = GuiConfig.TRANSPARENCY_SPEED; if( speed > 30 ) speed = 30; if( speed < 5 ) speed = 5; if( this.transparency >= 255 ) this.transparency = 255; this.transparency += speed; }
f0247e79-831e-4326-bb93-ad9bc4cfebeb
private void fill_results_animated() { ++step_counter; if( step_counter % this.get_animation_speed() == 0 ) { if( results.size() > 0 ) { results_animated.add( results.removeFirst() ); transparency = 0; } } i...
7d29b93a-1a10-4d17-a8ce-1cf91f13e45b
private int get_animation_speed() { int speed = 100 - GuiConfig.SPEED; if( speed < 10 ) speed = 10; if( speed > 100 ) speed = 100; return speed; }
4ae26a9b-d8a5-4d25-ae2a-29ded0fff086
@Override public Coordinate2D get_clicked_coordinates( ) { this.mouse_coordinates.mouse_x = gui.mouseX; this.mouse_coordinates.mouse_y = gui.mouseY; Coordinate2D co = mouse_coordinates.calculate_coordinates2D(board_x, board_y, cell_width, cell_height); return co; }
36bba7ff-d2a5-439b-b253-33a740773225
private void draw_rows( float board_x, float board_y ) { for( int i = 1; i <= GuiConfig.BOARD_COLUMNS; ++i ) { float row_x1 = board_x; float row_x2 = board_x + GuiConfig.BOARD_WIDTH; float row_y = board_y + i * (GuiConfig.BOARD_HEIGHT / GuiConfig.BOARD_COLUMN...
45cc06ab-9ca1-47c8-aff6-42def3eab8c7
private void draw_plane( float board_x, float board_y ) { gui.fill(255,255,255); gui.rect( board_x , board_y,GuiConfig.BOARD_WIDTH, GuiConfig.BOARD_HEIGHT ); }
d02e45ff-e6e2-4fd9-b5dc-fd63b651ff7a
private void draw_columns( float board_x, float board_y ) { for( int i = 1; i <= GuiConfig.BOARD_COLUMNS; ++i ) { float column_x = board_x + i * (GuiConfig.BOARD_WIDTH / GuiConfig.BOARD_COLUMNS); float column_y1 = board_y; float column_y2 = board_y + GuiConfig.B...
54341c6f-1f66-49ba-82ae-cbdaf919e16c
public Environment( PApplet applet ) { this.gui = applet; this.setup(); this.board = new Board2D(gui); }
36a8c589-b733-491c-b797-0cd016ab7102
public void setup() { }
24227d24-4635-4eaa-ad1a-3fb6e26a34a8
public void set_board( Board bord ) { this.board = bord; }
b2c96e03-b8ac-4b9f-983f-a4c41d2d8fbb
public Board get_board() { return this.board; }
0c5e3936-7667-47df-b598-9553af6d5578
public void draw() { this.board.draw(); }
58f60a00-b3d0-4fba-bdda-ceb7c26a7ccb
public Coordinate2D( ) { }
b7b7d7f0-4f71-4c35-ba9f-85e6e5d42497
public Coordinate2D(int section, float mouse_x, float mouse_y, float section_x, float section_y) { this.section = section; this.mouse_x = mouse_x; this.mouse_y = mouse_y; this.section_x = section_x; this.section_y = section_y; }
944d0b5c-6515-4d42-a194-1b62d4399624
public Coordinate2D calculate_coordinates2D(float board_x, float board_y, float cell_width, float cell_height ) { int section_counter = 0; this.section = section_counter; for( int i = 1; i <= GuiConfig.BOARD_COLUMNS; ++i ) { float start_y = (board_y + i * cell_he...
ce20fd71-d757-409d-a7e6-534281b4b676
public Coordinate2D calculate_coordinates2D_from_section(float board_x, float board_y, float cell_width, float cell_height, int section ) { int section_counter = 0; this.section = section_counter; for( int i = 1; i <= GuiConfig.BOARD_COLUMNS; ++i ) { float start_...
b04c13ff-ef80-4021-b3c2-73c748a10bda
private boolean is_within_coordinate_range( float start_x, float start_y, float end_x, float end_y ) { if( this.mouse_x >= start_x && this.mouse_x < end_x ) { if( this.mouse_y >= start_y && this.mouse_y < end_y ) { return true; } } ...
45fe0fc0-6a21-4f81-b863-1bd3ddb0f03e
public Circle( int section ) { this.section = section; }
d8317daa-9b2a-4cba-a1f9-70a4c39e0184
@Override public void draw(PApplet gui, float x, float y, float width, float height, int transparency) { gui.ellipseMode(PApplet.CORNER); int offset = 5; gui.strokeWeight(GuiConfig.STROKE-5); gui.stroke( 200,200,200,transparency ); gui.ellipse(x+offset,y+offset,width,he...
d58b07b5-e4d4-4a4f-bb96-7973171ff091
@Override public int get_section() { return this.section; }
aae994f8-12c8-494a-b723-523e9346f687
public Cross( int section ) { this.section = section; }
b9e039b2-b109-433d-a722-e1d676bbd7ce
@Override public void draw(PApplet gui, float x, float y, float width, float height, int transparency) { gui.fill(255,255,255); gui.smooth(); gui.strokeWeight(GuiConfig.STROKE); gui.stroke( 0,0,255,transparency ); gui.line( x, y, x+width, y+height ); gui.line( x+...
c7de2abf-379e-4824-8ad2-0b9759728605
@Override public int get_section() { return this.section; }
76737460-6203-4461-a2e5-fb334933a855
RectButton(PApplet gui, int ix, int iy, int isize) { super(gui, ix, iy, isize); this.gui = gui; x = ix; y = iy; size = isize; }
9faa6336-5b2b-4aa4-b168-6393aabe7a6a
boolean over() { if( overRect(x, y, size, size) ) { over = true; return true; } else { over = false; return false; } }
5f96f4e4-db0f-49b9-a9a0-7d14da5b5acb
void draw() { gui.stroke(255); gui.fill(255,255,255); gui.rect(x, y, size, size); }
a0a445a6-fcec-4bce-a2c8-8db1c61e0991
public Action deepCopy() { Action copy = new Action(); copy.row = this.row; copy.col = this.col; copy.player = this.player; return copy; }
46394c1b-d78b-432f-acce-8e61980615d0
public State() { field = new int[Minimax.boardSize][Minimax.boardSize]; for(int i=0; i<Minimax.boardSize; i++) for(int j=0; j<Minimax.boardSize; j++) field[i][j] = 0; }
c61a5cfb-8a5b-442a-a1e5-ef4be3ec4fe2
public State deepCopy() { State copy = new State(); for(int i=0; i<Minimax.boardSize; i++) for(int j=0; j<Minimax.boardSize; j++) copy.field[i][j] = this.field[i][j]; return copy; }
a3f98f23-dfe6-4bc1-8f3f-885c5af84cfc
public String toString() { String s = ""; for (int i=0; i<Minimax.boardSize; i++) { s += "|"; for (int j=0; j<Minimax.boardSize; j++) { if (field[i][j] == 1) s += "X"; else if (field[i][j] == -1) ...
8c4e0bba-9417-438b-94a5-e7335e32c0d4
public Minimax(Player p, int boardSize) { this.player = p; Minimax.boardSize = boardSize; }
b72e8150-ec61-469a-9c51-8051acefebba
public State getMinimaxDecision(State initialState) { System.out.println("player: " + player); long t1 = System.currentTimeMillis(); Action bestAction = null; double bestUtility = Double.NEGATIVE_INFINITY; List<Action> actionList = getActions(initialState); for (Action action : actionList) { d...
e7fd037c-48c1-468f-b3d4-84de56ce0483
private double minValue(State state) { double utility = Double.POSITIVE_INFINITY; if (terminalTest(state)) { // System.out.println("terminal: "); // System.out.println(state.toString()); // System.out.println(""); return utility(state); } List<Action> actionList = getActions(state); for ...
2bd10f7d-8d6a-46d9-b042-77ce1113dbcb
private double maxValue(State state) { double utility = Double.NEGATIVE_INFINITY; if (terminalTest(state)) { // System.out.println("terminal: "); // System.out.println(state.toString()); // System.out.println(""); return utility(state); } List<Action> actionList = getActions(state); for (A...
59e16a3d-ec4a-4e87-b8c8-ee2175ff1d06
private State getResult(State currentState, Action action) { State resultState = currentState.deepCopy(); if (action.player == Player.MAX) resultState.field[action.col][action.row] = 1; else resultState.field[action.col][action.row] = -1; // System.out.println("CURRENT RESULT: "); // System.out.p...
db9ea0b1-3a64-4663-96c4-e57a8ca6c3c5
private List<Action> getActions(State state) { List<Action> actions = new ArrayList<Action>(); int moves = 0; for (int i=0; i<boardSize; i++) for (int j =0; j<boardSize; j++) if(state.field[i][j] != 0) moves++; Player player = Player.MAX; if(moves % 2 == 1) player = Player.MIN; for (...
e374f281-09e8-4873-aaae-b1de37cc6797
private int utility(State state) { int val = 0; for (int i=0; i<boardSize; i++) val += state.field[i][i]; if (val == boardSize && player == Player.MAX || val == -boardSize && player == Player.MIN) return 1; if ( val == boardSize && player == Player.MIN || val == -boardSize && player ==...
fb907455-306b-4c3d-9276-7cb4e2ade4bd
public boolean terminalTest(State state) { int playedFields = 0; for (int i=0; i<boardSize; i++) { int totalRow = 0; for (int j=0; j<boardSize; j++) { if (state.field[i][j] != 0) playedFields++; totalRow += state.field[i][j]; } if (Math.abs(totalRow) == boardSize) ret...
35ed15d6-a3dd-4a7c-b4ee-64b4611f817d
List<T> queryForList(RowMapper<T> rowMapper) throws SQLException;
0efe4856-be7f-4db7-ae35-d11dbb0c9a35
T queryForObject(RowMapper<T> rowMapper) throws SQLException;
88d9ce69-1b98-4a9b-bbe5-3484856b16af
String queryForString() throws SQLException;
931c3018-9970-4413-bff5-4df9e5453360
Integer queryForInteger() throws SQLException;
69441116-3915-4245-8c8d-f26e818a2394
Long queryForLong() throws SQLException;
c833a2d3-ced2-4eea-9b7e-631a461950fa
Date queryForDate() throws SQLException;
f381767c-02ac-4a55-9d0e-374a7de12ef3
Date queryForTimestamp() throws SQLException;
464c1d0e-340c-4785-9c52-6977d9deb9a4
Boolean queryForBoolean() throws SQLException;
4a7c4f7e-5a62-4974-8a1a-75ef79434988
Query<T> setString(String name, String value) throws SQLException;
1ae74ce5-aa01-42af-b6be-2ebeceb5fe47
Query<T> setInteger(String name, Integer value) throws SQLException;
a5d74895-b5e4-4650-b429-132128a68420
Query<T> setLong(String name, Long value);
9a54ead5-f71a-44c6-9ef7-6e4c3ad1bd0b
Query<T> setDate(String name, Date value);
52f6503b-36aa-4338-ae76-dc8f4cb18b52
Query<T> setBoolean(String name, Boolean value);
f5e9ec41-5128-47ba-9a9b-3d10edbec582
Query<T> setTimestamp(String name, Date value);
e368dee9-fda6-4f6f-affb-a743aa6df7dd
void execute() throws SQLException;
571820d2-b760-44c2-8da3-cc6c24a73071
void commit() throws SQLException;
13c0d8aa-7501-4a09-8c87-2ce9b404e3f0
void rollback() throws SQLException;
f7163bd6-cf94-46e6-8526-782640a37e6e
Query query(String statement) throws SQLException;
bbd72636-d38a-4895-8e4d-06f8929cbdc9
Update update(String statement) throws SQLException;
baf646e9-0e89-4d8a-ad14-fcb4100f7881
public DatabaseException() { }
ba0a9794-a926-4f66-b551-ad65d082312a
public DatabaseException(String message) { super(message); }
d3dd7fb4-f2bb-4ae9-94ec-4d2f1f5e7586
public DatabaseException(String message, Throwable cause) { super(message, cause); }
80abd021-beb6-4d8e-ad66-27a21710544c
public DatabaseException(Throwable cause) { super(cause); }
002ef386-8777-4438-a027-82affc688095
public DatabaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); }
a0a30f55-ae93-47bd-ab08-939a3a954778
T mapRow(ResultSet rs) throws SQLException;
35fd8577-e0c3-45cf-a376-b92ba6eafa31
public Database(DataSource dataSource) { this.dataSource = dataSource; }
f10dadaa-e515-4860-aacb-18fce44debc6
public Database(String driver, String url, String username, String password) { dataSource = new BasicDataSource(); ((BasicDataSource) dataSource).setDriverClassName(driver); ((BasicDataSource) dataSource).setUrl(url); ((BasicDataSource) dataSource).setUsername(username); ((Basic...
ef13492c-a2d7-4dbb-8ae3-86f8ae40fa37
public void close() throws SQLException { if (dataSource instanceof BasicDataSource) { ((BasicDataSource) dataSource).close(); } }
0deaf505-f44e-4990-9b8c-3f51462a5457
public Query query(String statement) throws SQLException { return new QueryImpl(dataSource.getConnection(), statement, true); }
182737c5-96bf-41e8-98dd-3045fc7c4ad2
public Update update(String statement) throws SQLException { return new UpdateImpl(dataSource.getConnection(), statement, true); }
7447c420-a154-4d37-9cd3-087a86e647af
public Transaction startTransaction() throws SQLException { return new TransactionImpl(dataSource.getConnection()); }
3cfec606-28a0-4962-8d3e-1f8bf3c6bec4
public NamedParameterStatement(Connection connection, String query) throws SQLException { indexMap = new HashMap(); String parsedQuery = parse(query, indexMap); statement = connection.prepareStatement(parsedQuery); }
40b3a525-6197-4869-8db8-dcc1ac08ab4d
static final String parse(String query, Map paramMap) { // I was originally using regular expressions, but they didn't work well //for ignoring // parameter-like strings inside quotes. int length = query.length(); StringBuilder parsedQuery = new StringBuilder(length); boo...
4ee1e6d4-24df-49ac-9deb-e98d7a4d7a02
public Set getParameterNames() { return indexMap.keySet(); }