CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2013
    Posts
    4

    Question You can create a program like this?

    Hello Guys,

    Someone can tell me if it is possible to create a program like Robocode, a game controlled at runtime by an external source file in visual c ++? For example create a checkers game where there would be an external source file, read at runtime, which would play automatically, with artificial intelligence. You can? If yes, how?

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: You can create a program like this?

    If I can? Probably yes.
    How? Sweating a lot.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    Mar 2013
    Posts
    4

    Re: You can create a program like this?

    Quote Originally Posted by ovidiucucu View Post
    If I can? Probably yes.
    How? Sweating a lot.
    Oh, sorry for my bad english, i wanted to say: "it is possible create a program like this?" how to interpret the code at runtime with c++? I have no idea how to do...

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: You can create a program like this?

    Quote Originally Posted by ordan1 View Post
    Oh, sorry for my bad english, i wanted to say: "it is possible create a program like this?" how to interpret the code at runtime with c++? I have no idea how to do...
    So do you think that someone is going to post thousands, if not millions of lines of code? What answer are you expecting us to give you?

    The best answer came from ovidiu -- hard work, study, and a lot of sweating. What you ask for is very advanced, and must be broken down into individual modules. Even an advanced programmer would have sleepness nights trying to come up with all of these details you described.

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    Mar 2013
    Posts
    4

    Re: You can create a program like this?

    Quote Originally Posted by Paul McKenzie View Post
    So do you think that someone is going to post thousands, if not millions of lines of code? What answer are you expecting us to give you?

    The best answer came from ovidiu -- hard work, study, and a lot of sweating. What you ask for is very advanced, and must be broken down into individual modules. Even an advanced programmer would have sleepness nights trying to come up with all of these details you described.

    Regards,

    Paul McKenzie
    Millions of lines of code to read and execute source code? I do not know if you understood my idea or seen the Robocode, but would for example something like this: There would be a square on the screen and the user would send a source code with predefined functions to move the square, for example "move up "," move down ", etc.. I'm not asking you to do this for me. I do not have much experience with object-oriented language, I am still studying, just wanted to know the possibility and viability of doing something. I think it would be easier with Java, being an interpreted language, but wanted to do in C + +, however I can not find stuff on the internet about it. Java would be more viable?

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: You can create a program like this?

    That's not "source code", that's just a file that contains instructions. That could be fairly simple. Read the file, match the instruction to an action and execute the action. Your question is still pretty vague to give a detailed answer.

  7. #7
    Join Date
    Apr 1999
    Posts
    27,449

    Re: You can create a program like this?

    Quote Originally Posted by ordan1 View Post
    There would be a square on the screen and the user would send a source code with predefined functions to move the square, for example "move up "," move down ", etc.. I'm not asking you to do this for me. I do not have much experience with object-oriented language, I am still studying, just wanted to know the possibility and viability of doing something.
    Of course someone or some team of programmers can write such a program.
    I think it would be easier with Java, being an interpreted language, but wanted to do in C + +, however I can not find stuff on the internet about it.
    And what is the "stuff" you're looking for? Wouldn't it be source code or libraries?

    Regards,

    Paul McKenzie

  8. #8
    Join Date
    Mar 2013
    Posts
    4

    Re: You can create a program like this?

    Quote Originally Posted by GCDEF View Post
    That's not "source code", that's just a file that contains instructions. That could be fairly simple. Read the file, match the instruction to an action and execute the action. Your question is still pretty vague to give a detailed answer.
    Have you seen Robocode?

    I wanted to do something like this: http://ideone.com/QL9nU5
    The user would play with your code, without interfering in the source code or visual game

    Robocode is like that but it is in java

  9. #9
    Join Date
    Apr 1999
    Posts
    27,449

    Re: You can create a program like this?

    Quote Originally Posted by ordan1 View Post
    Robocode is like that but it is in java
    Your original question was answered.

    1) Yes, practically any software can be created with C++.

    2)
    You can? If yes, how?
    This is where you're vague. Just asking us "how" is an open-ended question. It's like asking someone "can you build a skyscraper", and then asking "how?".

    Regards,

    Paul McKenzie

  10. #10
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: You can create a program like this?

    You can? If yes, how?
    By first producing a program design and then crafting the correct c++ code from the design. The hard part is nearly always producing the design because that is where most of the thinking has to be done. What input/output is needed, what classes are needed, how they interface with each other etc etc etc. None of this is directly related to c++. The design if done properly could then be coded in any suitable language.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured