Find

Article
· May 5 4m read

Senhoras e senhores, o incrível Iris-nator

   

O incrível Iris-nator chegou à cidade. Ele sabe o que você pensa, com apenas algumas perguntas ele é capaz de adivinhar o personagem em que você pensou. Você se atreve?

Alguns de vocês podem conhecer o jogo Akinator, onde um gênio é capaz de adivinhar o personagem em que você pensou, enquanto você responde “sim” ou “não” a uma pergunta simples.

Sem IA analisando suas redes sociais, sem microfones escutando... Então, como ele faz isso?

O segredo é um algoritmo simples e muitas pessoas jogando e alimentando o banco de dados.

Como funciona?

Vamos definir um termo: Nó.

Um nó pode ser uma pergunta ou o nome do personagem.

Se for uma pergunta, terá duas respostas: Sim ou Não.

 

Agora vamos dar um valor a ele.

À pergunta daremos o Id 1, à resposta afirmativa, daremos o Id 2 e à resposta negativa, o Id 3.

Agora vamos imaginar que ambas as respostas afirmativa e negativa retornam outra pergunta, com os personagens correspondentes para “sim” e “não”.

 

Podemos ver um padrão entre as perguntas e as respostas.

Respostas afirmativas são o dobro do identificador da pergunta, e respostas negativas são o dobro do identificador da pergunta mais um.

Então, se temos o nó n, o próximo nó a ser exibido será o nó n×2 se a resposta for "sim" ou o nó (n×2)+1 se a resposta for "não".

Vamos dar um exemplo:

 

Suponha que eu pense no Snoopy, e a pergunta seja "Seu personagem é fictício?", a resposta "sim" nos dirá que o personagem em que pensamos é o "Superman", mas não está correto.

Como transformamos nossa resposta em uma pergunta que nos leva ao Snoopy?

Precisamos de uma característica que nos diferencie do Superman, neste caso perguntaremos "Seu personagem é um cachorro?", então, a resposta afirmativa seria "Snoopy" e a resposta negativa seria "Superman".

Esta nova pergunta substituirá o Id do nó "Superman", o personagem "Snoopy" terá o dobro do nó da nova pergunta e o personagem "Superman" terá o dobro do nó da nova pergunta mais um.

 

Dessa forma, se criarmos muitas perguntas e respostas, nosso Iris-nator será capaz de adivinhar qualquer personagem em que você pensou.

Como o Iris-nator funciona?

Crie uma tabela com informações dos nós:

Class Irisnator.Data.Nodes Extends %Persistent
{

/// NodeId
Property NodeId As %Numeric;
/// Texto do nó
Property Text As %String(MAXLEN = "");
/// Ttipo do nó (0 = texto, 1 = pergunta)
Property Question As %Boolean [ InitialExpression = 0 ];
/// Verbo da pergunta
Property Verb As %String(MAXLEN = "");
}

Observação: Por que existe um campo chamado "verbo"? Porque a pergunta é mostrada como {verbo} seu personagem {texto}? Portanto, é necessário saber qual é o verbo (é, tinha, faz, etc...).

O front-end foi criado com Angular 19. Para se comunicar com o IRIS, criei vários métodos de API:

GET localhost:52773/irisnator/api/node/:nodeId

Retorna as informações sobre o nó, e também o NodId para as respostas Sim e Não.

{
    "nodeId": 1,
    "text": "a woman",
    "verb": "is",
    "question": true,
    "nodeYes": 2,
    "nodeNo": 3
}

GET localhost:52773/irisnator/api/score/:top

Retorna a pontuação máxima. Essa pontuação máxima é o número de vezes que um personagem foi acertado.

{
    "score": [
        {
            "characterName": "Spiderman",
            "score": 8
        },
        {
            "characterName": "Maddona",
            "score": 3
        },
        {
            "characterName": "Snoopy",
            "score": 1
        }
    ]
}

POST localhost:52773/irisnator/api/node

Quando o Iris-nator não consegue adivinhar seu personagem, preenchemos um formulário com os dados do novo personagem e qual seria a pergunta a fazer para diferenciá-lo do personagem a que ele chegou.

Então, movemos o personagem atual para a resposta "não" e colocamos o ID na nova pergunta.

{
    "nodeId": 507,
    "newCharacter": "Snoopy",
    "oldCharacter": "Bugs Bunny",
    "text": "a dog",
    "verb": "is"
}

