Marcel's Blog

Endless experimentation

  • I am using

    Firefox Download Button
  • Readers

    • 35,475 Visits
  • Archive

  • Ce-i cu blogu’ asta ?

    Details at "About" Page. Postez pe acest blog pur si simplu fiindca imi place si sunt dornic sa impartasesc cu toata lumea experimentele mele, filmarile, chestiile DIY si multe alte lucruri. Ma simt eu mai bine daca o fac :). Blogul este in engleza, fiind o limba de circulatie internationala. Cred ca majoritatea va descurcati sa o intelegeti ;). Details at "About" Page.
  • Calendar Blog

    May 2012
    M T W T F S S
    « Apr    
     123456
    78910111213
    14151617181920
    21222324252627
    28293031  
  • Meta

  • Visitors

    free counters Since 26th June 2010. Total visits are displayed up

Posts Tagged ‘c’

Allegro 5 Video Beginner Tutorials

Posted by sjackm on 29 August 2011

At last I have found some good tutorials to follow. After spending the whole night searching for some good Allegro 5 tutorial series and only finding ‘Allegro Tutorial Part 5′ tutorials for Allegro 4.2.3 X(, I am now quite wasted and unable to follow any instructions to learn something. My eyelids are of lead…

But, for future reference and for whoever will stumble upon my blog post, here’s the link:

http://fixbyproximity.wordpress.com/2011/07/13/2d-game-dev-your-first-allegro-5-program/

The tutorials are explained for Microsoft’s IDE, Visual Studio. The guy works with the professional version, but the express version works as well. Now, because I enjoy Code::Blocks I will also search for a Code::Blocks configuration tutorial sometime… and then follow those tutorials.

And I know everybody says 4.2.3 is easier than the new branch, but this is the future… I was never motivated to make a project or learn more with the 4.2.3 version, so I’d better just learn the modern version.

The bed calls me… oh the pillow… here I come. Bye!

Posted in Programare | Tagged: , , , , , , | 4 Comments »

C++ in Code::Blocks -2-

Posted by sjackm on 26 September 2010

Numere prime

Prime numbers

Here’s the code:

#include <iostream>
#include <math.h>
using namespace std;

int prim(int n){
int i;
bool test_prim=1;
for(i=2;i<=sqrt(n);i++){

if(n%i==0){
test_prim=0;
break;
}
}
if(test_prim){
return 1;
}
else{
return 0;
}}

int main(){
int n;
bool continua=1;
while(continua){

cout<<”Introduceti un numar de la tastatura: “<<endl;
cin>>n;
if(prim(n)==1){
cout<<”Numarul este prim!”<<endl;
}
else{
cout<<”Numarul nu este prim!”<<endl;
}
cout<<”Doriti sa continuati? (Da=1, Nu=0)”<<endl;
cin>>continua;
}
return 0;
}

Posted in Programare | Tagged: , , | 4 Comments »

C++ in Code::Blocks -1-

Posted by sjackm on 22 September 2010

These will probably be a series of  c++ programming tutorials. Just trying to help my colleagues, I’m not a programmer myself :P .

Unfortunately most of them will be in romanian I think(if not all…). If it’s really necessary I’ll try to include English captions as well.

Code::Blocks <-1-> De la Borland la CodeBlocks

Watch it HD on youtube.

Posted in Uncategorized | Tagged: , , , | 2 Comments »

Random Poetry Generation(RPG? ..meh…)

Posted by sjackm on 3 February 2010

Ok, I’ll have to write in romanian here because it’s in no way related to english poetry, so it would be just useless to write about it here.

Recent mi-a venit din nou cheful de c++ si mi-a venit o idee traznita: dupa inventatorul de cuvinte( fara noima), de ce sa nu incerc si un inventator de poezii( fara noima!!) ?

M-am pus pe treaba

Acum va servesc pe tava

Un inventator de poezii anormal

Cu 200 de cuvinte in vocabular .

:D

Meh… e doar asa de distractie. Nu are sens si nici n-o sa ma chinuiesc sa-l fac sa aiba. Probabil ca o sa mai adaug cuvinte (momentan sunt 4 array-uri: subiect,atribut,complement,predicat, fiecare array avand 50 de cuvinte). E mai greu de adaugat cuvinte in arrayul “complement”(e cuvantul de la sfarsitul versului) fiindca ar trebui sa fie un procentaj 50%/50% de cuvinte care se aseamna la sfarsit( pentru a produce rima). Sau cel putin sa nu existe cuvinte “unice” din punct de vedere al asemanarii(adica sa nu fie nici un alt cuvant cu care ar rima in array).  Nici vorba de masura sau alte “standarde” care trebuie respectate cand faci o poezie. Chiar si asa programul uneori da crash din cauza procentajului de care vorbeam.

Programul e simplu. Iti cere numarul de strofe dorite( pentru numarul real e defapt numar-1, adica daca doriti 1 strofa veti scrie 0, daca doriti 2 scrieti 1 etc… , si asta fiindca daca incerc sa o fac automat, da crash programul si nu am mai avut chef sa ma uit prin cod sa corectez).

Va afisa (ca sa stiti totusi ce se intampla) ca strofele se genereaza. Eu cel mai mare numar de strofe care l-am generat, fara sa dea crash programul, a fost 51(LE: Am depasi recordul, am atins 270 :D ). Uneori da crash chiar dupa prima strofa generata… totul depinde de arrayul “complement” daca da crash sau nu.

Strofele sunt scrise automat intr-un fisier denumit sugesti “Poezii.txt” in directorul curent( adica unde e pus programul). Daca programul  nu da crash, dati enter si ati iesit din el. Daca da… well… o sa apara mesajul cu “close”.

In program este afisata la un moment dat o sugestie: sa stergeti fisierul “Poezii.txt” inainte de a-l porni din nou. E optional… initial am crezut ca de acolo provine eroarea… oricum fisierul e rescris.

Have fun… dupa asta cred ca urmeaza “Prozatorul Drogat”  =)).

