Making a decision tree for AI in C++ [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I know the basics of having a user input their decision as a choice, and having that lead to another decision. My only issue is that when i make these choices, it is almost all hard coded in, leaving no room for other uses of the code. I was wondering what the best way to make a decision tree for AI that would allow them to make smart decisions based on the circumstances. I DO NOT want the pre-written code or a library. I would prefer to write the code myself and learn more about the language. I have a good understanding of the language, but would still like to learn more.

You can embed a scripting language (e.g. Lua) into your application and let your users write their decision trees as scripts.
Or you can think of some data structure (XML-based for example) that describes an arbitrary decision tree that you can parse and build the actual tree during run time.

Related

How can I implement online algorithms using functional programming? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 hours ago.
Improve this question
I program embedded systems using C++. I am learning functional programming and would love to apply it more in my work. All of my data is collected discretely and is often times required to be analyzed online.
For example, using a moving average to smooth signals. I can make the moving average function pure, but I can't make the state for the function const. Another example, I can make a pure Schmitt trigger function, but I can't make all of its inputs depend only on the current state.
What is the best way, in a functional sense, to store data from previous time steps?
Also, do you have any favorite references for embedded/functional programming?

Advices for making a compiler [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 days ago.
Improve this question
I need practical advice on how to build a compiler. Any advice is welcome, metaphors, tools, a learning order, things to study, etc.
At the moment I have been studying regular expressions and automata theory, deterministic and non-deterministic finite automata, but I don't understand the concepts very well, I plan to keep studying and share my progress with the community on this occasion.
I would appreciate any input or comments on your experiences in similar cases, as I said, anything is welcome, thank you very much!
The instructions I have received are as follows:
[Implement a compiler for a specific language considering the language stages.
Define, design and program the lexical and syntactic analyser stages of a translator or compiler to preamble the construction of a compiler].
As you can see the assignment is actually very abstract and it benefits me to do it my way, so I want to make the most of this experience.

What piece of hardware or software on a computer/microcontroller determines what code you can write (and not write)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 months ago.
Improve this question
So I am writing code for a microcontroller (using Arduino IDE), which I do not have a ton of experience doing. This question popped into my head when I was wondering which 'parts' of C++ I could use in my code that would flash onto this NRF52840 microcontroller. Basically, I am wondering: What on that board determines the code I must write for it?
I understand saying "what code can I write/not write" is broad, but its because I dont know what to say instead. A few guesses I have for substitutes for this would be: certain libraries? certain coding languages?, certain types of languages (interpreted vs compiled)?
Sorry if this question is too horribly stated to get an answer, but this was legit the best I could do lol.
In the case of using C++, it depends entirely upon what language features the compiler you are using supports. I suppose there might be hardware out there that is so simplistic that certain features are simply beyond the ability to implement, but I cannot tell you either what hardware that is, or what language features would be so effected.

How to approach a C++ parser [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am wanting to have a go at a C++ parser for a formatter I am making.
You can obviously open a file and use getline(..) or get(), is this reasonable way of starting things off and then working out a system using vector arrays and hence creating loads of arrays and somehow structuring out and processing what you are doing from there. For example say I wanted to find ever function in a source file, all functions have the common syntax, "(){" once whitespace has been removed, so do you just look for common delimeters to parse out the sections into arrays. I suppose I will learn as I go.
Or I also assume there are tried and tested ways of doing this, and I would likley just be reinventing the wheel as they say.
C++ is a language that is quite hard to parse in the first place. So if you want anything other that really trivial C++ code to be "understood" by your parser, you are definitely better off starting with an existing product.
The Clang frontend library would perhaps be a good starting point.
There are also a number of "source to source" conversion examples based on clang. Here's one of them: http://eli.thegreenplace.net/2012/06/08/basic-source-to-source-transformation-with-clang/

Runtime add algorithm to a program [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm creating a program that make some matrix analysis. Now i want to implement some basic algorithms but I need to allow users implement new algorithms in the future without recompile the code.
I suppose that these algorithms already exist, probably in c/c++ language.
How can I do it if I use qt?
Maybe it's better use an other programming language and why?
I suppose that these algorithms already exist, probably in c/c++ language
If that's so, one way would be to write your program capable of loading DLLs, and then your users can compile their own algorithm DLL plugins for your application.
Or if you don't expect your users to be able to compile the existing c/c++ algorithms, maybe you can do as Joachim Pileborg suggests, and add in a scripting interface.