Commit c0d25b20 authored by LiberIT's avatar LiberIT

added text_compare, and page_translate

parent bbc45c22
......@@ -16,15 +16,29 @@ Then you would make the function declaration with the input and output types,
perhaps with some contractual constraints on the range of valid inputs and
outputs.
After that can give one or more input and output example and-or a logical
At this point the machine programmer can check it's inventory of known programs
to see if there are any matching programs, that have the same input/outputs, and
similar names and-or description. If it finds a small amount of them, can ask
if you'd like to use one of them as a basis.
After that user can give one or more input and output example and-or a logical
description of what the output should be relative to the input. Can also offer
some suggestions for which functions may be helpful in accomplishing the task.
At which point the machine programmer will start evolving functions that meet
the specification and examples. If it evolves multiple programs that meet the
the specification and examples.
If it is taking more than a few seconds user can start writing the program as
they think it should be. the functions they thought would be necessary would be
in comments, they can remove or add to them as necessary or uncomment them to
include them in the code.
If the user decides that will need to make a new support function in order to
achieve this task, then can save state of this development. and switch over to
developing the supporting function.
If it evolves multiple programs that meet the
full specification, but deviate from each other within the valid range of
inputs.
Then the machine programmer will ask which of them is prefered, or if neither
then by giving the appropriate output for that particular input.
......
......@@ -26,3 +26,4 @@ games
gcompri
robots
X

