Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9136633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:58:42+00:00 2026-06-17T08:58:42+00:00

In prolog I have do to something like this: ************************ * * * ##########

  • 0

In prolog I have do to something like this:

    ************************
    *                      *
    *      ##########      *
    *      # button #      *
    *      ##########      *
    *                      *
    ************************

User gives the width and height of window (created with *), and coordinates, width, height and text of button (created by #). This “window” is written in prolog console. I don’t have trouble with writing the window itself but I don’t know how to do it with something in it. Can anyone help me, I don’t mean writing it for me, but even small guidenes will be helpfull.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:58:43+00:00Added an answer on June 17, 2026 at 8:58 am

    Write it with the help of a DCG as a clean grammar.

    Here is a start. More details, here.

    :- use_module(library(double_quotes)).
    :- set_prolog_flag(double_quotes,chars).
    
    newline --> "\n".
    
    pre --> "# ".
    
    post --> " #".
    
    button -->
       pre,
       "button",
       post.
    

    Now you can query it on the toplevel:

    ?- phrase(button, Xs).
       Xs = "# button #".
    

    And you can print it out directly:

    ?- phrase(button, Xs), atom_chars(A, Xs), write(A).
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a prolog homework, which should work like this: singles([1,2,3,2,2,4,1], [3,4]). true Now
i have a prolog list like this: [p(X,Y,Z),r(H,G,K)] and i want convert it into
I have something like this in my knowledge base: number(1). number(3). number(6). number(8). number(9).
Assume that we have prolog knowledge base like this: guilty(X) :- commits(X,Y), crime(Y). crime(murder).
I have a sictus prolog file (.pl-file) that I would like to export as
I have the following Prolog definite clause grammar: s-->[a],s,[b]. s-->[]. This will result in
I have written a lexer and a parser in Prolog. It unifies a string
I have this code in Prolog: dynamic(player_at/1). player_at(house). goto(X) :- retract(player_at(house)), assert(player_at(X)). But I
I have this prolog predicate that computes the number of primes depending on the
I want to know how I would get something like this to work. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.