Results 1 to 23 of 23

Thread: General: Your First Game?

  1. #1
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default General: Your First Game?

    It's a good idea that when you start a programming language for the first time, you should make a minor game (excluding 'Hello World', ).

    So, post your "first" games you've made in various languages and their relevant sources (Don't update anything, leave the source in-tact )

    The first game I made in Delphi was Tetris, which I cannot find the source files for.
    The first game I made in C++ was a guessing game:
    c++ Code:
    #include <iostream>
    #include <string>
    #include <stdlib.h>

    bool isNum(std::string str)
    {
        for (unsigned int i = 0; i < str.length(); i++)
        {
            if(!(std::isdigit(str[i])))
              return false;
        }

        return true;
    }

    int strtoint(const std::string str)
    {
        if(!(isNum(str)))
          return 0;

        return(atoi(str.c_str()));
    }

    int main()
    {
        int TheNumber = 0;
        std::string GuessedNumber = "";
        int GNumber = 0;
        int Guesses = 0;

        std::cout << "Welcome to Guess! A game made by Mayazcherquoi\n\n\n";

        while (true)
        {
            std::randomize();
            TheNumber = std::random(10) + 1;

            using namespace std;
            {
                guess:
                cout << "I am thinking of a number between 1 and 10, what is it?\n - ";
                cin >> GuessedNumber;

                if(isNum(GuessedNumber))
                  GNumber = strtoint(GuessedNumber); else
                    if((GuessedNumber == "x") || (GuessedNumber == "X"))
                      return 0; else
                      {
                        cout << "\nPlease enter a number only, or the letter 'X' (which will close the program).\n\n";
                        goto guess;
                      }

                while (GNumber != TheNumber)
                {

                    Guesses++;

                    if(GNumber < TheNumber)
                      cout << "Not quite right. Higher.\n"; else
                          cout << "Not quite right. Lower.\n";

                    guess2:
                    cout << "\nWhat is the number?:\n - ";
                    cin >> GuessedNumber;

                    if(isNum(GuessedNumber))
                      GNumber = strtoint(GuessedNumber); else
                        if((GuessedNumber == "x") || (GuessedNumber == "X"))
                          return 0; else
                          {
                            cout << "\nPlease enter a number only, or the letter 'X' (which will close the program).\n\n";
                            goto guess2;
                          }
                }

                cout << "Congratulations! You got it! The number was " << TheNumber << ".\n It took you " << Guesses << " guess(es) to figure it out!\n\n";
                Guesses = 0;
            }

        }

        return 0;
    }
    My first game in PHP was also a guessing game (used POST and a form), which I also cannot find the source for
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  2. #2
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    A Snake game (http://code.google.com/p/flashsnakesource/), although the code is old and inefficient.

    Edit: I also made a drawing game, though I don't know if that counts (http://villavu.com/forum/showthread.php?t=41089), and the code was very inefficient.
    Last edited by Quickmarch; 03-20-2010 at 08:06 AM.
    lol

  3. #3
    Join Date
    Dec 2008
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    looks like the C++ tags need some work.

    my first game was pretty crap, it was just simply a maze whereas you could navigate your player through it, not being able to pass through walls; the main objective was to get the treasure - when you got it you would respawn and the treasure would be at a different location, with your score incrementing. I was going to add some timer functionality but I had a server format, and I forgot to back it up

    oh, and it was made using ECMAScript and SVG.

    I guess I could make some other little ones, or I may do some simple WebGL

    ~ Craig`

  4. #4
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    http://www.youtube.com/watch?v=vpe3AZzJ95g

    I wanted to show a friend of my progress on the game i was making back then, that is why I have it on video ...


    That code is LONG gone

  5. #5
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Camaro' View Post
    http://www.youtube.com/watch?v=vpe3AZzJ95g

    I wanted to show a friend of my progress on the game i was making back then, that is why I have it on video ...


    That code is LONG gone
    What language?
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  6. #6
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Sex View Post
    What language?
    C++

  7. #7
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    Quote Originally Posted by Dan's The Man View Post
    The first game I made in C++ was a guessing game:
    c++ Code:
    #include <iostream>
    #include <string>
    #include <stdlib.h>

    bool isNum(std::string str)
    {
        for (unsigned int i = 0; i < str.length(); i++)
        {
            if(!(std::isdigit(str[i])))
              return false;
        }

        return true;
    }

    int strtoint(const std::string str)
    {
        if(!(isNum(str)))
          return 0;

        return(atoi(str.c_str()));
    }

    int main()
    {
        int TheNumber = 0;
        std::string GuessedNumber = "";
        int GNumber = 0;
        int Guesses = 0;

        std::cout << "Welcome to Guess! A game made by Mayazcherquoi\n\n\n";

        while (true)
        {
            std::randomize();
            TheNumber = std::random(10) + 1;

            using namespace std;
            {
                guess:
                cout << "I am thinking of a number between 1 and 10, what is it?\n - ";
                cin >> GuessedNumber;

                if(isNum(GuessedNumber))
                  GNumber = strtoint(GuessedNumber); else
                    if((GuessedNumber == "x") || (GuessedNumber == "X"))
                      return 0; else
                      {
                        cout << "\nPlease enter a number only, or the letter 'X' (which will close the program).\n\n";
                        goto guess;
                      }

                while (GNumber != TheNumber)
                {

                    Guesses++;

                    if(GNumber < TheNumber)
                      cout << "Not quite right. Higher.\n"; else
                          cout << "Not quite right. Lower.\n";

                    guess2:
                    cout << "\nWhat is the number?:\n - ";
                    cin >> GuessedNumber;

                    if(isNum(GuessedNumber))
                      GNumber = strtoint(GuessedNumber); else
                        if((GuessedNumber == "x") || (GuessedNumber == "X"))
                          return 0; else
                          {
                            cout << "\nPlease enter a number only, or the letter 'X' (which will close the program).\n\n";
                            goto guess2;
                          }
                }

                cout << "Congratulations! You got it! The number was " << TheNumber << ".\n It took you " << Guesses << " guess(es) to figure it out!\n\n";
                Guesses = 0;
            }

        }

        return 0;
    }
    ewww. icky code :P but not too shabby for your first game. how long ago did you make this? oh and my first game was a pong game made in c++ w/ allegro. cant find source, but if i do, i will post.

    oh n i got bored, so i decided to switch your code around (purely out of boredom/fun)

    Code:
    #include <iostream>
    #include <string>
    
    
    using namespace std;
    
    class guess{
         int GuessedNumber;
         int a;  
           public:
                int GuessNumber;
                int TheNumber(){return a;};
                void initialize() {GuessNumber=0; srand(unsigned(time(NULL))); a = (rand() % 100);};
                void ask();
                bool correct();
                void stupidguess();
                bool done();
                
    }; 
    
    void guess::ask() {
         cout << "Welcome to Guess!"<<endl<<endl;
         cout << "I am thinking of a number between 1 and 10, what is it?"<<endl;
         cin >> GuessedNumber;
         cout << string(50, '\n');
    }
    
    bool guess::correct() {
         if (TheNumber()==GuessedNumber) {
            return true;
         } 
         else {
            return false;
         }  
    }  
    
    void guess::stupidguess () {
         GuessNumber++;
         if(GuessedNumber < TheNumber()) {
             cout << "Higher. Guesses Left: "<< 10-GuessNumber<<endl;
             system("pause");
             cout << string(50, '\n');
         }
         else {
             cout << "Lower. Guesses Left: "<< 10-GuessNumber<<endl;
             system("pause");
             cout << string(50, '\n');
         }
    }
    
    bool guess::done() {
         if (correct()) {
              cout<<"Yay you win"<<endl;
              GuessNumber=11;
              system("pause");
              return true;
         }
         else {
              if (GuessNumber<=9) {
                   stupidguess();
              }
              if (GuessNumber>9) {
                   cout<<"You lose. Number was: "<< TheNumber()<<endl;
                   system("pause");
              }
              return false;
         }
    }
    
    
    int main()
    {
      guess g;
      g.initialize();
      while ((g.GuessNumber<=9)) {
            g.ask();
            g.done();
      }
      return 0;
    }

  8. #8
    Join Date
    Oct 2006
    Posts
    1,071
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    My first java assignment in school

    The Happy Kingdom!

    Code:
    import java.util.Random;
    import java.util.Scanner;
    
    public class KingdomSim {
    
    	public static void main(String[] args) {
    
    		System.out.println("Rules: \nEach person must eat 2 bushels " +
    				"of grain per year to survive.\nEach person can farm 1 acre of land." +
    				"\nIt takes 1 bushel of grain to plant an acre of land." +
    				"\nThe game is over after 10 turns.\n");
    		
    		Scanner stdIn = new Scanner(System.in);
    		
    		//get seed value
    		System.out.println("Please enter a seed value");	
    		int seedValue = stdIn.nextInt();
    		
    		Random ranGen = new Random(seedValue);
    		int turns = 0;
    		int population = 750;
    		int bushelsOfGrain = 2000;
    		int acresOfLand = 500;
    		int diedOfStarvation = 0;
    		int priceOfLand, landToBuy, landToSell, foodReleased, popChange, acresToPlant,
    		weather, bushelsHarvested, finalScore;
    
    		//begin the turn loop
    		do {   
    			turns++;
    			priceOfLand = ranGen.nextInt(11)+10; //randomize price of land
    
    			//turn start report
    			System.out.println("\n\nTurn " + turns);  
    			System.out.println("Population: " + population);
    			System.out.println("Bushels of grain in storage: " + bushelsOfGrain);
    			System.out.println("Acres of land in the kingdom: " + acresOfLand);
    			System.out.println("Price of land: " + priceOfLand + " bushels/acre.\n");
    
    			//get amount of land to buy
    			System.out.println("How much land would you like to buy?\n" + 
    					"(0 - " + bushelsOfGrain / priceOfLand+ ")");
    			landToBuy = stdIn.nextInt();
    			
    			// make sure input is valid
    			while (landToBuy < 0 || landToBuy > (bushelsOfGrain/priceOfLand)) { 
    				System.out.println("\nInvalid input, please enter a number between" +
    						" 0 and " + (bushelsOfGrain / priceOfLand));
    				landToBuy = stdIn.nextInt();
    			} 
    			acresOfLand += landToBuy;
    			bushelsOfGrain -= priceOfLand*landToBuy;
    
    			//get amount of land to sell if necessary
    			if (landToBuy == 0) { 
    				System.out.println("\nHow much land would you like to sell?\n" +
    						"(0 - " + acresOfLand + ")");
    				landToSell = stdIn.nextInt();
    				
    				//make sure input is valid
    				while (landToSell < 0 || landToSell > acresOfLand) { 
    					System.out.println("\nInvalid input, please enter a number " +
    							"between 0 and " + acresOfLand);
    					landToSell = stdIn.nextInt();
    				} 
    				
    				acresOfLand -= landToSell;
    				bushelsOfGrain += priceOfLand*landToSell;
    			}
    
    			// get amount of grain to feed to people
    			System.out.println("\nHow much grain do you want to release to your" +
    					" people?\n(0 - " + bushelsOfGrain + ")");
    			foodReleased = stdIn.nextInt();
    
    			//make sure input is valid
    			while (foodReleased < 0 || foodReleased > bushelsOfGrain) {
    				System.out.println("\nInvalid input, please enter a number between" +
    						" 0 and " + bushelsOfGrain);
    				foodReleased = stdIn.nextInt();
    			} 
    			
    			//reduce stores of grain from feeding peasants
    			bushelsOfGrain -= foodReleased;
    
    			//calculate population change
    			if (foodReleased < (population * 2)) { 
    				popChange = (foodReleased / 2)- population;
    			}
    			else {
    				popChange = (foodReleased / 2) - population;
    			}
    
    			//calculate number of acres to plant
    			if (acresOfLand <= bushelsOfGrain && acresOfLand <= population) { 
    				acresToPlant = acresOfLand;
    			}
    			else if (bushelsOfGrain <= acresOfLand && bushelsOfGrain <= population) {
    				acresToPlant = bushelsOfGrain;
    			}
    			else {
    				acresToPlant = population;
    			}
    
    			//print growing report
    			System.out.println("\nYou have " + population + " peasants, "
    					+ acresOfLand + " acres and " + bushelsOfGrain
    					+ " bushels of grain," + " so you were able to plant "
    					+ acresToPlant + " acres of land this turn.");
    
    			//reduce stores of grain from planting
    			bushelsOfGrain -= acresToPlant;
    
    			//get a random number between 0 and 4 (inclusive)
    			weather = ranGen.nextInt(5); 
    
    			switch (weather) {
    			case 0:
    				System.out.println("Terrible harvest!"); break; //terrible harvest
    			case 1:
    				System.out.println("Poor harvest."); break; //poor harvest
    			case 2:
    				System.out.println("Average harvest."); break; //average harvest
    			case 3:
    				System.out.println("Good harvest."); break; //good harvest
    			case 4:
    				System.out.println("Excellent harvest!"); break; //excellent harvest
    			}
    
    			weather += 3; //add 3 to the random number to get the 3 - 7 range
    			bushelsHarvested = acresToPlant * weather; //calculate yield
    			System.out.println("You harvested " + bushelsHarvested + 
    					" bushels of grain.");
    			bushelsOfGrain += bushelsHarvested; //update bushels based on harvest
    
    			//update population and report
    			population += popChange;
    			if (popChange > 0) { 
    				System.out.println("\n" + popChange + 
    						" immigrants came to the kingdom."); 
    			}
    			else if (popChange < 0) {
    				System.out.println("\n" + -popChange + 
    						" peasants died of starvation.");
    				diedOfStarvation -= popChange; //keep track of dead from starvation
    			}
    
    		} while (turns < 10); //end the turn loop
    
    		//end game report
    		finalScore = (acresOfLand * 15) + (population * 2) + (bushelsOfGrain)
    				- (diedOfStarvation * 10); // calculate the final score
    		System.out.println("\n\n\nFinal population: " + population);
    		System.out.println("Final size of kingdom: " + acresOfLand + " acres");
    		System.out.println("Final size of grain stores: " + bushelsOfGrain + 
    				" bushels");
    		System.out.println("Total peasants killed from starvation: " + 
    				diedOfStarvation);
    		System.out.println("Final score: " + finalScore);
    
    	}
    
    }

  9. #9
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Lol nice one Tim0 I gotta give that a shot xD
    Quote Originally Posted by x[Warrior]x3500 View Post
    ewww. icky code :P but not too shabby for your first game. how long ago did you make this? oh and my first game was a pong game made in c++ w/ allegro. cant find source, but if i do, i will post.

    oh n i got bored, so i decided to switch your code around (purely out of boredom/fun)

    Code:
    #include <iostream>
    #include <string>
    
    
    using namespace std;
    
    class guess{
         int GuessedNumber;
         int a;  
           public:
                int GuessNumber;
                int TheNumber(){return a;};
                void initialize() {GuessNumber=0; srand(unsigned(time(NULL))); a = (rand() % 100);};
                void ask();
                bool correct();
                void stupidguess();
                bool done();
                
    }; 
    
    void guess::ask() {
         cout << "Welcome to Guess!"<<endl<<endl;
         cout << "I am thinking of a number between 1 and 10, what is it?"<<endl;
         cin >> GuessedNumber;
         cout << string(50, '\n');
    }
    
    bool guess::correct() {
         if (TheNumber()==GuessedNumber) {
            return true;
         } 
         else {
            return false;
         }  
    }  
    
    void guess::stupidguess () {
         GuessNumber++;
         if(GuessedNumber < TheNumber()) {
             cout << "Higher. Guesses Left: "<< 10-GuessNumber<<endl;
             system("pause");
             cout << string(50, '\n');
         }
         else {
             cout << "Lower. Guesses Left: "<< 10-GuessNumber<<endl;
             system("pause");
             cout << string(50, '\n');
         }
    }
    
    bool guess::done() {
         if (correct()) {
              cout<<"Yay you win"<<endl;
              GuessNumber=11;
              system("pause");
              return true;
         }
         else {
              if (GuessNumber<=9) {
                   stupidguess();
              }
              if (GuessNumber>9) {
                   cout<<"You lose. Number was: "<< TheNumber()<<endl;
                   system("pause");
              }
              return false;
         }
    }
    
    
    int main()
    {
      guess g;
      g.initialize();
      while ((g.GuessNumber<=9)) {
            g.ask();
            g.done();
      }
      return 0;
    }
    Well, for this post I wasn't intending for people to show how to do improve things, because I thought the "first" word would imply it

    I know you can do it differently, as would I now. However, not exactly like yours xD

    Also, I made that about 4-5 months ago (on memory).
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  10. #10
    Join Date
    Dec 2008
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    how is The Man's code "icky"?

    he has good use of the std namespace, not just including it at first (thus including all functions making it inefficient if you don't use them all)

    ~ Craig`

  11. #11
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    The first game I wrote was tic tac toe in C, sadly i cant provide sauce ;O

  12. #12
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by Camaro' View Post
    http://www.youtube.com/watch?v=vpe3AZzJ95g

    I wanted to show a friend of my progress on the game i was making back then, that is why I have it on video ...


    That code is LONG gone
    I've seen that somewhere before! Have you ever linked to it or anything like that?

  13. #13
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    Quote Originally Posted by Craig` View Post
    how is The Man's code "icky"?

    he has good use of the std namespace, not just including it at first (thus including all functions making it inefficient if you don't use them all)

    ~ Craig`
    well you are completely correct in that his use of std is more efficient. why i thought his code was icky (note icky is an opinion) was because of two things: no classes, icky main(). first i am gunna throw in "no classes" cus one of the main functions that C++ has over C is that it can use OOP. Why not atleast attempt to do it then?
    also IMO main() should not be like 3 pages long. any super big main() just makes a code look super icky to me (depends on how long the actual code is too - like a 5000 lined code will have a bigger main() than a 500 lined code typically, and that is understandable).

    just little things like that made it look icky to me. now @Dan:
    XD sry if i sounded like i wanted to "make your code better". lol cus that was not my desire. i just got super bored and decided i would create the same game, but a different way (i stole a couple lines of your code here and there). so then i decided to post it . so did you teach yourself? or do a class or what? i honestly think your use of std is very smart and efficient. but i do think your code overall looks icky :P (personal opinion, please take no offence).

  14. #14
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Verrekte Koekwous

  15. #15
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  16. #16
    Join Date
    Oct 2006
    Posts
    1,071
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by mastaraymond View Post
    Holy shit. I forgot how epic this was.

  17. #17
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    Snake game in pascal controls are wasd.
    SCAR Code:
    program Snake;

    uses
      crt;

    type
      TPoint = record
        x, y: Integer;
      end;


    var
      I, II, x, y, Suunta, Pisteet, x2, y2, elamat: Integer;
      K: Char;
      IA: Array [0..10000000] of TPoint;
      Syoty: Boolean;


    procedure Setup;
    begin
      Clrscr;
      Window (1,1,45, 45);
      WriteLn('---------------------------------------');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('|                                     |');
      WriteLn('---------------------------------------');

      Elamat := 1;
      I := 0;
      Suunta := 0;
      Pisteet := 0;
      x := 15;
      y := 10;
      Syoty := True;
      IA[I].x := x;
      IA[I].y := y;
    end;

    procedure NaytaPisteet;
    begin
      GotoXY(3,24);
      WriteLn('Score: ', Pisteet);
      GotoXY(20,24);
      WriteLn('Lifes: ', Elamat);
    end;

    begin
      repeat
        Setup;
        repeat
          if KeyPressed then
          begin
            K := ReadKey;
            case K of
              'w': if not (Suunta = 2) then Suunta := 1;
              's': if not (Suunta = 1) then Suunta := 2;
              'a': if not (Suunta = 4) then Suunta := 3;
              'd': if not (Suunta = 3) then Suunta := 4;
            end;
          end;
          if (Suunta = 1) or (Suunta = 2) then Delay(110)
          else Delay(90);
          if I > Pisteet-1 then
          begin
            GotoXY(IA[I-Pisteet].x, IA[I-Pisteet].y);
            WriteLn(' ');
          end;
          case Suunta of
            1: if y = 2 then y := 22
            else y := y-1;
            2: if y = 22 then y := 2
            else y := y+1;
            3: if x = 2 then x := 38
            else x := x-1;
            4: if x = 38 then x := 2
            else x := x+1;
          end;
          if Suunta > 0 then
          begin
            I := I+1;
            IA[I].x := x;
            IA[I].y := y;
          end;
          if syoty then
          begin
            repeat
              x2 := 2+Random(37);
              y2 := 2+Random(21);
              for II := I-Pisteet to I do
              begin
                if (x2=IA[II].x) and (y2=IA[II].y) then
                  Break else Continue;
              end;
            until(II > I-1);
            GotoXY(x2, y2);
            WriteLn('O');
            Syoty := False;
          end;
          if (x = x2) and (y = y2) then
          begin
            Syoty := True;
            Pisteet := Pisteet+1;
          end;
          for II := I-Pisteet to I-1 do
            if (x=IA[II].x) and (y=IA[II].y) then
            begin
              Elamat := Elamat-1;
              Break;
            end;
          GotoXY(x, y);
          if Syoty then WriteLn('@')
          else
          Case Suunta of
            0..2: WriteLn('|');
            3..4: WriteLn('-');
          end;
          NaytaPisteet;
        until(Elamat = 0);
        WriteLn('Q = quit, N = new game');
        Delay(2000);
        repeat
          if ReadKey = 'q' then Halt;
          if ReadKey = 'n' then Break;
        until(False);
      until(false);
    end.

  18. #18
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    I've seen that somewhere before! Have you ever linked to it or anything like that?
    I probably showed you before, I showed a few people.

    That video is win.

  19. #19
    Join Date
    Dec 2008
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    improving improved code.

    Code:
    bool guess::correct() {
         if (TheNumber()==GuessedNumber) {
            return true;
         } 
         else {
            return false;
         }  
    }
    could simply be

    Code:
    bool guess::correct() {
      return TheNumber() == GuessedNumber;
    }
    aha

    ~ CRaig`
    Last edited by Craig`; 03-24-2010 at 07:37 AM.

  20. #20
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

  21. #21
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by mastaraymond View Post
    ScaRPG was way cooler, well would have been if Scar wasn't so silly and restricting!

    Oh and I made a Java pong too, was quite fun - all 4 walls had players then produced AI's for the other 3, giving them increasing skill as the game progresses!

    In Delphi I made a potato.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  22. #22
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by mixster View Post
    ScaRPG was way cooler, well would have been if Scar wasn't so silly and restricting!

    Oh and I made a Java pong too, was quite fun - all 4 walls had players then produced AI's for the other 3, giving them increasing skill as the game progresses!

    In Delphi I made a potato.
    Err... a potato? Explain
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  23. #23
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    The first game I make for a new language is almost always pong, as it gives me a good feel for the language. Unfortunately, I never save anything I write, so I can't post any sauce

    Quote Originally Posted by mastaraymond View Post
    <3

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •