Skip to content

"The repository '100 Mini Projects for Prolog' includes small projects for learning and practicing Prolog."

License

Notifications You must be signed in to change notification settings

jElhamm/100-Projects-for-Prolog

Repository files navigation

100 Project for Prolog

This repository is a comprehensive collection of diverse Prolog programming challenges designed to enhance your understanding and proficiency in Prolog. Whether you are a beginner looking to learn the basics of Prolog or an experienced programmer aiming to refine your skills, this repository provides a wealth of problems and projects to explore.

Table of Contents

1. Introduction

2. Installation

3. Project Categories

4. Usage

5. Contribution

6. License

Introduction

This repository is designed for those interested in learning Prolog by working through practical examples. Each project is self-contained and includes a clear description of the problem, the Prolog code to solve it, and instructions on how to run the code. Whether you are a beginner or an experienced developer, you will find valuable insights and challenges in these projects.

Installation

To get started with the projects in this repository, you will need to have Prolog installed on your machine.

Follow the steps below to set up your environment:

  1. Install SWI-Prolog:
  • Visit the SWI-Prolog website and download the installer for your operating system.
  • Follow the installation instructions provided on the website.
  1. Clone this repository:
   * git clone https://github.com/jElhamm/100-Projects-for-Prolog

   * cd 100-Projects-for-Prolog

๐Ÿ“š Project Categories

โž— Math Problems

1. Calculating Power

2. Calculating Factorial

3. Checking Prime Numbers

4. Find Factors of a Number N

5. Converting Binary to Decimal

6. Converting Decimal to Binary

7. Calculating Fibonacci Numbers

8. Generate Prime Numbers up to N

9. Calculate the Least Common Multiple (LCM)

10. Calculate the Greatest Common Divisor (GCD)

๐Ÿ•ธ๏ธ Graph Problems

11. Find and Count All Edges

12. Find Neighbors of a Node

13. Find and Count All Nodes

14. Checking Graph Homomorphism

15. Check if a Graph is Connected

16. Finding Minimum Spanning Tree

17. Find All Paths Between Two Nodes

18. Convert a Directed Graph to an Undirected

๐Ÿ“‹ List Operations

19. Reverse

20. Find Max

21. Find Min

22. Sum List

23. Is Sorted

24. List Length

25. Add Element

26. Check Equality

27. Append Two Lists

28. Average Elements

29. Check Membership

30. Sublist Predicate

31. Remove Duplicates

32. Intersect Two Lists

33. Convert List to Set

34. Even Sum Calculator

35. Split List Predicate

36. Nth Element Retrieval

37. Rotate List to the Left

38. Rotate List to the Right

39. Find Second Largest Element

40. Delete Occurrences Elements

41. Find Second Smallest Element

42. Longest Sublist with No Duplicates

๐Ÿงฎ Matrix Problems

43. Matrix Trace

44. Identity Matrix

45. Matrix Addition

46. Transpose Matrix

47. Matrix Inversion

48. Matrix Dimensions

49. Sum of Odd Elements

50. Check Square Matrix

51. Calculating The Trace

52. Finding Even Elements

53. Matrix Multiplication

54. Check Symmetric Matrix

55. Largest Element in Matrix

56. List to Matrix Conversion

57. Matrix to List Conversion

58. Smallest Element in Matrix

59. Sum of Odd Numbers in Each Row

60. Sum of Even Numbers in Each Column

๐ŸŒ String Operations

61. Reversing String

62. Replacing a Character

63. Find the Largest Word

64. Find the Smallest Word

65. Convert String to List

66. Finding All Subsequences

67. Find the Last Occurrence

68. Concatenating Two Strings

69. Find the First Occurrence

70. Extract Numbers from String

71. Check Two Strings are Equal

72. Counting the Number of Words

73. Convert a List of Characters

74. Removing Duplicate Characters

75. Checking String is Palindrome

76. Finding the Length of a String

77. Counting Characters in a String

78. Converting Lowercase Letters to Uppercase

79. Converting Uppercase Letters to Lowercase

โœ๏ธ Graph Path Finder

80. GraphPathFinder

๐Ÿ”„ Sorting Algorithms

81. Shell Sort

82. Quick Sort

83. Merge Sort

84. Bubble Sort

85. Insertion Sort

86. Selection Sort

๐Ÿ” Searching Algorithms

87. Binary Search

88. Linear Search

89. Detect Cycles in a Directed

90. Find the K-th Smallest Element

91. Find the Last Duplicate Element

92. Find the First Duplicate Element

๐Ÿ“ˆ Statistics And Probability

93. Calculate Mean

94. Calculate Mode

95. Calculate Range

96. Calculate Median

97. Calculate Variance

98. Dice Roll Simulation

99. Coin Toss Simulation

100. Calculate Standard Deviation

Usage

Each project is contained within its respective folder. To run a project, follow these steps:

  1. Navigate to the project folder:
cd Project-Name
  • For example, to navigate to the project for calculating the mean:
cd Statistics_and_Probability/Calculate_Mean
  1. Open the Prolog file in SWI-Prolog:
swipl project_name.pl
  • For example:
swipl mean.pl
  1. Follow the instructions in the project file to execute the code.

Contributing

  • Please fork the repository, make your changes, and submit a pull request.
  • Ensure your code adheres to the existing style and includes relevant tests.
  • For detailed guidelines, check the project's issues or discussions.

License

This repository is licensed under the MIT License.

See the LICENSE file for more details.