Advertisement
FNSY

Untitled

Apr 12th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. package signalFlowGraph;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class AnalyzeSFG {
  6.  
  7. private int[][] adjMatrix;
  8.  
  9. public static void main(String[] args) {
  10. AnalyzeSFG g = new AnalyzeSFG();
  11. g.inputs();
  12. }
  13.  
  14. private void inputs() {
  15. Scanner scan = new Scanner(System.in);
  16. System.out.print("Enter The Number Of Nodes : ");
  17. int NumOfNodes = scan.nextInt();
  18. adjMatrix = new int[NumOfNodes][NumOfNodes];
  19. System.out.println("To Get Out From Entering Signal Flow Graph Representation");
  20. System.out.println("Put From = 0 ");
  21. while (true) {
  22. int from, to, gain;
  23. System.out.print("From : ");
  24. from = scan.nextInt() - 1;
  25. if (from < 0) {
  26. break;
  27. }
  28. System.out.print("To : ");
  29. to = scan.nextInt() - 1;
  30. System.out.print("gain : ");
  31. gain = scan.nextInt();
  32. adjMatrix[to][from] = gain;
  33. }
  34. }
  35.  
  36. private void queen(int nextNodeInThePath) {
  37. if (nextNodeInThePath == 8)
  38. counter++;
  39.  
  40. for (int columnIndex = 0; columnIndex < 8; columnIndex++)
  41. if (canPut(nextNodeInThePath, columnIndex)) {
  42. addToForwardPath(nextNodeInThePath, columnIndex);
  43. queen(nextNodeInThePath + 1);
  44. removeFromForwardPath(nextNodeInThePath, columnIndex);
  45. // لو اللي بعدي ملقاش مكان يتحط فيه، شيلني وغير مكاني وكمل
  46. // او لو لقيت طريقة ناجحة وعايز ارجع عشان اشوف بقيت الطرق
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement