Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Oettinger (unfinished) and add mood and friendliness of message #26

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
11 changes: 11 additions & 0 deletions chatter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
9DCCE6CD1CD3457F0074771D /* Sheldon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DCCE6CC1CD3457F0074771D /* Sheldon.swift */; };
A016F8D41CCE76A80039184B /* Nathan.swift in Sources */ = {isa = PBXBuildFile; fileRef = A016F8D31CCE76A80039184B /* Nathan.swift */; };
A2AB56621CD35B40006999FD /* Homer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2AB56611CD35B40006999FD /* Homer.swift */; };
A3B00DEB1CD55CBE00B7117A /* Oettinger.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3B00DEA1CD55CBE00B7117A /* Oettinger.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -52,6 +53,7 @@
9DCCE6CC1CD3457F0074771D /* Sheldon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sheldon.swift; sourceTree = "<group>"; };
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>"; };
A3B00DEA1CD55CBE00B7117A /* Oettinger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Oettinger.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -154,6 +156,7 @@
9DCCE6CC1CD3457F0074771D /* Sheldon.swift */,
9D20C8091CD3BE9400C54F73 /* StarTrek.swift */,
A2AB56611CD35B40006999FD /* Homer.swift */,
A3B00DEA1CD55CBE00B7117A /* Oettinger.swift */,
3284A1351CD3FD4500A5DD4F /* Minion.swift */,
3284A13B1CD4010200A5DD4F /* Barney.swift */,
79A8A7621CD0072100C7A040 /* Sherlock.swift */,
Expand Down Expand Up @@ -192,6 +195,11 @@
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = "Universität Heidelberg";
TargetAttributes = {
8739C1B8191C1203009C7B3B = {
DevelopmentTeam = 57G2ZY49JR;
};
};
};
buildConfigurationList = 8739C1B4191C1203009C7B3B /* Build configuration list for PBXProject "chatter" */;
compatibilityVersion = "Xcode 3.2";
Expand Down Expand Up @@ -232,6 +240,7 @@
879EC5111AF2952E00F36F1C /* AppDelegate.swift in Sources */,
9D20C80A1CD3BE9400C54F73 /* StarTrek.swift in Sources */,
A2AB56621CD35B40006999FD /* Homer.swift in Sources */,
A3B00DEB1CD55CBE00B7117A /* Oettinger.swift in Sources */,
87468FD71CCD3B3500DB4A03 /* Chatter.swift in Sources */,
A016F8D41CCE76A80039184B /* Nathan.swift in Sources */,
1716AF9F1CCE8A7600264EBE /* Obama.swift in Sources */,
Expand Down Expand Up @@ -323,6 +332,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
INFOPLIST_FILE = "chatter/chatter-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = nikolai.krischkegmail.com;
PRODUCT_BUNDLE_IDENTIFIER = "de.uni-hd.chatter.cotchere";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
Expand All @@ -339,6 +349,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
INFOPLIST_FILE = "chatter/chatter-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = nikolai.krischkegmail.com;
PRODUCT_BUNDLE_IDENTIFIER = "de.uni-hd.chatter.cotchere";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
Expand Down
25 changes: 25 additions & 0 deletions chatter/Chatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class Chatter {
return NSStringFromClass(self.dynamicType).componentsSeparatedByString(".").last!
}

var mood: Int = 0


// MARK: Chatting

Expand Down Expand Up @@ -77,6 +79,9 @@ class Chatter {
- returns: A chat message that is a contextual correct response to the given message.
*/
func responseForMessage(message: Message) -> Message {



switch message.type {
case .Statement:
return [
Expand Down Expand Up @@ -116,6 +121,12 @@ class Chatter {
].randomElement()
}
}
func changeMood(message: Message) -> Int {

// last message influences on mood (in case values are set)
mood = mood + (message.friendliness)!
return mood
}

}

Expand Down Expand Up @@ -162,10 +173,24 @@ struct Message: CustomStringConvertible {
case Statement, Joke, QuestionBool, QuestionWhy
}

/// let friendliness of message influence the mood of the chatter
var friendliness: Int?

var description: String {
return content
}

init(content: String, type: MessageType) {
self.content = content
self.type = type
}

init(content: String, type: MessageType, friendliness: Int?) {
self.content = content
self.type = type
self.friendliness = friendliness
}

}


Expand Down
21 changes: 21 additions & 0 deletions chatter/Images.xcassets/oettinger.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "media.imagefile.ba63014e-9421-4c89-962a-eaa643639d0c.normalized.media.jpeg",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions chatter/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="3lD-4H-TDs">
<rect key="frame" x="0.0" y="0.0" width="600" height="542"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="leftChatBubble" id="p9c-j7-zcx" customClass="ChatBubbleCell" customModule="chatter" customModuleProvider="target">
<rect key="frame" x="0.0" y="22" width="600" height="44"/>
Expand All @@ -167,7 +167,7 @@
<constraint firstAttribute="trailing" secondItem="MaX-GS-2Mi" secondAttribute="trailing" constant="50" id="XoY-7x-HsS"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<outlet property="textView" destination="MaX-GS-2Mi" id="9TZ-Bw-ZOC"/>
</connections>
Expand Down
50 changes: 50 additions & 0 deletions chatter/Oettinger.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// Oettinger.swift
// chatter
//
// Created by Nikolai Krischke on 30.04.16.
// Copyright © 2016 Universität Heidelberg. All rights reserved.
//

import Foundation
import UIKit

class Oettinger: Chatter {


required init(){
super.init(image: UIImage(named: "oettinger"))
// set initial mood of oettinger to 2 because he looks funny
self.mood = 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

}


override func nextMessage() -> Message {
return [
Message(content: "That makes me so quickly nobody after!", type: .Statement),
Message(content: "Mood is \(mood)", type: .Statement),
Message(content: "Two rasins meet each oser, says one to se oser: Why have you got a headlight? Because I have to go into se stollen!", type: .Joke)
].randomElement()
}
override func responseForMessage(message: Message) -> Message {
switch message.type{
case .Statement:
return [
Message(content: "If you want to enjoy life in full trains, you have to travel wis Deutsche Bahn.", type: .Statement, friendliness: 0)
].randomElement()
case .QuestionBool:
return [
Message(content: "Ladies and Gentlemen, sree hours of constructive questions and in a good atmosphere. I sink se comitee was very competent.", type: .QuestionBool, friendliness: -2)
].randomElement()
case .QuestionWhy:
return [
Message(content: "I'm not happy aber glücklich", type: .Statement, friendliness: 1),
Message(content: "Evrybody does as he pleases", type: .Statement, friendliness: 2)
].randomElement()
case .Joke:
return [
Message(content: "Ahaha. Sat was funny.", type: .Statement)
].randomElement()
}
}
}
9 changes: 9 additions & 0 deletions chatter/Trump.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// Trump.swift
// chatter
//
// Created by Lucas-Raphael Müller on 29.04.16.
// Copyright © 2016 Universität Heidelberg. All rights reserved.
//

import Foundation