Skip to content

Instantly share code, notes, and snippets.

View danleyb2's full-sized avatar
:octocat:
...

Nyaundi Brian danleyb2

:octocat:
...
View GitHub Profile
import java.awt.*;
import javax.swing.ImageIcon;
public class Enemy {
Image img;
int x, y;
boolean isAlive = true;
#!/usr/bin/env python
import pyglet
mp3 = "test.mp3"
source = pyglet.media.load(mp3)
player = pyglet.media.Player()
player.queue(source)
player.play()
@danleyb2
danleyb2 / askBoolean.java
Last active August 29, 2015 14:20
ask a question that only accept a YES or NO answer
public static String askQuestion(String question){
Scanner ans=new Scanner(System.in);
String response;
do{
System.out.println(question);
response=ans.next();
}while(!response.equalsIgnoreCase("yes")||!response.equalsIgnoreCase("no"));
return response;
import java.awt.Component;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import javax.swing.*;
public class Board extends JPanel implements ActionListener, Runnable {
Dude p;
@danleyb2
danleyb2 / solveQE.java
Last active August 29, 2015 14:16
a simple command line program to solve quadratic equations
package main;
import java.util.Scanner;
public class solverQE {
static double A, B, C;
public static void main(String[] args) {
//this is a simple script that takes in two value, the product and sum of two numbers in a
//quadratic equation and tries to solve for the values to be used in solving the equation
function PpSp(p,s){
big:for (var i=1;i<p;i++){
for(var j=1;j<p;j++){
if ((i*j)==p){
if ((i+j)==s){
// System.out.println("I got it. The numbers are "+i+" and "+j);