......@@ -110,3 +110,12 @@ void tablet_zero(const uint16_t tablet_long, line_t tablet[]) {
tablet_write(iterator, 0, tablet_long, tablet));
}
word_t /* boolean */ text_compare(struct Text example, struct Text comparison){
conditional(example.length != comparison.length, return lie_WORD);
conditional(example.letters == comparison.letters, return truth_WORD);
down_repeat(example.length,
conditional(comparison.letters[iterator-1] != example.letters[iterator-1],
return lie_WORD));
return truth_WORD;
}
......@@ -34,4 +34,6 @@ void literal_word_ins_htinka_addenda(const uint16_t word,
struct Page produce);
void literal_number_ins_htinka_addenda(const uint16_t number, struct Phrase produce);
void tablet_zero(const uint16_t tablet_long, line_t tablet[]);
word_t /* boolean */ text_compare(struct Text example, struct Text comparison);
#endif
......@@ -86,8 +86,5 @@
function; \
break;
#define conditional(condition, function) \
if (condition) { \
function; \
}
#define conditional(condition, function) if (condition) { function; }
#endif
This diff is collapsed.
......@@ -139,4 +139,10 @@ uint16_t phrase_number_extract(const struct Phrase htin,
const word_t phrase_code);
void dat_plus_interpret(const struct Phrase input_phrase,
struct Phrase knowledge, struct Phrase produce) ;
struct Phrase /* ksim phrase */ kwonyi_rwekgvakfyamti_nwonhtinka_plus(
const struct Phrase ksim, const struct Phrase input,
struct Phrase dictionary);
word_t /*success_boolean*/ kwonyi_wigvakfyamti_nwonhtinka_plus(
const struct Phrase ksim, const struct Phrase input,
struct Phrase dictionary);
#endif
......@@ -1296,10 +1296,22 @@ const char *quiz_found() {
return 0;
}
const char *quiz_kwonyi_rwekgvakfyamti_nwonhtinka_plus(){
NewTextPhrase(ksim, 1, "hnucgidoyi tyutplos ksuh");
NewTextPhrase(input, 1, "prifgidoyi tyutplos tu");
NewPagePhrase(dictionary, 4);
struct Phrase ksim_fyam =
kwonyi_rwekgvakfyamti_nwonhtinka_plus(ksim, input, dictionary);
mu_assert(__FUNCTION__, phrase_letters_compare(ksim_fyam, "hnucgidoyi") == truth_WORD);
mu_assert(__FUNCTION__, phrase_letters_compare(dictionary, "hnucgina prifgika li") == truth_WORD);
return 0;
}
const char *quiz_recipe() {
mu_run_quiz(quiz_retrospective_recipe_ksim_found);
mu_run_quiz(quiz_forward_finally_found);
mu_run_quiz(quiz_retrospective_recipe_found);
mu_run_quiz(quiz_kwonyi_rwekgvakfyamti_nwonhtinka_plus);
//mu_run_quiz(quiz_recipe_load);
// mu_run_quiz(quiz_worker);
// function quiz
......@@ -1355,11 +1367,33 @@ const char *quiz_grammar() {
mu_run_quiz(quiz_tablet_retrospective_grammar_read);
return 0;
}
const char *quiz_retrospective_gvak_nwonhtin_plus() { return 0; }
const char *quiz_all_gvak_nwonhtin_plus() { return 0; }
const char *quiz_kwonyi_wigvakti_nwonhtinka_plus() { return 0; }
const char *quiz_nwonhtin() {
mu_run_quiz(quiz_retrospective_gvak_nwonhtin_plus);
mu_run_quiz(quiz_all_gvak_nwonhtin_plus);
mu_run_quiz(quiz_kwonyi_rwekgvakfyamti_nwonhtinka_plus);
//mu_run_quiz(quiz_kwonyi_wigvakfyamti_nwonhtinka_plus);
return 0;
}
const char *quiz_page_translate_basic() {
NewTextPage(input, 1, "hcanli");
NewTextPad(produce, LINE_LONG*WORD_LONG);
NewText(perfect_produce, "hcanli ");
produce = page_translate(input, fluent_WORD, produce);
DEBUGPRINT(("'%s' produce.letters, %X produce.length\n", produce.letters, produce.length));
DEBUGPRINT(("'%s' perfect_produce.letters, %X perfect_produce.length\n", perfect_produce.letters, perfect_produce.length));
mu_assert(__FUNCTION__, text_compare(produce, perfect_produce) == truth_WORD);
return 0;
}
const char *quiz_page_translate() {
mu_run_quiz(quiz_page_translate_basic);
return 0;
}
const char *quiz_translate() {
mu_run_quiz(quiz_page_translate);
return 0;
}
......@@ -1376,9 +1410,10 @@ const char *all_quizs() {
mu_run_quiz(quiz_cousin_found);
mu_run_quiz(quiz_compare);
mu_run_quiz(quiz_variable);
mu_run_quiz(quiz_translate);
// mu_run_quiz(quiz_nwonhtin);
//mu_run_quiz(quiz_recipe);
mu_run_quiz(quiz_conditional);
mu_run_quiz(quiz_nwonhtin);
mu_run_quiz(quiz_recipe);
return 0;
}
......
......@@ -899,6 +899,7 @@ void phrase_print(const struct Phrase phrase){
}
struct Phrase /*grammar_word*/ neo_tablet_retrospective_grammar_read(
const struct Phrase input){
guarantee(input.page.lines != NULL);
......
......@@ -262,6 +262,12 @@ struct Text{
name.letters = name ## _letters; \
name.length = strlen(name ## _letters);/*flawfinder:ignore*/
#define NewTextPad(_name, _pad_length)\
char _name ## _letters [_pad_length] = {0};\
struct Text _name;\
_name.letters = _name ## _letters;\
_name.length = _pad_length;
#define NewPage(name, tablet_length) \
line_t name ## _lines[tablet_length] = {0};\
struct Page name; \
......@@ -428,4 +434,5 @@ void phrase_print(const struct Phrase phrase);
word_t /* word */ phrase_word_read(struct Phrase phrase, txik_t word_txik);
#endif
......@@ -2223,3 +2223,9 @@ struct Phrase /* found_phrase */ neo_retrospective_phrase_situate(
&produce.begin);
return produce;
}
struct Text /* produce */ page_translate(const struct Page input, uint16_t sort, struct Text produce_pad){
produce_pad.length = tablet_translate(input.plength, input.lines, sort,
produce_pad.length, produce_pad.letters);
return produce_pad;
}
......@@ -58,4 +58,5 @@ uint16_t /*htin_long*/ retrospective_independentClause_long_found(
struct Page /* htin range */ retrospective_htin_long_found(
const struct Page input);
struct Text /* produce */ page_translate(const struct Page input, uint16_t sort, struct Text produce_pad);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment