Thursday, 20 April 2017

House game in java (Gui version )

PLAY HOUSIE:

package housiegame;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class Playhousie1 extends Frame implements ActionListener{
public static int n;
private static final long serialVersionUID = 1L;
public static Button [] board=new Button[100];
public Ticket1 t[];
public int jflag[],r1flag[],r2flag[],r3flag[],hflag[],count[];
public static boolean fjflag,frflag[],fhflag;
public Playhousie1(int n){
jflag=new int[n+1];
r1flag=new int[n+1];
r2flag=new int[n+1];
r3flag=new int[n+1];
hflag=new int[n+1];
count=new int[n+1];
t=new Ticket1[n+1];
for(int i=1;i<=n;i++)
t[i]=new Ticket1();
Button start=new Button("start");
this.setSize(500,500);
this.add(start);

start.addActionListener(this);
start.setVisible(true);
for(int i=1;i<=99;i++)
this.add(board[i]);

this.setLayout(new FlowLayout());
this.setVisible(true);
}
public static void main(String[] args){
frflag=new boolean[4];

for(int i=1;i<=99;i++){
board[i]=new Button(String.valueOf(i));
board[i].setBackground(Color.red);
board[i].setVisible(true);

}

Scanner cin=new Scanner(System.in);
System.out.println("enter no of players");
n=cin.nextInt();
new Playhousie1(n);
                 
}

public void actionPerformed(ActionEvent e){

Button b=(Button)e.getSource();
if(b.getLabel().equals("start")){

System.out.println("start");

return;
}
else{
int r=Integer.parseInt(b.getLabel());
int row=0;

if((board[r].getBackground()).equals(Color.green)){return;}

else{                                //checking number in every ticket
board[r].setBackground(Color.green);  //board[r]=1;
for(int i=1;i<=n;i++){
int k=r/10;
                 //searching number
    if(k==0){
for(int j=1;j<=3;j++){
if(Integer.parseInt(t[i].ticket[j][0].getLabel())==r){
row=j;
t[i].ticket[j][0].setLabel(String.valueOf(0)); //p[i].t.t[j][0])=0;
count[i]=count[i]+1;
break;
}
}
}
else {
for(int j=1;j<=3;j++){
if(Integer.parseInt(t[i].ticket[j][k].getLabel())==r){//(p[i].t.t[j][k])==r){
row=j;
t[i].ticket[j][k].setLabel(String.valueOf("0"));//(p[i].t.t[j][k])=0;
count[i]=count[i]+1;
break;

}
}
}                   
             //checking for any jaldee
if(count[i]<5){
                             continue;
}
                      
if(!fjflag && count[i]==5){
//number.setText("player"+ i +"wins jaldee");//System.out.println("player" + i + "wins jaldee \n");
jflag[i]=1;

}
                  //checking for row
if(count[i]>=5){
switch(row) {
                        case 1: if(!frflag[row]){          //first row
           if(check(i,row)){
   r1flag[i]=1;
   //l1.setText("player"+ i +"wins row" + row); //System.out.println("player" + i + "wins row"+ row);
       } 
} break;
case 2: if(!frflag[row]){        //second row
        if(check(i,row)){           
      r2flag[i]=1;
      //l2.setText("player"+ i +"wins row" + row);   //System.out.println("player" + i + "wins row"+ row);

        }
        }
       break;
case 3: if(!frflag[row]){        //third row
        if(check(i,row)){
r3flag[i]=1;
//l3.setText("player"+ i +"wins row" + row);//System.out.println("player" + i + "wins row "+row);
}
        }
break;
            }
if(count[i]==15){
hflag[i]=1;
     this.setTitle("PLAYER"+i+"WINS HOUSIE");//System.out.println("player "+ i + "wins housie");

}
                      
}
                           
                                            
}
                 //checking any thing happened after the random number "r"
if(!fjflag){
                    for(int i=1;i<=n;i++){    //jaldee
if(jflag[i]==1){
fjflag=true;
break;
}
}
}
                  
                    if(!frflag[1]){ //row1
    for(int i=1;i<=n;i++){
 if(r1flag[i]==1){
frflag[1]=true;
   break;
     }
    }
    }

if(!frflag[2]){
 for(int i=1;i<=n;i++){  //row2
if(r2flag[i]==1){
frflag[2]=true;
   break;
}
 }
}
if(!frflag[3]){
  for(int i=1;i<=n;i++){  //row3
if(r3flag[i]==1){
frflag[3]=true;
   break;
}
  }
}
int gameflag=0;
for(int i=1;i<=n;i++){
if(hflag[i]==1){
this.setBackground(Color.green);//System.out.println("game completed");
gameflag=1;//System.exit(0);
}
}
                 if(gameflag==1){}
                  //break;
}
}
}

public boolean check(int i,int row){
for(int column=0;column<=9;column++){
if(Integer.parseInt(t[i].ticket[row][column].getLabel())!=0)           //(p[i].t.t[row][column])!=0)
  return false;

return true;

}
}

TICKET:

package housiegame;
import java.awt.*;
import java.util.*;

public class Ticket1 extends Frame {
/**
 *
 */

private static final long serialVersionUID = 1L;
public Button [][] ticket=new Button[4][10];
public Ticket1(){
for(int  i=1;i<=3;i++){
for(int j=0;j<=9;j++){
ticket[i][j]=new Button("0");
this.add(ticket[i][j]);
ticket[i][j].setVisible(true);

}
this.setVisible(true);
this.setLayout(new GridLayout(3,9));
}
this.generateTicket();
}
public void generateTicket(){

Random random = new Random();
int r,j;

for(int i=1;i<=3;i++){
int countcolumn[]=new int[10];
for(int rowcount=0;rowcount<5; ){

j=random.nextInt(10);  //random(max-min+1)+min
if(countcolumn[j]==0){
if(j==0)
r=random.nextInt(9-1+1)+1;
else
r=random.nextInt(9+1)+(j)*10;

switch(i){

case 1:
ticket[i][j].setLabel(String.valueOf(r));  //ticket[i][j]=r;
countcolumn[j]=1;
rowcount++;
               break;
case 2: if (Integer.parseInt(ticket[i-1][j].getLabel())!=r) {    //t[i-1][j]!=r)
ticket[i][j].setLabel(String.valueOf(r)); //t[i][j]=r;
countcolumn[j]=1;
rowcount++;
}
         break;

case 3:
if((Integer.parseInt(ticket[i-1][j].getLabel())!=r)&& (Integer.parseInt(ticket[i-2][j].getLabel())!=r)){
ticket[i][j].setLabel(String.valueOf(r)); //t[i][j]=r;
countcolumn[j]=1;
rowcount++;

}
break;

}
}
}
}
}

public static void main(String[] args){
     Frame f=new Frame();
   Scanner cin=new Scanner(System.in);
   System.out.println("enter no of tickets");
   int n=cin.nextInt();
  Ticket1 t[]=new Ticket1[n];
  for(int i=0;i<n;i++){
   t[i]=new Ticket1();
   f.add(t[i]);
   }
  f.setLayout(new FlowLayout());
 f.setVisible(true);
 

}



Wednesday, 19 April 2017

KHAT AAYA HAI | Award Winning Short Film | Aghaaz Productions | 2017

Manual Scavenging in India











My opinion on Manual Scavenging in India  :   This is not a project file or any programming code , the below code embeds my opinion on manual scavenging in India.....      plzzz comment your opinion on manual scavenging in India after understanding the below code and watching the videos .....


class Parent_ManualScavenger throws  DonotCleanMyHouse,Street,Toilet,RoadException{

public Home h[];
public Road r[];
public Street s[];
public static String cast;            //entire class qualifies with its cast

public String name;

String myWork(Home h,Road r,Street s,Toilet t){        //this is our work

h.clean();  //clean every home
r.clean();  // cleans every road
s.clean();  // cleans every street
t.clean();  // cleans every toilet
return "every thing is cleaned and manual scavenging is my work";
}



String fightAgainstGoverment(Public p){

 String status=p.letsFight();         //Fight Against Government

return status;
}

}



class Child_ManualScravenger extends Parent_ManualScavenger throws     DonotCleanMyHouse,Street,Toilet,RoadException{

public static String cast;                      // we are too qualified with our cast

public String name;

String doyourwork(){

Home h=new Home;
Road r=new Road;
Toilet t=new Toilet;
Street s=new Street;

String workStatus=super.myWork(h,r,s,t);      /* even i  want to do mywork because that i am                                                                         child of a manual scavenger i do my parents job only */
                                                                                  

return workstatus;
}

String fightAgainstGoverment(Public p){

 String status=p.letsFight();         //Fight Against Government

return status;
}

}


public class Public{


Public static void main(String argv[]){

/* This block is entirely for your hands

if u want to fight  against manual scavenging wake up the government by protesting against government and public [fightAgainstGoverment()]


                    (or)


else if u dont want to do make the manualscavengers to wake up and fight [fightAgainstGoverment]



                     (or)

else  wake them up to clean your streets by making instances of them and waking doyourwork() up as usual;

*/


}




Kakkos is a documentary film on manual scavengers directed by a young lady Divya from Tamilnadu
The below is a song from the documentary



Some other Tedx documentary on manual scavenging in India.






Monday, 7 November 2016

AaronDay 2017

                                                                        
                                                                  swecha
All Glugies are cordially invited to AARON DAY's events. The event will be held at three departments.

ABOUT THE DAY: In the remembrance of Internets Own Boy Aaron Swartz.


11219654_997648606965591_8958545531401329037_n

Aaron Swartz is the founder of Demand Progress, which launched the campaign against the Internet censorship bills (SOPA/PIPA) and now has over a million members. He is also a Contributing Editor to The Baffler and on the Council of Advisors to The Rules. He is a frequent television commentator and the author of numerous articles on a variety of topics, especially the corrupting influence of big money on institutions including nonprofits, the media, politics, and public opinion. From 2010-11, he researched these topics as a Fellow at the Harvard Ethics Center Lab on Institutional Corruption. He also served on the board of Change Congress, a good government nonprofit. He has also developed the site theinfo.org. His landmark analysis of Wikipedia, Who Writes Wikipedia?, has been widely cited. Working with Web inventor Tim Berners-Lee at MIT, he helped develop and popularize standards for sharing data on the Web. He also coauthored the RSS 1.0 specification, now widely used for publishing news stories.
Server information sidebar: This site is being served from an Ubuntu box with 2GB of RAM. The server is currently provided by several people. Thanks to: xchop. Binary Option Robots Reviewed
His piece with photographer Taryn Simon, Image Atlas (2012), is has been featured in the New Museum. In 2007, he led the development of the nonprofit Open Library, an ambitious project to collect information about every book ever published. He also cofounded the online news site Reddit, where he released as free software the web framework he developed, web.py.

EVENT TIMINGS: 4th November - Quiz @ ECE Dept. 5th November - ArtWork @ IT Dept. 7th November - Movie Screening @ CSE Seminar Hall. Timings: 4:00pm to 5:00pm each day.
EVENT CO-ORDINATORS: Team cse ,Ece ,IT second year mvgr college Batch 2015

AaronDay2016

Sunday, 17 January 2016

Whats app emoticon problem

What's app s new bug is evolved and this was found by a security agent .that is if u send a message or emotion message of around 50000 words to your friend or to any group ,that will crash your friends WhatsApp if he try to open the message.
This problem can be achieved by clearing the chat of friends who send that message but if you send that message to a group that don't have clear chat option so,this can also be solved by clearing all chat history of groups and friends .it is so painful to us .so we have to wait for a new update of whats app. alternatively we can use a new open source messenger app telegram that has no problem of any heavy messages .

You can watch my you tube video to know practically about this .

Here is the link :

https://youtu.be/wdDdAdVS4FQ

Wednesday, 13 January 2016

New and worthy technologies

Water computer :

Computer that runs with water ..by manu prakash and his students at Stanford university .

Manuprakash is an IIT Kanpur student before going to Stanford ..he is a professor in Stanford now .for the more details about his water computer visit the link below

http://news.stanford.edu/news/2015/june/computer-water-drops-060815.html



Tuesday, 3 November 2015

the housie game

                                   HOUSIE GAME


package housiegame;                                                                                      
import java.util.*;
public class Playhousie{
public Player p[];
public static int board[];
public int jflag[],r1flag[],r2flag[],r3flag[],hflag[],count[];
public static boolean fjflag,frflag[],fhflag;
public Playhousie(int n){
jflag=new int[n+1];
r1flag=new int[n+1];
r2flag=new int[n+1];
r3flag=new int[n+1];
hflag=new int[n+1];
count=new int[n+1];
p=new Player[n+1];
for(int i=1;i<=n;i++)
p[i]=new Player();
}
public static void main(String[] args){
frflag=new boolean[4];
board=new int[100];
int n;
Scanner cin=new Scanner(System.in);
System.out.println("enter no of players");
n=cin.nextInt();
Playhousie game=new Playhousie(n);
for(int i=1;i<=n;i++){
game.p[i].showTicket();
}
game.start(n);

}

public void start(int n){
Random random=new Random();
int r;
int row=0;
while(true){
r=(random.nextInt(99))+1;
if(Playhousie.board[r]==1)
continue;
System.out.println("number"+r);                               //checking number in every ticket
board[r]=1;
for(int i=1;i<=n;i++){
int k=r/10;
                //searching number
   if(k==0){
for(int j=1;j<=3;j++){
if((p[i].t.t[j][0])==r){
row=j;
(p[i].t.t[j][0])=0;
count[i]=count[i]+1;
break;
}
}
}
else {
for(int j=1;j<=3;j++){
if((p[i].t.t[j][k])==r){
row=j;
(p[i].t.t[j][k])=0;
count[i]=count[i]+1;
break;

}
}
}                  
            //checking for any jaldee
if(count[i]<5){
                             continue;
}
                     
if(!fjflag && count[i]==5){
System.out.println("player" + i + "wins jaldee \n");
jflag[i]=1;

}
                 //checking for row
if(count[i]>=5){
switch(row) {
                        case 1: if(!frflag[row]){          //first row
          if(check(i,row,p)){
  r1flag[i]=1;
   System.out.println("player" + i + "wins row"+ row);
      }
} break;
case 2: if(!frflag[row]){        //second row
       if(check(i,row,p)){          
     r2flag[i]=1;
     System.out.println("player" + i + "wins row"+ row);

       }
       }
      break;
case 3: if(!frflag[row]){        //third row
       if(check(i,row,p)){
r3flag[i]=1;
System.out.println("player" + i + "wins row "+row);
}
       }
break;
           }
if(count[i]==15){
hflag[i]=1;
System.out.println("player "+ i + "wins housie");

}
                     
}
                         
                                           
}
                //checking any thing happened after the random number "r"
if(!fjflag){
                    for(int i=1;i<=n;i++){    //jaldee
if(jflag[i]==1){
fjflag=true;
break;
}
}
}
                 
                    if(!frflag[1]){ //row1
   for(int i=1;i<=n;i++){
if(r1flag[i]==1){
frflag[1]=true;
  break;
    }
   }
   }

if(!frflag[2]){
for(int i=1;i<=n;i++){  //row2
if(r2flag[i]==1){
frflag[2]=true;
  break;
}
}
}
if(!frflag[3]){
 for(int i=1;i<=n;i++){  //row3
if(r3flag[i]==1){
frflag[3]=true;
  break;
}
 }
}

for(int i=1;i<=n;i++){
if(hflag[i]==1){
System.out.println("game completed");
System.exit(0);
}
}
                   
           }

}

public boolean check(int i,int row,Player p[]){
for(int column=0;column<=9;column++){
if((p[i].t.t[row][column])!=0)
 return false;

        }
return true;
}
}




palyer in the housie game:



package housiegame;
public class Player{
public Ticket t;


public Player(){
t=new Ticket();

}
public void getTicket(){
t.generateTicket();

}
public void showTicket(){
t.printTicket();
}
public static void main(String[] args){
Player p=new Player();
p.getTicket();
p.showTicket();


}

}


TICKET IN THE HOUSIE GAME:


package housiegame;
import java.util.*;
public class Ticket{
public int t[][]=new int[4][10];
public Ticket(){
this.generateTicket();
}
public void generateTicket(){

Random random = new Random();
int r,j;


for(int i=1;i<=3;i++){
int countcolumn[]=new int[10];
for(int rowcount=0;rowcount<5; ){

j=random.nextInt(10);  //random(max-min+1)+min
if(countcolumn[j]==0){
if(j==0)
r=random.nextInt(9-1+1)+1;
else
r=random.nextInt(9+1)+(j)*10;

switch(i){

case 1:
t[i][j]=r;
countcolumn[j]=1;
rowcount++;
               break;
case 2: if(t[i-1][j]!=r){
t[i][j]=r;
countcolumn[j]=1;
rowcount++;
}
        break;

case 3:
if((t[i-1][j]!=r)&& (t[i-2][j]!=r)){
t[i][j]=r;
countcolumn[j]=1;
rowcount++;

}
break;

  }


   }


}

}
}

          void printTicket(){
          for(int i=1;i<=3;i++){
        for(int j=0;j<=9;j++){
System.out.println(t[i][j]+"\t");
}
System.out.println("\n");
}
}

      public static void main(String[] args){
  Ticket t=new Ticket();
 
  t.printTicket();

}
  }