Share your repls and programming experiences

← Back to all posts
💥🌾🌾FARMING GAME 🍠🍠 WITH LIVE LEADER BOARD🏆💥
PYer (2516)

A game inspired with the help of @Atari7! With a live leaderboard, you can compete with friends and compare your skills to other players! Complex strategy, never-ending fun, will keep you busy at night. A farming extravaganza, with strategy, thinking, farming, and a bit of luck, have fun!

PS: Those of you who have seen this before, it now works for anybody!

Commentshotnewtop
AQDProjects (18)

Looks Like you have an error:

Traceback (most recent call last):
File "main.py", line 21, in <module>
nscores.append((player['s'], player['n'].rstrip()))
TypeError: string indices must be integers

Haaruun (6)

@AQDProjects yea someone posted a score of "inf" and it broke the avrage function

I have a fixed version @ https://Farming-Game-verifier.haaruun.repl.run
pyelias made a game verifier

AQDProjects (18)

@Haaruun Should've read further into the comments, looks like I was late to the party

PYer (2516)

@pyelias wow thats amazing. it gets the highest score iv ever seen

bossotron13 (29)

Looks awesome, i hope you don't mind me having a try at Creating a game like this. I have 0 ideas and when i see people making games i always think “i should have though of that”.

PYer (2516)

@bossotron13 that's fine! maybe I could post a tutorial on a game like this if you want it

bossotron13 (29)

@PYer That would help me and others if you find the time.

PYer (2516)

@bossotron13 ok ill start writing one!

PYer (2516)

I made one that displays the score after every turn! (Instead of the days left.) @RileyGrooms1

PYer (2516)

thanks. you can add it to yours. @RilGames

HILLIARDGALLOW1 (2)

Traceback (most recent call last):
File "main.py", line 21, in <module>
nscores.append((player['s'], player['n'].rstrip()))
TypeError: string indices must be integers

Haaruun (6)

@C00lguy975 yea someone posted a score of "inf" and it broke the avrage function

I have a fixed version @ https://Farming-Game-verifier.haaruun.repl.run
pyelias made a game verifier

TheBlacksmith (12)

It says
Traceback (most recent call last):
File "main.py", line 21, in <module>
nscores.append((player['s'], player['n'].rstrip()))
TypeError: string indices must be integers

Haaruun (6)

@TheBlacksmith yea someone posted a score of "inf" and it broke the avrage function

I have a fixed version @ https://Farming-Game-verifier.haaruun.repl.run
pyelias made a game verifier

Haaruun (6)

something is wrong w/ your database specifically the avg function im assumuing its because a user haxor overflowed the average function but i cant test it beacuse in dont have the mongo password

PYer (2516)

there is something wrong with the average function. it is easy for people to add their own data into the database though, im trying to work on a way to fix that. @Haaruun its really hard to add security with a leaderboard like that.

pyelias (854)

@PYer The average function on the server-side is fine, but only taking the first 8 characters in getavg makes it work wrong for large numbers. You should use round or something like this instead. And for security, you could record the users actions and simulate them on the server to make sure the score is legitimate.

Haaruun (6)

@pyelias you would have to do everything on the server move by move because whats stopping someone from faking there actions by changing the benefits that happens while playing. if replit supports it i would recommend websockets to stop the delay from opening a connection and posting each time

pyelias (854)

@Haaruun You can send the random state to the server as well to have it check that the benefits were generated normally.

(something like this and this. Feel free to just copy parts of that, there's no point rewriting it)

Haaruun (6)

@PYer i got a working leaderboard server w/ game verification but im using a free mongodb and bots score so high it wont store it

https://Farming-Game-Server-2--haaruun.repl.co

Haaruun (6)

with all the bots coming on im going to try to make a seprate bot server w/ bot contests (saving bot 3.0 till then :P )

PYer (2516)

oh yeah I saw. that sounds cool! @Haaruun

juanalbglz (1)

interrupted by 13/365 days :/
THE FARMING GAME ||

 By PYer        ||

======================
Days Left [ 13 ]
Crops [ 8 ]
Seeds [ 107808038 ]
Total Land [ 423950450 ] feet
Unused Land [ 0 ] feet
Workers [ 49486704 ]

Harvested [ 82477840 ] crops!

Nothing extraordinary happened today.

KellerWorthen (1)

I like this game! Can I embed it in my website?

LoneAce (125)

Just asking out of curiosity, does using Flask and hiding the database inside a .env make the data more secure? I would like to implement this into my own projects if it means that people are not able to change the server data to whatever they want. Thanks

PYer (2516)

not really. it prevent people from deleting scores as well as manually changing the average and scores/ usernames. Basically, it prevents them from having complete control, but they can still add any scores they want by visiting the site. The main reason was to make it harder to change, but people found out still. @LoneAce

LoneAce (125)

@PYer Yea I expected that. However, if the Flask server was to return a piece of data from a .env file does it mean that another person can just make another repl and use the same app.route to get the data?

PYer (2516)

they could open up the flask app without opening your repl. then they oculd see any of the returned data. @LoneAce

LoneAce (125)

@PYer Right. But what if the repl is a private one made using a Hacker plan? Will the data be more secure? If it is I will consider subscribing

PYer (2516)

i don't think so. Anybody could still view the flask server. just not the code. @LoneAce

PYer (2516)

no problem. you could ask @pyelias he developed a secure way to create data, that includes a flask server. It's somewhere in these comments. @LoneAce

b30wulf (0)

super fun! i really enjoyed this (:

Mustafa12324 (0)

awesome, i like it very much

banew (0)

i made a score of 131432.0 points. really cool game!
also, the score website is not working (404)

Kamlemyar (0)

That was a really fun game

Banger (0)

not bad with imagination

LoneAce (125)

Can you do a tutorial on your pymongo storage? I used jsonstore and it is not very secure if someone takes a glance at the code

TheBlacksmith (12)

The previous error is fixed now, but now it just loads nothing.

PYer (2516)

mine seems to work? can you show me with a screen recording? @TheBlacksmith

TheBlacksmith (12)

@PYer It only works if I click open and use fullscreen.

Warhawk947 (9)

When i ended the game, it gave me this
Lets look at the data! You seem to do -100.0% better than an average player!

Warhawk947 (9)

@Warhawk947 is that supposed to be there?

PYer (2516)

it compares your score to the average score. You seem to have done badly, if you look at other screenshots it gives different results. @Warhawk947 It is also affected by people adding scores manually into the database that causes the average score to skyrocket.

JerryTheMouse (3)

You should make this graphical

PYer (2516)

maybe. what graphics should i add? @JerryTheMouse

JerryTheMouse (3)

@PYer Maybe instead of using the cmd line interface, use pygame/alt to make it more visual. Like turn it into an app or game?

PYer (2516)

maybe. I don't think I'll have time. I'm working on several other projects now. @JerryTheMouse

DJWang (226)

Lol I suck at this game

PYer (2516)

HELLO EVERYONE! I noticed a lot of people have been commenting on an error. I fixed it and it should work. @Haaruun Described the error if you want more information.

DanielBeattie (0)

This is an amazing game!!!!! 10/10 How long did this take you to make?

sanjaykdragon (11)

accidentally crashed the game DB while trying to cheat in it

Haaruun (6)

@sanjaykdragon saw that, you posted "inf" wich is not a number, try and cheat this one tho @ https://Farming-Game-verifier.haaruun.repl.run

sanjaykdragon (11)

@Haaruun can't cheat by POST'ing in that version because it actually simulates my entire moveset