Skip to content

Commit 9180417

Browse files
author
sam
committed
Tidy
1 parent c1c11f5 commit 9180417

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Readme.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# connect4 scala
22
Connect4 in Scala! For interviewing people who know some scala.
3-
3+
4+
## Playing
5+
```bash
6+
> sbt run
7+
```
8+
9+
## Run the tests
10+
```bash
11+
> sbt test
12+
```
413

514
## User Requirements
615

src/main/scala/connect4/GameRunner.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package connect4
22

3-
import cats.effect.{ExitCode, IO, IOApp}
3+
import cats.effect.{IO, IOApp}
44
import cats.syntax.all._
55

66
import scala.io.StdIn
@@ -20,7 +20,7 @@ object GameRunner extends IOApp.Simple {
2020
def swapPlayer(p: Player): Player = if (p == p1) p2 else p1
2121

2222
def eval(command: String, board: Board, p: Player): IO[Unit] =
23-
if (command == null) IO.pure(ExitCode.Success) else dropCoin(board, p, command) match {
23+
if (command == null) IO.unit else dropCoin(board, p, command) match {
2424
case Left(err) => IO(println(s"Err: $err")) *> loop(board, p)
2525
case Right(b) if b.gameState == Playing => IO(println(b.draw())) *> loop(b, swapPlayer(p))
2626
case Right(b) => IO(println(s"Game finished as ${b.gameState} : \n${b.draw()}")) *> IO.unit

0 commit comments

Comments
 (0)