Game Instructions

Tap a tile to toggle its color. When a tile changes nearby tiles may change as well. Each move affect multiple tiles. The target is to turn all tiles into yellow in the fewest steps possible.

Press 'j' to show/hide the game. Press 'i' to show/hide the instructions. Press 't' to show/hide the top score table.

Steps: 0

Top Scores

Name Steps
Press J to toggle the game, I to toggle instructions, and T to toggle the top scores

Congratulations!

You solved the puzzle in 0 steps!

Success!

Score submitted successfully!

Error

Failed to submit score. Please try again.

Using The Android Sensors PRO

The android device has sensors we can use in our code. We can get data coming from these resources using the SensorManager object. The following code sample shows how to do it.

package com.abelski.samples;

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.support.v4.app.NavUtils;

public class MainActivity extends Activity {

	private SensorManager manager;
	private Sensor sensor;
	private SensorEventListener listener = null;

	@Override
	public void onResume() {
		super.onResume();
		manager.registerListener(listener, sensor,
				SensorManager.SENSOR_DELAY_NORMAL);
	}

	@Override
	public void onPause() {
		super.onPause();
		manager.unregisterListener(listener, sensor);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		manager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
		sensor = manager.getDefaultSensor(Sensor.TYPE_LIGHT);
		final EditText tf = (EditText) findViewById(R.id.tf);
		listener = new SensorEventListener() {
			public void onAccuracyChanged(Sensor sensor, int accuracy) {
				// ...
			}

			public void onSensorChanged(SensorEvent event) {
				if (event.sensor.getType() == Sensor.TYPE_LIGHT) {
					Log.i("light","Light is "+event.values[0]);
					tf.setText("Light is " + event.values[0]);
				}
			}
		};

	}
}

The following video clip shows the execution of this code sample and explains it.

Share:

The Beauty of Code

Coding is Art! Developing Code That Works is Simple. Develop Code with Style is a Challenge!

Update cookies preferences