CoolFace
Modelpublic

narySt/codeT5p_CommitMessageGen

sourceHugging Facemitupdated 2y agoView on Hugging Face
0likes29downloads
README.md123 linesDownload Raw Back to root
1---2license: mit3language:4- en5---6 7CodeT5+ model Fine-Tuned to the commit messages generation task.8 9### Example of usage via HF api:10Paste into the text field code modifications in the given commit. For example:11```Haskell12Filename: src/Game.hs13Status: modified14Additions: 2115Deletions: 816Total changes: 2917Code changes:18@@ -24,7 +24,8 @@ data Man =19     , speedY :: Float20     , posX   :: Float21     , posY   :: Float22-    } deriving (Show)23+    }24+  deriving (Show)25 26 -- We need to store game state27 data Game =28@@ -51,6 +52,9 @@ windowSizeY = 70029 manSize :: Float30 manSize = 1631 32+topGrassSize :: Float33+topGrassSize = 2234+35 grassSize :: Float36 grassSize = 15037 38@@ -61,7 +65,7 @@ skyWidth :: Float39 skyWidth = 204840 41 bottomBorder :: Float42-bottomBorder = - windowSizeY / 2 + grassSize43+bottomBorder = -windowSizeY / 2 + grassSize44 45 obstacleWidth :: Float46 obstacleWidth = 3047@@ -70,7 +74,7 @@ obstacleHeight :: Float48 obstacleHeight = 10049 50 obstacleY :: Float51-obstacleY = bottomBorder + obstacleHeight / 2 - 22 -- | 22 accounts for top-most layer of grass52+obstacleY = bottomBorder + obstacleHeight / 2 - topGrassSize -- | 22 accounts for top-most layer of grass53 54 obstaclePic :: Picture55 obstaclePic = color red $ rectangleSolid obstacleWidth obstacleHeight56@@ -82,7 +86,7 @@ initTranslateGrassX :: Float57 initTranslateGrassX = grassWidth / 2 - windowSizeX / 2 -- starting from the left border of the picture58 59 initTranslateGrassY :: Float60-initTranslateGrassY = - windowSizeY / 2 + grassSize / 261+initTranslateGrassY = -windowSizeY / 2 + grassSize / 262 63 initTranslateSky :: Float64 initTranslateSky = skyWidth / 2 - windowSizeX / 2 -- starting from the left border of the picture65@@ -99,10 +103,14 @@ getSprite name = "sprites/" ++ name ++ ".bmp"66 -- manPic :: Picture67 manPic :: Picture68 manPic = unsafePerformIO . loadBMP . getSprite $ "man"69--- manPic = color black $ rectangleSolid manSize manSize70 71+-- manPic = color black $ rectangleSolid manSize manSize72 grassPic :: Picture73-grassPic = translate 0 initTranslateGrassY (unsafePerformIO . loadBMP . getSprite $ "grass")74+grassPic =75+  translate76+    077+    initTranslateGrassY78+    (unsafePerformIO . loadBMP . getSprite $ "grass")79 80 skyPic :: Picture81 skyPic = unsafePerformIO . loadBMP . getSprite $ "sky"82@@ -152,14 +160,18 @@ checkCrush game =83       obstaclePosX = head (obstacles game) + obstaclesTranslation game84    in (playerPosX + manSize / 2) >= (obstaclePosX - obstacleWidth / 2) &&85       playerPosX <= (obstaclePosX + obstacleWidth / 2) &&86-      playerPosY <= (obstacleY + obstacleHeight - 22) -- | See obstacleY to understand what 22 is87+      playerPosY <= (obstacleY + obstacleHeight / 2 + topGrassSize)88 89 updateGameSate :: Game -> GameState90 updateGameSate game91   | gameState game == Over = Over92   | checkCrush game = Over93   | otherwise = gameState game94 95+96+accelerate :: Float97+accelerate = 0.00198+99 updateGame :: Float -> Game -> Game100 updateGame seconds game =101   game102@@ -169,6 +181,7 @@ updateGame seconds game =103     , obstacles = nextObstacles104     , obstaclesTranslation = nextObstaclesTranslation105     , gameState = updateGameSate game106+    , gameSpeed = gameSpeed game + accelerate107     }108   where109     nextManPosY110@@ -185,7 +198,7 @@ updateGame seconds game =111       | otherwise = backgrounds game112     nextObstaclesTranslation113       | obstaclesTranslation game <114-          -windowSizeX / 2 - 100 - head (obstacles game) = 0115+          -windowSizeX / 2 - head (obstacles game) = 0116       | otherwise = obstaclesTranslation game - gameSpeed game117     nextObstacles118       | nextObstaclesTranslation == 0 = drop 1 $ obstacles game119```120 121True commit message is: **acceleration added**122 123