Skip to content

Instantly share code, notes, and snippets.

@panmari
panmari / Tu16.java
Created September 25, 2012 12:32
Many Turtles & Arc => flickering
// Tu16java
package app.tu16;
import turtle.*;
public class Tu16 extends Playground
{
public void playgroundPressed(double x, double y)
{
@panmari
panmari / TestBorder.java
Created August 23, 2012 09:43
isNearBorder() doesn't work as expected when using windowZoom
package online.app2;
import ch.aplu.android.*;
import android.graphics.Color;
public class TestBorder extends GameGrid
{
public TestBorder()
{
super(true, windowZoom(200));
@panmari
panmari / CardEx12.java
Created August 14, 2012 13:08
setView ignores Layout other than StackLayout?
package ch.aplu.cardex12;
import android.graphics.Color;
import ch.aplu.jcardgame.*;
import ch.aplu.android.*;
public class CardEx12 extends CardGame
{
public enum Suit {
KREUZ, HERZ, KARO, PIK
@panmari
panmari / CardEx12.java
Created August 14, 2012 13:05
Constructor for Hands with CardLayout as parameter is buggy
package ch.aplu.cardex12;
import android.graphics.Color;
import ch.aplu.jcardgame.*;
import ch.aplu.android.*;
public class CardEx12 extends CardGame
{
public enum Suit {
KREUZ, HERZ, KARO, PIK
@panmari
panmari / Cardex12.java
Created August 14, 2012 12:41
Touch is not automatically enabled, when a TouchListener is added
package ch.aplu.cardex12;
import android.graphics.Color;
import ch.aplu.jcardgame.*;
import ch.aplu.android.*;
public class CardEx12 extends CardGame
{
public enum Suit {
KREUZ, HERZ, KARO, PIK
@panmari
panmari / gist:3083103
Created July 10, 2012 13:00
disable touch with only one thread
public void flipCardsBack() {
setTouchEnabled(false); // Disable mouse events
delay(1000);
card1.show(1); // Flip cards back
card2.show(1);
refresh();
setTouchEnabled(true);
}
@panmari
panmari / gist:3060436
Created July 6, 2012 14:21
setPixelLocation buggy?
public void act() {
xVelocity += FACTOR*gg.getXSlope();
yVelocity += FACTOR*gg.getYSlope();
xPos += xVelocity;
yPos += yVelocity;
setPixelLocation(new Point(Math.round(xPos), Math.round(yPos)));
L.d(isInGrid() + " " + getLocation());
if (!isInGrid())
gg.gameOver();
}
@panmari
panmari / mastermind
Created July 2, 2012 11:39
mastermind for android
// MasterMind.java
package app.mastermind1;
import ch.aplu.android.*;
import android.graphics.*;
import java.util.ArrayList;
// -----------class ActiveRowMarker -----------
@panmari
panmari / Laufzeitanalse
Created May 29, 2012 21:56
Some examples for determining the average performance of algorithms
1.
from i:= 1 until i > n loop
from j:= 1 until j > i loop
j:= j+1
end
i := i*2
end
2.
from i:= 1 until i > n loop