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

  • SEARCH
  • Home
  • 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 8935855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:05:12+00:00 2026-06-15T10:05:12+00:00

walls(This) :- append(This, NewMap), length(NewMap, N), numWalls(NewMap, W), W >= N/10. numWalls([], _, 0).

  • 0
walls(This) :- 
    append(This, NewMap),
    length(NewMap, N),
    numWalls(NewMap, W),
    W >= N/10.

numWalls([], _, 0).
numWalls('w'|Tail, W) :-
    W is W1 + 1,
    numWalls(Tail, W1).
numWalls(_|Tail, W):-
    numWalls(Tail, W).

I comment out line by line and get false until i take out the numWalls(NewMap,W), line. The append flattens a 2-dimensional array and length returns the proper length of the flattened map. We need to count how many times a ‘w’ appears in the list of lists and if more than 10% of the list is ‘w’ return True.


walls(Maps) :- 
    append(Maps, NewMap),
    length(NewMap, N),
    print(NewMap),
    numWalls(NewMap, W),
    print(W) .

numWalls([], 0).
numWalls(['w'|Tail], W) :-
    numWalls(Tail, W1),
    W1 is W-1.
numWalls([_|Tail], W):-
    numWalls(Tail, W).

“ERROR: is/2: Arguments are not sufficiently instantiated”
Looks like the error is with my is statement?

  • 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-15T10:05:13+00:00Added an answer on June 15, 2026 at 10:05 am

    It looks like you are missing some square brackets. Other than that minor syntax issue, your program logic is fine:

    numWalls([], 0).
    numWalls(['w'|Tail], W) :-
        numWalls(Tail, W1),
        W is W1 + 1.
    numWalls([H|Tail], W):-
        H \= (w),
        numWalls(Tail, W).
    

    EDIT: As false commented, the second rule needs to change against consuming a w by mistake, to avoid numWalls([w,w], 0). from succeeding.

    Link to a demo on ideone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sure this is relatively simple, I just keep running into brick walls.
I've been beating my head against the wall trying to get this to work,
I have got a ball which bounces of walls. This bounce is simple, i
I have this SConstruct file: env=Environment() env.Append(CCFLAGS = ['-std=c99', '-Wall', '-Wextra', '-g']) print env[CCFLAGS]
I've been banging my head on walls trying to solve this. My app uses
I have this issue with Box2D physics where objects will tunnel through walls if
with this problem I am beating my head with walls, please help. I have
This is the weirdest thing I've ever encountered in my programming life. self.walls =
In the following jQuery code: $(document).ready(function(){ function parse(document){ $(document).find(entry).each(function(){ $(#items).append( '<h3><a href=#>'+$(this).find('title').text()+'</a></h3>'+ '<div> '+$(this).find('summary').text()+'</div>'
Im trying to get this extra credit exercise done for LPTHW and I've hit

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.