# Does anyone know what is wrong with this program?

**URL:** <https://discourse.processing.org/t/does-anyone-know-what-is-wrong-with-this-program/40012>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [December 3, 2022, 7:57pm UTC](https://discourse.processing.org/t/does-anyone-know-what-is-wrong-with-this-program/40012 "2022-12-03T19:57:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![add](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@add](https://discourse.processing.org/u/add)\
**Post date:** [December 3, 2022, 7:57pm UTC](https://discourse.processing.org/t/does-anyone-know-what-is-wrong-with-this-program/40012/1 "2022-12-03T19:57:42Z")

</div>

```auto
int h,m;
void setup(){
 size (800,600);
 frameRate(10);
}
void draw (){
// if (framec==0){
    background (180);
    stroke (0);
    fill(255);
  rect (0,500,width,height);//chenar jos
  h=nf(hits);
  m=nf(misses);
  fill(0);
  h="HITS:"+h+"/MISSES:"+m;
  textAlign(CENTER); textSize(50);
  text (h,width/2,570);
 
  float x=20+random (width-20);
  float y=20+random (height-120);
 fill (random(255),random(255),random(255),50);
 noStroke(); /*int c1=int(random(255)); int c2=int(random (255)); int c3= int (random (255));*/// fill(c1,c2,c3); noStroke();
  ellipse (x,y,40,40);
 q=char( int (97+random(26)));
 textSize(40);
 textAlign(CENTER); fill(0);
 text (q,x,y+10);
  }
  else d= key;
if (fc==fl)
if (d==q) hits++; else misses++;
fc++;
if(fc>fl) fc=0

}
void keyPressed()
{
  d=key; fc=fl;
}
if(misses>3)
{
  fill(255,0,0);
  rect(0,0,width,height-100);
  fill(0);
  textAlign (CENTER);
  text("GAME OVER!", width/2,height/2);
  noLoop();
}

```

here is what the result should be:

 ![Screenshot 2022-12-03 at 21.56.14](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/b/9/b93ca0f99b480fee52c02f607f8b7fdd13019a59.png)

---

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [December 3, 2022, 8:23pm UTC](https://discourse.processing.org/t/does-anyone-know-what-is-wrong-with-this-program/40012/2 "2022-12-03T20:23:28Z")

</div>

Hi @add,

What happens if you run your code in PDE ?  
Do you get any hints in the editor pane and/or console window ?  
Have you tried to follow these hints?

I would recommend that you go through your code (line by line) and try to add comments what each line is doing or what it should doing and what possible went wrong.

Don’t hesitate to come back if you have concrete questions…

Cheers  
— mnse

> [@Guidelines—Asking Questions](https://discourse.processing.org/t/guidelines-asking-questions/2147):
>
> Summary (TL;DR) Ask complete questions to get better answers! Be specific. For example: I want to load an image. I tried using createImg() , and I expected the image to be on canvas, but what happened instead was the image showing up below the canvas. Isolate your problem and work in small steps. Share only the code directly related to your problem if it is part of a bigger project, and if something isn’t working, try the smallest code that could do the thing you want. Can we run your code to …

---

<div class="post-metadata">

**Author:** ![debxyz](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@debxyz](https://discourse.processing.org/u/debxyz)\
**Post date:** [December 3, 2022, 8:45pm UTC](https://discourse.processing.org/t/does-anyone-know-what-is-wrong-with-this-program/40012/3 "2022-12-03T20:45:44Z")

</div>

Hello again @add 🙂

Can you sum up in a sentence what your program is supposed to do?  
How are we to evaluate it when we do not know what the end result is supposed to be?

Concrete help requires concrete question(s).  
Your question is much too general.  
🤓
