Top "Logic" questions

Logic refers to the ultimate flow of your code and how you arrive your desired solution.

int reverse sign negate( ) java

Requirements Assume the availability of an existing class, ICalculator, that models an integer arithmetic calculator and contains: an instance variable …

java methods logic negate
Test if string is not equal to either of two strings

I am just learning RoR so please bear with me. I am trying to write an if or statement with …

ruby if-statement logic
What can be the efficient approach to solve the 8 puzzle problem?

The 8-puzzle is a square board with 9 positions, filled by 8 numbered tiles and one gap. At any point, a tile …

algorithm logic puzzle a-star sliding-tile-puzzle
power function in prolog

What is wrong with my power function? pow(_,0,1). pow(X,Y,Z) :- pow(X,Y-1,X*Z). ?- pow(2,3,…

math prolog logic exponentiation
How to work out the complexity of the game 2048?

Edit: This question is not a duplicate of What is the optimal algorithm for the game 2048? That question asks 'what …

algorithm logic artificial-intelligence game-theory
What' s the difference between <= and := in VHDL

Currently, I am learning some FPGA design techniques using VHDL, my problem is whether we can use := and <= interchangeably …

embedded logic vhdl colon-equals
How do I determine if *exactly* one boolean is true, without type conversion?

Given an arbitrary list of booleans, what is the most elegant way of determining that exactly one of them is …

boolean logic
Why are products called minterms and sums called maxterms?

Do they have a reason for doing so? I mean, in the sum of minterms, you look for the terms …

boolean logic boolean-logic boolean-expression boolean-operations
Solving "Who owns the Zebra" programmatically?

Edit: this puzzle is also known as "Einstein's Riddle" The Who owns the Zebra (you can try the online version …

language-agnostic logic constraint-programming zebra-puzzle
4-bit adder-subtractor logic

I have almost successfully implemented n-bit adder-subtractor. It works fine, except for one thing. Carry after an unsigned subtraction doesn't …

logic vhdl addition subtraction