• Telefon : +40 728 88 22 88
  • Program de lucru : Vezi orarul!
  • Adresă : Bacău, str. Mihai Eminescu, nr. 1, bloc. A1

Un program de grafică cu o matrice în spate

#include <iostream>
#include <winbgim.h>
#include <stdlib.h>

using namespace std;

#define MAX 20
#define FUNDAL CYAN

int stanga,sus,width,height,latura, numar;
bool gata;

int TablaDeJoc[MAX][MAX];

int scor;

void afiseazaScor()
{
   char sirScor[10];
   setcolor(FUNDAL);
   itoa(scor,sirScor,10); outtextxy(200,50,sirScor);
   int i,j;  scor=0;
   for (i=1;i<=numar;i++)
       for (j=1;j<=numar;j++)
           if (TablaDeJoc[i][j]==2)
              scor++;
   setcolor(BLUE); itoa(scor,sirScor,10);
   outtextxy(200,50,sirScor);
}

void punerePiesa()
{
   int linia,coloana,x,y;
   int x1, y1, x2, y2;
   int xmijloc, ymijloc;

   if(ismouseclick(WM_LBUTTONDOWN))
     {
       clearmouseclick(WM_LBUTTONDOWN);
       x=mousex(); y=mousey();
       if (!(x>=stanga && x<=stanga+width && y>=sus&&y<=sus+height))
          gata=true;
       else
          {
            linia=(y-sus)/latura+1;
            coloana=(x-stanga)/latura+1;
            if (TablaDeJoc[linia][coloana]==0)
               {
                 TablaDeJoc[linia][coloana]=1;
                 // stergere
                 setcolor(FUNDAL); setfillstyle(SOLID_FILL,FUNDAL);
                 x1=stanga+latura*(coloana-1); y1=sus+latura*(linia-1);
                 x2=x1+latura; y2=y1+latura;
                 xmijloc=(x1+x2)/2; ymijloc=(y1+y2)/2;
                 bar(xmijloc-20,ymijloc-20,xmijloc+20,ymijloc+20);
                 // afisez cerc rosu aprins
                 setcolor(LIGHTRED); setfillstyle(SOLID_FILL,LIGHTRED);
                 fillellipse(xmijloc,ymijloc,18,18);
               }
            else
            if (TablaDeJoc[linia][coloana]==1)
               {
                 TablaDeJoc[linia][coloana]=2;
                 setcolor(FUNDAL); setfillstyle(SOLID_FILL,FUNDAL);
                 x1=stanga+latura*(coloana-1); y1=sus+latura*(linia-1);
                 x2=x1+latura; y2=y1+latura;
                 xmijloc=(x1+x2)/2; ymijloc=(y1+y2)/2;
                 bar(xmijloc-20,ymijloc-20,xmijloc+20,ymijloc+20);
                 // afisez un patrat galben
                 setcolor(LIGHTRED); setfillstyle(SOLID_FILL,YELLOW);
                 bar(xmijloc-20,ymijloc-20,xmijloc+20,ymijloc+20);
               }
            else // 2-> 0
            {
                 TablaDeJoc[linia][coloana]=0;
                 setcolor(FUNDAL); setfillstyle(SOLID_FILL,FUNDAL);
                 x1=stanga+latura*(coloana-1); y1=sus+latura*(linia-1);
                 x2=x1+latura; y2=y1+latura;
                 xmijloc=(x1+x2)/2; ymijloc=(y1+y2)/2;
                 bar(xmijloc-20,ymijloc-20,xmijloc+20,ymijloc+20);
            }
            afiseazaScor();
        }
    }
}

void desen()
{
   int i,j; numar=5;
   width=400; height=400; latura=width/numar;
   sus=(getmaxy()-width)/2; stanga=(getmaxx()-height)/2;
   setbkcolor(FUNDAL); clearviewport(); setcolor(BLUE);
   for(i=1; i<=numar; i++)
       for(j=1; j<=numar; j++)
          rectangle(stanga+latura*(i-1),
                    sus+latura*(j-1),stanga+latura*i,sus+latura*j);
}

int main()
{
   initwindow(800,600);
   scor=0; desen(); afiseazaScor();
   gata=false;
   do
   {
      punerePiesa();
   }
   while (!gata);
   getch();
   closegraph();
   return 0;
}

 

36 Comments

  • Гостиничные чеки Екатеринбург

    - 07/02/2023 at 19:32

    hi!,I like your writing so much! proportion we be in contact
    more approximately your post on AOL? I require a specialist on this house to resolve my problem.

    Maybe that’s you! Looking forward to peer you.

  • накрутка подписчиков в yappy

    - 08/02/2023 at 19:47

    Awesome! Its truly remarkable post, I have got much clear idea about from this piece of writing.

  • накрутка подписчиков в яппи

    - 08/02/2023 at 19:59

    I simply could not depart your site before suggesting that I really loved the usual info an individual supply
    for your visitors? Is going to be again ceaselessly in order
    to investigate cross-check new posts

  • удаление пигментации Минск

    - 12/02/2023 at 18:21

    Hi there, just became aware of your blog through Google, and found that it is really informative.

    I am gonna watch out for brussels. I will appreciate if you continue this
    in future. Numerous people will be benefited from your writing.
    Cheers!

  • удаление пигментации

    - 12/02/2023 at 18:25

    Woah! I’m really enjoying the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s tough to get that „perfect balance” between superb usability and visual appearance.
    I must say you have done a amazing job with this.
    Also, the blog loads extremely fast for me on Internet explorer.
    Outstanding Blog!

  • увеличить губы филлером

    - 12/02/2023 at 18:28

    Hello there, I discovered your blog via Google while looking for a
    similar matter, your site came up, it appears great.
    I have bookmarked it in my google bookmarks.
    Hello there, just became alert to your blog via Google,
    and located that it is really informative. I am gonna watch out for brussels.

    I’ll be grateful in the event you continue this
    in future. Numerous folks might be benefited from your writing.
    Cheers!

  • Гостиничные чеки в Москве

    - 12/02/2023 at 19:01

    Your way of explaining everything in this article is truly pleasant, every one
    be able to without difficulty understand it, Thanks a lot.

  • увеличение губ

    - 12/02/2023 at 19:23

    continuously i used to read smaller articles
    that as well clear their motive, and that is also happening with this
    paragraph which I am reading at this time.

  • http://remstrdom.ru/

    - 17/02/2023 at 15:15

    I’m gone to inform my little brother, that he should also pay a quick visit this website on regular basis to obtain updated from most recent information.

  • http://nastroyke-info.ru/

    - 18/02/2023 at 22:57

    Hey there! I’ve been following your website
    for a long time now and finally got the bravery to go ahead
    and give you a shout out from Porter Tx! Just
    wanted to say keep up the good job!

  • Hay day скачать на компьютер

    - 19/02/2023 at 22:54

    Very great post. I simply stumbled upon your weblog and
    wanted to mention that I’ve really loved surfing around your weblog posts.
    In any case I’ll be subscribing for your rss feed and I’m hoping
    you write again soon!

  • накрутить просмотры яппи

    - 20/02/2023 at 18:43

    Wow, incredible weblog format! How long have you ever been running a blog for?
    you made blogging glance easy. The full look of your web site is excellent,
    as smartly as the content material!

  • Hay day скачать на компьютер

    - 20/02/2023 at 20:50

    This is the right webpage for everyone who wishes
    to find out about this topic. You realize so much its almost hard to argue with you (not that I actually would want to…HaHa).
    You definitely put a new spin on a subject which has been discussed for many
    years. Wonderful stuff, just wonderful!

  • bob tape for breast lift

    - 23/02/2023 at 00:18

    It’s really a nice and useful piece of information. I am satisfied that you just shared this useful info with
    us. Please stay us up to date like this. Thanks for sharing.

  • nipple tape

    - 23/02/2023 at 00:37

    I couldn’t resist commenting. Well written!

  • body tape for stomach

    - 23/02/2023 at 00:38

    I am genuinely delighted to glance at this blog posts which consists of lots
    of useful facts, thanks for providing such information.

  • http://masterok-tut.ru/

    - 24/02/2023 at 14:23

    This is very interesting, You’re an excessively skilled
    blogger. I’ve joined your feed and stay up for seeking more of your great post.
    Also, I’ve shared your web site in my social networks

  • sadovnikinfo.ru

    - 25/02/2023 at 23:07

    Thank you for the good writeup. It in fact used to be a
    amusement account it. Look advanced to far introduced agreeable from you!
    However, how could we keep in touch?

  • Гостиничные чеки в Москве

    - 25/02/2023 at 23:15

    Pretty! This has been an incredibly wonderful post.
    Thanks for supplying this info.

  • https://nakrutka-prosmotrov-yappy-pr2.online/

    - 26/02/2023 at 21:52

    Wonderful website you have here but I was wondering if you knew of any discussion boards
    that cover the same topics talked about here? I’d really like to be a part of community where
    I can get feed-back from other experienced individuals that share the same interest.
    If you have any recommendations, please let me know.
    Kudos!

  • https://nakrutka-prosmotrov-yappy-pr2.ru/

    - 26/02/2023 at 22:09

    I enjoy what you guys are up too. This type
    of clever work and exposure! Keep up the great works guys I’ve incorporated you guys to my
    personal blogroll.

  • кариес зубов лечение

    - 27/02/2023 at 21:02

    Cool blog! Is your theme custom made or did you download it from somewhere?
    A theme like yours with a few simple adjustements would really make
    my blog jump out. Please let me know where you got your design. Thanks
    a lot

  • Установка кондиционера Минск

    - 27/02/2023 at 23:12

    I just like the helpful information you supply for your articles.

    I’ll bookmark your weblog and take a look at once more here frequently.
    I’m somewhat certain I’ll be told a lot of new stuff right here!
    Best of luck for the following!

  • кариес зубов лечение

    - 27/02/2023 at 23:30

    Nice post. I was checking continuously this weblog and I’m inspired!
    Extremely useful information specifically the last section 🙂 I take care of such
    info much. I was seeking this particular info for a long time.
    Thanks and good luck.

  • установка кондиционера в Минске

    - 28/02/2023 at 00:40

    At this moment I am going to do my breakfast, after having my
    breakfast coming yet again to read more news.

  • http://cb23.ru/

    - 28/02/2023 at 13:17

    This page really has all the information I needed
    about this subject and didn’t know who to ask.

  • Гостиничные чеки купить в Москве

    - 28/02/2023 at 18:20

    Your way of describing the whole thing in this article is really fastidious, all be
    capable of effortlessly understand it, Thanks a lot.

  • http://yes-cars.ru/

    - 01/03/2023 at 11:29

    Hi! I’m at work surfing around your blog from my
    new iphone 3gs! Just wanted to say I love reading through your
    blog and look forward to all your posts! Keep
    up the excellent work!

  • http://avto-zhelezo.ru/

    - 02/03/2023 at 15:56

    Hi there, I enjoy reading through your post.
    I like to write a little comment to support you.

  • gate.io

    - 06/03/2023 at 15:24

    I have read your article carefully and I agree with you very much. So, do you allow me to do this? I want to share your article link to my website: gate.io

  • карта мира деревянная на стену с подсветкой

    - 14/03/2023 at 14:59

    Great weblog right here! Additionally your site lots
    up very fast! What web host are you the use of? Can I am
    getting your associate hyperlink to your host? I desire my website loaded up as fast
    as yours lol

  • карта из дерева на стену с подсветкой

    - 14/03/2023 at 16:14

    I must thank you for the efforts you have put in writing this website.
    I really hope to check out the same high-grade content by you later on as well.
    In fact, your creative writing abilities has inspired me to get my own,
    personal blog now 😉

  • карта мира деревянная на стену с подсветкой

    - 20/03/2023 at 05:31

    I’d like to find out more? I’d want to find out more details.

  • карта мира на стену из дерева

    - 21/03/2023 at 23:18

    Currently it looks like BlogEngine is the top blogging platform
    out there right now. (from what I’ve read) Is that what
    you are using on your blog?

  • http://hitmind.ru/

    - 22/03/2023 at 20:25

    Thank you for some other fantastic article.
    Where else may just anybody get that type of information in such an ideal manner of writing?
    I’ve a presentation subsequent week, and I’m on the search for such info.

  • снять место для хранения вещей

    - 24/03/2023 at 18:07

    Greetings from Los angeles! I’m bored to tears at work so I decided
    to check out your site on my iphone during lunch break.
    I love the information you provide here and can’t wait to take a look when I get home.
    I’m surprised at how fast your blog loaded on my cell phone ..
    I’m not even using WIFI, just 3G .. Anyhow, great blog!

Leave a Reply