diff --git a/dbdump.sql b/dbdump.sql index 1324873..b0feac5 100644 --- a/dbdump.sql +++ b/dbdump.sql @@ -15,6 +15,33 @@ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-- +-- Table structure for table `maze_scores` +-- + +DROP TABLE IF EXISTS `maze_scores`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `maze_scores` ( + `gamerid` char(4) NOT NULL, + `highscore` int(11) DEFAULT NULL, + `lastscore` int(11) DEFAULT NULL, + `lastplayed` date DEFAULT NULL, + `timesplayed` int(11) DEFAULT NULL, + PRIMARY KEY (`gamerid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `maze_scores` +-- + +LOCK TABLES `maze_scores` WRITE; +/*!40000 ALTER TABLE `maze_scores` DISABLE KEYS */; +INSERT INTO `maze_scores` VALUES ('3CD5',3596,3156,'2022-11-24',7),('4DE6',3045,3045,'2022-11-28',2),('QU60',2954,2531,'2022-11-30',3); +/*!40000 ALTER TABLE `maze_scores` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `player_details` -- @@ -37,20 +64,21 @@ CREATE TABLE `player_details` ( LOCK TABLES `player_details` WRITE; /*!40000 ALTER TABLE `player_details` DISABLE KEYS */; -INSERT INTO `player_details` VALUES ('1AB3','ABC_123','abc@gmail.com','Q0FCXzMyMQ=='),('2BC4','DEF_456','def@gmail.com','RkVEXzY1NA=='),('3CD5','GHI_789','mb8717@boysmgp.onmicrosoft.com','SUhHXzk4Nw=='),('4DE6','JKL_100','mb11859@boysmgp.onmicrosoft.com','TEtKXzAwMQ=='); +INSERT INTO `player_details` VALUES ('2BC4','DEF_456','def@gmail.com','RkVEXzY1NA=='),('4DE6','JKL_100','mb11859@boysmgp.onmicrosoft.com','TEtKXzAwMQ=='),('QU60','ABC_123','testuser1@gmail.com','Q2JhXzMyMQ=='); /*!40000 ALTER TABLE `player_details` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `scores` +-- Table structure for table `pong_scores` -- -DROP TABLE IF EXISTS `scores`; +DROP TABLE IF EXISTS `pong_scores`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `scores` ( +CREATE TABLE `pong_scores` ( `gamerid` char(4) NOT NULL, `highscore` int(11) DEFAULT NULL, + `lastscore` int(11) DEFAULT NULL, `lastplayed` date DEFAULT NULL, `timesplayed` int(11) DEFAULT NULL, PRIMARY KEY (`gamerid`) @@ -58,13 +86,67 @@ CREATE TABLE `scores` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `scores` +-- Dumping data for table `pong_scores` -- -LOCK TABLES `scores` WRITE; -/*!40000 ALTER TABLE `scores` DISABLE KEYS */; -INSERT INTO `scores` VALUES ('1AB3',85012,'2022-11-02',3),('2BC4',90012,'2022-11-12',2),('4DE6',90120,'2022-10-24',5); -/*!40000 ALTER TABLE `scores` ENABLE KEYS */; +LOCK TABLES `pong_scores` WRITE; +/*!40000 ALTER TABLE `pong_scores` DISABLE KEYS */; +INSERT INTO `pong_scores` VALUES ('1AB3',13,10,'2022-11-26',3),('2BC4',110,60,'2022-11-12',23),('4DE6',70,70,'2022-11-21',12),('QU60',30,20,'2022-11-30',2); +/*!40000 ALTER TABLE `pong_scores` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `snake_scores` +-- + +DROP TABLE IF EXISTS `snake_scores`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `snake_scores` ( + `gamerid` char(4) NOT NULL, + `highscore` int(11) DEFAULT NULL, + `lastscore` int(11) DEFAULT NULL, + `lastplayed` date DEFAULT NULL, + `timesplayed` int(11) DEFAULT NULL, + PRIMARY KEY (`gamerid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `snake_scores` +-- + +LOCK TABLES `snake_scores` WRITE; +/*!40000 ALTER TABLE `snake_scores` DISABLE KEYS */; +INSERT INTO `snake_scores` VALUES ('1AB3',2,2,'2022-11-26',1),('4DE6',3,2,'2022-11-23',2),('QU60',6,6,'2022-11-01',7); +/*!40000 ALTER TABLE `snake_scores` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `wordle_scores` +-- + +DROP TABLE IF EXISTS `wordle_scores`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `wordle_scores` ( + `gamerid` char(4) NOT NULL, + `highscore` int(11) DEFAULT NULL, + `lastscore` int(11) DEFAULT NULL, + `lastplayed` date DEFAULT NULL, + `timesplayed` int(11) DEFAULT NULL, + PRIMARY KEY (`gamerid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `wordle_scores` +-- + +LOCK TABLES `wordle_scores` WRITE; +/*!40000 ALTER TABLE `wordle_scores` DISABLE KEYS */; +INSERT INTO `wordle_scores` VALUES ('1AB3',50,50,'2022-11-28',1),('3CD5',30,30,'2022-11-21',6),('4DE6',40,50,'2022-11-24',12); +/*!40000 ALTER TABLE `wordle_scores` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -76,4 +158,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-11-17 18:35:12 +-- Dump completed on 2022-12-01 7:17:50 diff --git a/wordle/wordle.py b/wordle/wordle.py index 8769758..3991ac0 100644 --- a/wordle/wordle.py +++ b/wordle/wordle.py @@ -90,16 +90,19 @@ def getWord(s, y): while True: writeWord(s, word, "u" * len(word), y) # u = default blue colour k = s.getch() - if k == 8: # backspace - word = word[:-1] - elif k == 27: # esc - global quitwordle - quitwordle = True - return "hello" - elif chr(k) == "\n" and len(word) == 5: - return word - elif chr(k).isalpha() and len(word) < 5: - word += chr(k) + try: + if k == 8: # backspace + word = word[:-1] + elif k == 27: # esc + global quitwordle + quitwordle = True + return "hello" + elif chr(k) == "\n" and len(word) == 5: + return word + elif chr(k).isalpha() and len(word) < 5: + word += chr(k) + except: + pass # Run one game of Wordle