Skip to content
Open

Pooh #35

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions chatter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
A016F8D41CCE76A80039184B /* Nathan.swift in Sources */ = {isa = PBXBuildFile; fileRef = A016F8D31CCE76A80039184B /* Nathan.swift */; };
A2AB56621CD35B40006999FD /* Homer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2AB56611CD35B40006999FD /* Homer.swift */; };
BF5A90431CD6C5A00033DBD8 /* Batman.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5A90421CD6C5A00033DBD8 /* Batman.swift */; };
C27C6D9E1E9CCEF100379A2D /* Pooh.swift in Sources */ = {isa = PBXBuildFile; fileRef = C27C6D9D1E9CCEF100379A2D /* Pooh.swift */; };
DC161D081CD60CE7001ADBC4 /* Seneca.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC161D071CD60CE7001ADBC4 /* Seneca.swift */; };
E9DD170D1CD6C2DA004F614F /* MagicConchShell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9DD170C1CD6C2DA004F614F /* MagicConchShell.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -66,6 +67,7 @@
A016F8D31CCE76A80039184B /* Nathan.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Nathan.swift; sourceTree = "<group>"; };
A2AB56611CD35B40006999FD /* Homer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Homer.swift; sourceTree = "<group>"; };
BF5A90421CD6C5A00033DBD8 /* Batman.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Batman.swift; sourceTree = "<group>"; };
C27C6D9D1E9CCEF100379A2D /* Pooh.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pooh.swift; sourceTree = "<group>"; };
DC161D071CD60CE7001ADBC4 /* Seneca.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Seneca.swift; sourceTree = "<group>"; };
E9DD170C1CD6C2DA004F614F /* MagicConchShell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MagicConchShell.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -174,6 +176,7 @@
3284A1351CD3FD4500A5DD4F /* Minion.swift */,
3284A13B1CD4010200A5DD4F /* Barney.swift */,
79A8A7621CD0072100C7A040 /* Sherlock.swift */,
C27C6D9D1E9CCEF100379A2D /* Pooh.swift */,
77989E491CCFDB0F00AB13A3 /* Hodor.swift */,
7730A5311CD6614B0064B499 /* Redneck.swift */,
7730A5331CD668D10064B499 /* Trump.swift */,
Expand Down Expand Up @@ -268,6 +271,7 @@
87468FD71CCD3B3500DB4A03 /* Chatter.swift in Sources */,
A016F8D41CCE76A80039184B /* Nathan.swift in Sources */,
DC161D081CD60CE7001ADBC4 /* Seneca.swift in Sources */,
C27C6D9E1E9CCEF100379A2D /* Pooh.swift in Sources */,
1716AF9F1CCE8A7600264EBE /* Obama.swift in Sources */,
879EC5471AF29DD600F36F1C /* ChatViewController.swift in Sources */,
E9DD170D1CD6C2DA004F614F /* MagicConchShell.swift in Sources */,
Expand Down
21 changes: 21 additions & 0 deletions chatter/Images.xcassets/pooh.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "pooh.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file added chatter/Images.xcassets/pooh.imageset/pooh.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions chatter/Pooh.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// Pooh.swift
// chatter
//
// Created by Katja D on 11.04.17.
// Copyright © 2017 Universität Heidelberg. All rights reserved.
//

import Foundation
import UIKit

class Pooh: Chatter {

required init() {
super.init(image: UIImage(named: "pooh"))
}

override func nextMessage() -> Message {
return [
Message(content: "What day is today?", type: .statement),
Message(content: "What day is tomorrow?", type: .questionWhy),
Message(content: "Are we going out tonight?", type: .questionBool),
Message(content: "Is Piglet my best friend?", type: .joke),
].randomElement()
}

override func responseForMessage(_ message: Message) -> Message {
switch message.type {
case .statement:
return [
Message(content: "My favorite day", type: .statement),
].randomElement()
case .questionBool:
return [
Message(content: "I think so.", type: .statement),
Message(content: "Not at all.", type: .statement),
Message(content: "Precisely.", type: .statement),
].randomElement()
case .questionWhy:
return [
Message(content: "Monday.", type: .statement),
Message(content: "Tuesday.", type: .statement),
Message(content: "Wednesday.", type: .statement)
].randomElement()
case .joke:
return [
Message(content: "Yes", type: .questionBool),
Message(content: "I nearly had to laugh", type: .statement)
].randomElement()
}
}


}