——===>DOWNLOAD LINK -> Version1.  <====——-

__________________________________________________________________________________

Posted in Computer, Software | Tagged: , , , , , , , , , , , , | Leave a Comment »

The program that makes words, c++

Posted by sjackm on 19 October 2009

Tocmai am invatat despre matrici, si diferenta dintre matrici unidimensionale si un string nu e chiar mare, asa ca mi-a venit o idee : sa fac un inventator de cuvinte ! L-am terminat in 2 zile :D .

In prima zi am facut partea de baza a programului care creeaza cuvantul , aleatoriu( dar te lasa sa alegi numarul de litere). Insa am ramas dezamagit cand am vazut ca sunt majoritatea cuvinte de genu “treklgffdbl”. Astazi m-am gandit la un algoritm ce verifica consoanele si vocalele, pentru un cuvant care suna cat mai natural.  Programul functioneaza cam asa : se genereaza o litera aleatorie(vocala sau consoana) care se atribuie casutei curente din matrice. Se trece la urmatoarea casuta, se genereaza o alta litera(vocala sau consoana). Se trece la urmatoarea casuta, daca si a treia litera de la ultima vocala este tot o consoana, se genereaza aleatoriu o vocala. Si functioneaza ! Bine, cuvintele n-au nici o noima dar … e doar spre amuzament :P . Poate vreti careva sa faceti o noua klingoniana :D .

Uite cateva cuvinte rezultate pentru 7 litere:

Here are some words that were generated for 7 characters :

ogamate,agimuto,okaqaaa,avaeilo,aneuxau,ukaruoe.

Mda … stiu, foarte ciudate =)). Link de download mai jos

ENGLISH

Ok so you may already read the words, they are very weird. It’s about a program that makes words, but words without a meaning. I tried to make them sound natural. When I first created the program the results were something like “gfdbgjkfd”. That’s really not looking like a word is it ?

My program is generating in an array a random character(vowel or consonant). It then moves to the next box of the array and generates another character(vowel or consonant). Then it moves to the next box, and if the third character after the last vowel is still a consonant, it won’t generate a consonant but instead a vowel, randomly of course.

I made this program just for fun, so …. here’s the download link !

|==<<<<||DOWNLOAD||>>>>==|
BETA3 now available !

This optimized version generates words instantly, and extremely fast if you choose to generate a lot of words at once ( yes, it’s now possible :D ). I also optimized a little the code, so it’s not so buggy anymore. Download link here :

[EDIT] For some strange reason, you may have to open, close and reopen 2 or 3 times the program in order for it to generate readable words. I really don’t know why it does this. It’s odd, I know, but it works after that. Oh, the program only runs on Windows OS.

|==<<<<||DOWNLOAD-Beta3||>>>>==|


Posted in Programare | Tagged: , , , , , , , , , | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.