diff --git a/src/main/scala/ScalaGo/REPL.scala b/src/main/scala/ScalaGo/REPL.scala index 23b2191..a5e746c 100644 --- a/src/main/scala/ScalaGo/REPL.scala +++ b/src/main/scala/ScalaGo/REPL.scala @@ -18,6 +18,7 @@ object REPL: def repl(endState: GameState): Unit = while gs != endState do + ??? /** diff --git a/src/main/scala/ScalaGo/SimpleList.scala b/src/main/scala/ScalaGo/SimpleList.scala index 25acc7b..0236a4c 100644 --- a/src/main/scala/ScalaGo/SimpleList.scala +++ b/src/main/scala/ScalaGo/SimpleList.scala @@ -17,7 +17,10 @@ object SimpleList: * @param list the list * @param item append this item */ - def append[A](list: SimpleList[A], item: A): Unit = ??? + def append[A](list: SimpleList[A], item: A): Unit = { + var l = SimpleList(item, list) + return l + } /** * Determines the length of the SimpleList. @@ -25,7 +28,15 @@ object SimpleList: * @param list the list * @return the length */ - def length[A](list: SimpleList[A]): Int = ??? + def length[A](list: SimpleList[A]): Int = { + var l = list + var counter: Int = 0 + while l != null do { + counter = counter + 1 + l = l.next + } + return counter + } /** * Tests if the SimpleList contains a given element. @@ -36,4 +47,13 @@ object SimpleList: * @param item search for this item * @return true if the SimpleList contains the item, false if not */ - def contains[A](list: SimpleList[A], item: A): Boolean = ??? + def contains[A](list: SimpleList[A], item: A): Boolean = { + var l = list + while l != null do { + if (l.entry == item) then { + return true + } + l = l.next + } + return false + }