This is a game i need to present for my programming class. It is the almighty 2048 game.. http://gabrielecirulli.github.io/2048/ and we have to do a simpler version in pascal language. This is the code i've made till now..
program game2048; uses crt; const max = 4; type matriz = array [1..max,1..max] of integer; var tabla:matriz; key:char;
procedure random2 (var k:matriz); var n1,n2:integer; begin repeat randomize; n1:=random(3)+1; n2:=random(3)+1 until k[n1,n2]=0; k[n1,n2]:=2; end;
procedure cargaMatriz (var s:matriz); var i,j:integer; begin for i:=1 to max do begin for j:=1 to max do begin s[i,j]:=0; end; end; random2(s); random2(s); end;
function check0 (s:matriz):boolean; var i,j,c:integer; begin c:=0; for i:=1 to max do begin for j:= 1 to max do begin if s[i,j]=0 then c:=c+1; end; end; if c=0 then check0:=false else check0:=true; end;
procedure printM (var s:matriz); var i,j:integer; begin textbackground(lightgray); textcolor(black); clrScr; for i:= 1 to max do begin for j:= 1 to max do begin if (check0(s)) then write(s[i,j],' ') else write('c*est fini'); end; writeln; end; end;
procedure movr(var s:matriz); var i,j,k,aux:integer; begin for i:= 1 to max do for j:= max downto 1 do for K:= j downto 1 do begin if ((s[i,j]=0) and (s[i,k]<>0)) then begin aux:=s[i,j]; s[i,j]:=s[i,k]; s[i,k]:=aux; end; end; end;
procedure merger(var s:matriz); var i,j: integer; begin for i:=1 to max do for j:= 2 to max do if (s[i,j]=s[i,j-1]) then begin s[i,j-1]:=s[i,j-1]+s[i,j]; s[i,j]:=0; end; end;
procedure movl(var s:matriz); var i,j,k,aux:integer; begin clrScr; for i:= 1 to max do for j:= 1 to max do for K:= j to max do begin if ((s[i,j]=0) and (s[i,k]<>0)) then begin aux:=s[i,j]; s[i,j]:=s[i,k]; s[i,k]:=aux; end; end; end;
procedure mergel(var s:matriz); var i,j: integer; begin for i:=1 to max do for j:= 1 to max-1 do if (s[i,j]=s[i,j+1]) then begin s[i,j]:=s[i,j]+s[i,j+1]; s[i,j+1]:=0; end; end;
procedure movu(var s:matriz); var i,j,k,aux:integer; begin clrScr; for i:= 1 to max do for j:= 1 to max do for K:= i to max do begin if ((s[i,j]=0) and (s[k,j]<>0)) then begin aux:=s[i,j]; s[i,j]:=s[k,j]; s[k,j]:=aux; end; end; end;
procedure mergeu(var s:matriz); var i,j:integer; begin for j:= 1 to max do for i:=1 to max-1 do if (s[i,j]=s[i+1,j]) then begin s[i,j]:=s[i+1,j]+s[i,j]; s[i+1,j]:=0; end; end;
procedure movd(var s:matriz); var i,j,k,aux:integer; begin clrScr; for i:= max downto 1 do for j:= 1 to max do for K:= i downto 1 do begin if ((s[i,j]=0) and (s[k,j]<>0)) then begin aux:=s[i,j]; s[i,j]:=s[k,j]; s[k,j]:=aux; end; end; end;
procedure merged(var s:matriz); var i,j:integer; begin for j:= 1 to max do for i:= max downto 2 do if (s[i,j]=s[i-1,j]) then begin s[i,j]:=s[i-1,j]+s[i,j]; s[i-1,j]:=0; end; end;
begin cargamatriz(tabla); printM(tabla); writeln('Bienvenido, presione Arriba/aBajo/Izquierda/Derecha o Esc'); repeat key:=readkey; begin case key of 'I','i' : begin mergel(tabla); movl(tabla); random2(tabla); printm(tabla); end; 'A','a' : begin mergeu(tabla); movu(tabla); random2(tabla); printm(tabla); end; 'D','d' : begin merger(tabla); movr(tabla); random2(tabla); printm(tabla); end; 'B','b' : begin merged(tabla); movd(tabla); random2(tabla); printm(tabla); end; end; end; until key=#27; readkey; end.
one of the thing i don't understand is why the 'random2' procedure doesn't seem to work in the general program, even though it works well when i call it from the procedure 'cargarMatriz'.. and also when i execute it the program it work fine for a while, but after a certain point just it stops displaying.. before ending the game..
Well, i'm a fresher so any hints on a more appropriate aproach will be helpfull..
I'm new here, and I've got big plans. These plans include building a massive organization, building my own spacecraft, and creating a few games, writing a few novels, and traveling a lot.
So, why am I here? Simple, I'm on a coding journey. I'm learning the simple stuff first, like web development, HTML, CSS3, PHP, Java, etc. Then I'm moving onto bigger programs.
However, considering that I want to build my own spacecraft, I'd like to code my own language to build my own OS and what not with. Having my own software and knowing the ins and outs of it just sounds like the right thing.
So, my question is, where do I start? What would you guys recommend? Am I heading in the right direction by starting with something simple like web development?
Also, I would like to know if you guys can point me into some decent resources that would help me get started with my own language. I've seen people create languages based of another language, I don't want to do that. I'm talking about from scratch kind of deal. Like, legit from scratch. So, any resources that you guys can give me would be much appreciated. I figured that group of people who code on a regular basis would at least be able to point me in the right direction.
And yeah, I know...I don't know how to dream small. I go for big...really big.
Hi, I worked as Web developer (ASP.NET,VB.NET) for 6 months and later my position was changed as Windows developer(WPF,C#,MVVM) to till now. Next, my company is forcing me to move on android application development(Purely java and android studio). I started my career just a year back. Is it good for me to switching technologies in short span of time?
I have created a windows gadget that plays a radio stream I am involved in. I have got the gadget image and stream working however would like the main image on the desktop to change at specific times of the day when a new show starts. example: Monday - friday 6am to 10am it shows image 1, and 10am to 2pm it shows image 2 etc... so basically it will change the image for each show 7 days a week. I just cannot figure out how this can be achieved, so any advice would be welcomed or if you can add script for me it would be appreciated.
Script writing is not my forte.
as there are several files and code you can download the gadget file on this link. (right click and save it to desktop first, dont click on gadget link directly as will be gobblygook)
i tried various options with javasctipt but nothing wok, so hope you can figure it out. As you can see from the test2 the time script does show the image but it does not change when the next hour comes.
The Software life-cycle is an ever changing process. Some parts are a must (Absolute), and some are not. And during the evolution process some parts are added and some are dropped.
How can we decide that a once Absolute task is no longer needed and must be Dissolved?
Every task is there for a reason (since somebody put it there).
Can we drop a task just because we don't see it's importance?
And when does an absolute task become a wall in the way of evolution?
I know a bit of code but it got boring to me about 8 months ago so I stopped. SO what's a code I can start learning that'll keep me interestee. Also what's the best windows program for a coding prompt? ? Also I ordered these books
-the pragmatic programmer from beginner to journeyman
-programming for dummies
-invent Your Own Computer Games with Python, 3rd Edition
Do you think starting python will keep me motivated and inspired??
Motivation needs to come from within. If you do not have much interest in programming then no language is likely to change that. Try and decide first what you want to do, and then choose the language or framework that you think will help you achieve that goal. But if you really find it boring then best find some other career path.
Hello im a newbie program i just started learning programming recently and im still a not good at it. But i want do a program where i have point(for ex. a circle) and it moving on his own from starting point to the end line, he also needs to avoid simple obstacles, and learn his actions and do not do same mistakes again(something like "i was at this pixel before, when i moved to the pixel at the right and there was obstacle so do not do this move on this pixel again). It can be in 2D on bit map(i think ).
I woud like any links to tutorials that will help me or which libraries i should use and where a i should look for help etc
FYI-I am not the coder. I receive a revised PDF document that I overwrite on a existing location on a server that points to a desktop icon for users (they select the icon, a menu opens then from there they choose the document they need). Lately I am experiencing an inconsistent issue when saving an updated <" value" /> when overwriting a document. I change my value increment and select save but does not save. My question: Is it the way I save the document? Currently I open the document from the email attachment and save to my B drive I open our server to access the B drive and the location of the documents, then I drag the document from the B drive to the server location, select the code, change increment and save - usually without issue. Does using open, save or save as have an impact? Should I select and drag to overwrite instead of opening and save/save as? Is there an impact if opening from email attachment or through a an attachment in our service management software? Basically if the new document was been created using a different adobe version than the document on the server it code would not save, correct? I am not loading these documents any different. My IT coder insists I am doing something wrong but it is so inconsistent. Our documents need to be Acrobat 5 so if someone creates using acrobat pro or reader 9 then they need to fix form or I will not be able to save the code...correct???
While uploading a picture to my Profile here on CodeProject i found they are limiting it to 20Kb.I compressed my pciture from 5 Mbto 156Kb but couldn't do more........How should i post my pciture with this size?It's not allowing me
I have a working ATmel Studio project and trying to add it as a static library to AS Solution. Apparently this project defines a "variable" FATFS using XML and I am getting a linker error about it being undefined. I can handle that, but I have no idea how to <b><b></b>link my main project to the static library reference to the XML. </b> I did add a search directory to the XML something , I am not sure what it is , some kind of doc, and it did not help. I was trying to find gcc options about XML and all I got to go by was "gccxml and gcc_xml". ATmel Studio compiler is "plain gcc". Please no references to "try other sites / support groups". ATmel tech support is down for maintenance (?) and I do not want to bother "the other group" with "basic x questions". And no I do not want to learn XML at this point also. I did check the AS .cproj and it is XML.
So any simple explanations / hints on how gcc links to / uses XML will be appreciated. Cheers Vaclav
Addendum OK the FATFS is defined by FatFs library and I need to find how this library is added to the original code by gcc using XML.
i am a student of I.T my final year project is tracking system how can i track an employee using his phone which has gps in it and which language should i choose to develop this app and how do i connect that employee phone to the server and get his location i want to use asp.net and c#.