Além disso, ele adicionará Snoopy como um personagem que ele não conseguiu adivinhar.

POST localhost:52773/irisnator/api/score

Este método define a pontuação de um personagem, se foi um sucesso ou não.

{
    "characterName": "Snoopy",
    "success": true
}

 

Você pode assistir ao seguinte vídeo de como o aplicativo funciona, aproveite!!!

1 Comment
Discussion (1)1
Log in or sign up to continue
Discussion (4)2
Log in or sign up to continue
Digest
· May 5

Publications des développeurs d'InterSystems, semaine Avril 28 - Mai 04, 2025, Résumé

Articles
Annonces
#Portail d'apprentissage
#Communauté des développeurs officielle
Avril 28 - Mai 04, 2025Week at a GlanceInterSystems Developer Community
Announcement
· May 5

InterSystems FHIR and Digital Health Interoperability Contest 2025

Hi Developers,

We are happy to announce the new InterSystems online programming contest dedicated to all things health-related:

🏆 InterSystems FHIR and Digital Health Interoperability Contest 🏆

Duration: May 12 - June 1, 2025

Prize pool: $12,000

 The topic

Develop any interoperability FHIR solution or Healthcare Interoperability solution or a solution that helps to develop or/and maintain interoperability solutions using InterSystems IRIS for Health, Health Connect, or FHIR server.  

General Requirements:

  1. An application or library must be fully functional. It should not be an import or a direct interface for an already existing library in another language (except for C++, there you really need to do a lot of work to create an interface for IRIS). It should not be a copy-paste of an existing application or library.
  2. Accepted applications: new to Open Exchange apps or existing ones, but with a significant improvement. Our team will review all applications before approving them for the contest.
  3. The application should work either on IRIS Community Edition or IRIS for Health Community Edition. Both could be downloaded as host (Mac, Windows) versions from Evaluation site, or can be used in a form of containers pulled from InterSystems Container Registry or Community Containers: intersystemsdc/iris-community:latest or intersystemsdc/irishealth-community:latest .  
  4. The application should be Open Source and published on GitHub or GitLab.  
  5. The README file to the application should be in English, contain the installation steps, and contain either the video demo or/and a description of how the application works.
  6. Only 3 submissions from one developer are allowed.

NB. Our experts will have the final say in whether the application is approved for the contest or not based on the criteria of complexity and usefulness. Their decision is final and not subject to appeal.

Prizes

1. Experts Nomination - a specially selected jury will determine winners:

🥇 1st place - $5,000 

🥈 2nd place - $2,500 

🥉 3rd place - $1,000

🏅 4th place - $500

🏅 5th place - $300

🌟 6-10th places - $100

2. Community winners - applications that will receive the most votes in total:

🥇 1st place - $1,000 

🥈 2nd place - $600 

🥉 3rd place - $300

🏅 4th place - $200

🏅 5th place - $100

❗ If several participants score the same number of votes, they are all considered winners, and the prize money is shared among the winners.
❗ Cash prizes are awarded only to those who can verify their identity. If there are any doubts, organizers will reach out and request additional information about the participant(s).

Who can participate?

Any Developer Community member, except for InterSystems employees (ISC contractors allowed). Create an account!

Developers can team up to create a collaborative application. 2 to 5 developers are allowed in one team.

Do not forget to highlight your team members in the README of your application – DC user profiles.

Important Deadlines:

🛠 Application development and registration phase:

  • May 12, 2025 (00:00 EST): Contest begins.
  • May 25, 2025 (23:59 EST): Deadline for submissions.

 Voting period:

  • May 26, 2025 (00:00 EST): Voting begins.
  • June 1, 2025 (23:59 EST): Voting ends.

Note: Developers can improve their apps throughout the entire registration and voting period.

    Helpful Resources:

    ✓ Documentation:

    ✓ Tools:

    • Clinfhir - FHIR visualization and developer tool.

    ✓ Example applications:

    ✓ Online courses:

    ✓ Videos:

    ✓ For beginners with IRIS:

    ✓ For beginners with ObjectScript Package Manager (IPM):

    ✓ How to submit your app to the contest:

    Need Help?

    Join the contest channel on InterSystems' Discord server or talk with us in the comment to this post. 

    We're waiting for YOUR project – join our coding marathon to win! 


    By participating in this contest, you agree to the competition terms laid out here. Please read them carefully before proceeding.

    7 Comments
    Discussion (7)6
    Log in or sign up to continue