aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2020-05-26 16:44:36 +0000
committerrepl.it user2020-05-26 16:44:36 +0000
commit32f587fc675f1a8d684ee6f9616236a42b216647 (patch)
tree8af55cc64b63ff2e1c9b58bcb2150e5954150ecf
parent85068258a8708361977dfe2cbc320492c0ec8b96 (diff)
Latest version
-rw-r--r--.replit2
-rw-r--r--src/main.cpp9
2 files changed, 6 insertions, 5 deletions
diff --git a/.replit b/.replit
index d9ed16e..f17bb9b 100644
--- a/.replit
+++ b/.replit
@@ -1,2 +1,2 @@
language = "cpp"
-run = "g++ src/*.cpp -o compress -std=c++11; ./compress; rm compress" \ No newline at end of file
+run = "g++ src/*.cpp -o compress -std=c++11; ./compress" \ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index ce7c28b..dcc5bb7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -8,7 +8,8 @@ int getweight(string s)
{
if(s[0]=='$')
return 1000;
- else if(s=="farmer"||s.length()==1||s=="example")return 1;
+ else if(s=="farmer"||s.length()==1||s=="example"||s=="is"||s=="are")return 1;
+ else if(s=="one"||s=="two"||s=="three"||s=="four"||s=="five"||s=="six"||s=="seven"||s=="eight"||s=="nine")return 100;
else return 10;
}
struct clause
@@ -115,7 +116,7 @@ void init()
for(auto& i:text)i.parse();
}
int main() {
- /*init();
+ init();
for(sentence& i:text)
{
for(clause& j:i.clauses)
@@ -125,9 +126,9 @@ int main() {
cout<<k<<endl;
}
}
- }*/
+ }
- vector<bool> test = huffman::encode("asdfjkl;1234");
+ vector<bool> test = huffman::encode("A terrible new disease, COWVID-19, has begun to spread among cows worldwide. Farmer John is trying to take as many precautions as possible to protect his herd from infection.");
for (auto b : test) cout << b;
cout << '\n';
string s = huffman::decode(test);