Advertisement
fr1sk

Untitled

Jun 15th, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. stepenice(X) :- X = [A,B,C,D,E,F,G,H,I],
  2. X :: 1..9,
  3. alldifferent(X),
  4. A + B + C #= 15,
  5. D + E + F #= 15,
  6. G + H + I #= 15,
  7. A + D + G #= 15,
  8. B + E + H #= 15,
  9. C + F + I #= 15,
  10. labeling(X),
  11. ispisi(X), !.
  12.  
  13.  
  14.  
  15.  
  16. ispisi([A,B,C,D,E,F,G,H,I]) :-
  17. nl,
  18. write(A),write(' '),write(B),write(' '),write(C), nl, write(' '),
  19. write(D),write(' '),write(E),write(' '),write(F), nl, write(' '),
  20. write(G),write(' '),write(H),write(' '),write(I),
  21. nl,nl.
  22.  
  23. /*
  24. # labeling moze da ima prvi argument maximize ili minimize
  25. # fail umesto ! stampa sva resenja odjednom
  26. stepenice(X) :- X = [A,B,C,D,E,F,G,H,I],
  27. X :: 1..9,
  28. alldifferent(X).
  29. */
  30.  
  31.  
  32.  
  33. ============
  34.  
  35.  
  36.  
  37. clan(X, [X|_]).
  38. clan(X, [G|R]) :- clan(X, R).
  39.  
  40. pored(X, Y, [X,Y|_]).
  41. pored(X, Y, [Y,X|_]).
  42. pored(X, Y, [_|R]) :- pored(X, Y, R).
  43.  
  44. desno(X, Y, [Y, X|_]).
  45. desno(X, Y, [_|R]) :- desno(X,Y,R).
  46.  
  47. /* nacionalnost, boja, pice, jelo, zivotinja */
  48.  
  49. kuce(L) :- L = [d(norvezanin,_,_,_,_), d(,plava,,_,_), d(,,mleko,_,_), d(,,_,_,_), d(,,_,_,_)],
  50. clan(d(englez, crvena, _, _, _), L),
  51. clan(d(spanac, _, _, _, pas), L),
  52. clan(d(ukrajinac, _, caj, _, _), L),
  53. clan(d(_, _, _, spagete, puz), L),
  54. clan(d(_, _, narandza, brokoli, _), L),
  55. clan(d(japanac, _, _, susi, _), L),
  56. clan(d(_, _, _, _, zebra), L),
  57. clan(d(_, _, voda, _, _), L),
  58. desno(d(,zelena,kafa,,_), d(,bela,,_,_), L),
  59. pored(d(,,_,piletina,_), d(,,_,_,lisica), L),
  60. pored(d(,zuta,,pica,_), d(,,_,_,konj), L).
  61.  
  62. zagonetka(X,Y) :- kuce(L), clan(d(X, _, _, _, zebra), L), clan(d(Y, _, voda, _, _), L).
  63.  
  64.  
  65.  
  66.  
  67. ======
  68.  
  69.  
  70.  
  71. zposleni !!!
  72. import org.apache.spark.rdd.RDD._
  73. import org.apache.spark.{SparkConf, SparkContext}
  74.  
  75. object Main {
  76. def main(args: Array[String]): Unit = {
  77. val konf = new SparkConf()
  78. .setAppName("Test")
  79. .setMaster("local[*]")
  80.  
  81. val sk = new SparkContext(konf)
  82.  
  83. val plate = sk.textFile("zaposleni.txt")
  84. .map(linija => {
  85. val niz = linija.split(" ")
  86. (niz(6), niz(7).toFloat)
  87. }).groupByKey()
  88. .map(el => {
  89. val suma = el._2.sum
  90. (el._1, suma / el._2.size)
  91. })
  92.  
  93. println("plate:")
  94. plate.foreach(e => {
  95. println(e._1, e._2)
  96. })
  97.  
  98.  
  99. sk.stop()
  100. }
  101.  
  102. }
  103.  
  104.  
  105. =======
  106.  
  107. <?xml version="1.0" encoding="UTF-8"?>
  108.  
  109. <?import javafx.scene.control.Button?>
  110. <?import javafx.scene.layout.AnchorPane?>
  111.  
  112.  
  113. <AnchorPane fx:controller="Gui2" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1">
  114. <children>
  115. <Button mnemonicParsing="false" text="Button" fx:id="btn" onAction="#zurka" />
  116. </children>
  117. </AnchorPane>
  118.  
  119.  
  120. import java.net.URL
  121. import java.util.ResourceBundle
  122. import javafx.fxml.{FXML, Initializable}
  123. import javafx.scene.control.Button
  124.  
  125. import javafx.event.ActionEvent
  126.  
  127. /**
  128. * Created by fr1sk on 6/15/18.
  129. */
  130. class Gui2 extends Initializable{
  131. @FXML private var btn : Button = _
  132.  
  133. @FXML
  134. def zurka(event: ActionEvent): Unit = {
  135. println("GG")
  136.  
  137. }
  138.  
  139. override def initialize(location: URL, resources: ResourceBundle): Unit = {}
  140. }
  141.  
  142.  
  143.  
  144. import java.io.IOException
  145. import javafx.fxml.FXMLLoader
  146.  
  147.  
  148. import scalafx.Includes._
  149. import scalafx.application.JFXApp.PrimaryStage
  150. import scalafx.application.JFXApp
  151.  
  152. import javafx.scene.{Parent, Scene}
  153.  
  154. /**
  155. * Created by fr1sk on 6/15/18.
  156. */
  157. object Main2 extends JFXApp {
  158. var resource = getClass.getResource("Gui2.fxml")
  159. if (resource == null) {
  160. throw new IOException("FAIL")
  161. }
  162. val root: Parent = FXMLLoader.load(resource)
  163. stage = new PrimaryStage {
  164. title = "Burger"
  165. scene = new Scene(root)
  166. }
  167.  
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement