Math knowledge checker mod

Post Reply
TillCoyote
Member
Posts: 30
Joined: Sat Jan 26, 2019 08:05
Location: Kasachische Republik

Math knowledge checker mod

by TillCoyote » Post

You don't like stupid players? Filter them!

This mod asks every new player the root of 16. If a player answers uncorrectly, it gets banned.

This mod can filter very stupid players and bots.

Code: Select all

-- THIS CODE IS ONLY FOR 0.4 COMPATIBILITY, will be removed by 0.5
if not minetest.translate then
       function minetest.translate(textdomain, str, ...)
          local arg = {n=select('#', ...), ...}
          return str:gsub("@(.)", function(matched)
             local c = string.byte(matched)
             if string.byte("1") <= c and c <= string.byte("9") then
                return arg[c - string.byte("0")]
             else
                return matched
             end
          end)
       end

       function minetest.get_translator(textdomain)
          return function(str, ...) return minetest.translate(textdomain or "", str, ...) end
       end
end
-- ENВ

local S = minetest.get_translator("mathknowledge")
local mtlog = minetest.log

local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)

local mainformspec = ""..
	"size[4,3]" ..
	"label[0,0;"..S("Math test").."]" ..
	"field[1,1.5;3,1;name;"..S("What is the root of 16?")..";]" ..
	"button_exit[1,2;2,1;exit;Check]"

minetest.register_on_newplayer(function(player)
	local name = player:get_player_name()
	minetest.show_formspec(name, modname.."testform", mainformspec)
end)

minetest.register_on_player_receive_fields(function(player, formname, fields)
    if formname == modname.."testform" then
		if fields.name ~= "4" then
			minetest.ban_player(player:get_player_name())
		end
		
		return true
    end
end)

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Math knowledge checker mod

by Krock » Post

Hello and welcome. I've seen various attempts on filtering players, this is a very rudimentary method. It works but consider asking various different questions, so that accidents can be avoided. There are also "high quality" players who don't know about square roots yet.
Your check also does not work for answers like " 4", "four" or "4.0".

Here are some comparable mods which might give you some additional ideas to extend your mod:
viewtopic.php?t=12441
viewtopic.php?t=14634
.. I've seen way more on other servers, but cannot find them on the forums.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

TillCoyote
Member
Posts: 30
Joined: Sat Jan 26, 2019 08:05
Location: Kasachische Republik

Re: Math knowledge checker mod

by TillCoyote » Post

Krock wrote:Hello and welcome. I've seen various attempts on filtering players, this is a very rudimentary method. It works but consider asking various different questions, so that accidents can be avoided. There are also "high quality" players who don't know about square roots yet.
Your check also does not work for answers like " 4", "four" or "4.0".

Here are some comparable mods which might give you some additional ideas to extend your mod:
viewtopic.php?t=12441
viewtopic.php?t=14634
.. I've seen way more on other servers, but cannot find them on the forums.
Yes, but high quality player can realize about google. I did the same when I didn't know math. It's a joke mod but a cool idea. Thanks.

dawgdoc
Member
Posts: 260
Joined: Mon Feb 27, 2017 01:10
GitHub: dawgdoc

Re: Math knowledge checker mod

by dawgdoc » Post

If you want them to google for the answer, you may be better off specifying "Square Root." Some may first come across cube roots, fourth roots, etc. Your example of 16 give an integer for both square and fourth roots. ;-D
Give a man a fish, feed him for a day. Give a kid a fish, it's going to die.

User avatar
v-rob
Developer
Posts: 971
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: Math knowledge checker mod

by v-rob » Post

What is someone answers "±4" (plus or minus four), which is a correct answer, or "4, -4"? There's a lot of correct answers that aren't answered.
Core Developer | My Best Mods: Bridger - Slats - Stained Glass

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests