checker game created using cocos creator 2.4.5. Game server is implemented using nakama. And bots are written in js and host in node
.
├── client #cocos creator (TS)
├── DraftkingAI # bot code (JS)
from locust import HttpUser, task, between | |
class HelloWorldUser(HttpUser): | |
wait_time = between(0.5, 2.5) | |
@task | |
def hello_world(self): | |
self.client.get('https://elections.citizen.digital/') |
<form> | |
<label>Single selection | |
<select> | |
<option value="0">Zero</option> | |
<option value="1">One</option> | |
<option value="2">Two</option> | |
<option value="3">Three</option> | |
<option value="4">Four</option> | |
</select> | |
</label> |
const { Client, Session } = require("./nakama-js.umd"); | |
const { GAME_CONFIG } = require('./Config'); | |
const { Game } = require('./core/checkers'); | |
const { gamebot } = require('./core/gamebot'); | |
const fs = require('fs'); | |
const { ACCOUNT_INFO } = require('./Config'); | |
const BOT_STATE = { | |
UN_USE: 0, | |
ACTIVE: 1, |
const axios = require('axios').default; | |
const { GAME_CONFIG } = require('./Config'); | |
const { ACCOUNT_INFO, ROOM_HAVE_BOT } = require('./Config'); | |
const { BOT_STATE } = require('./Bot'); | |
const Bot = require('./Bot'); | |
var usersAtRooms = Bot.usersAtRooms; | |
var gameConfig = null; | |
const fs = require('fs'); | |
//-------------------------------------------------------------------------------------------- |
from rest_framework.authtoken.views import ObtainAuthToken | |
class CustomAuthToken(ObtainAuthToken): | |
def post(self, request, *args, **kwargs): | |
serializer = self.serializer_class( | |
data=request.data, context={"request": request} | |
) | |
serializer.is_valid(raise_exception=True) | |
user = serializer.validated_data["user"] |
# Stop all containers | |
docker stop `docker ps -qa` | |
# Remove all containers | |
docker rm `docker ps -qa` | |
# Remove all images | |
docker rmi -f `docker images -qa ` | |
# Remove all volumes |
import africastalking | |
username = "africa username" # use 'sandbox' for development in the test environment | |
# use your sandbox app API key for development in the test environment | |
api_key = "africa's talking api key" | |
africastalking.initialize(username, api_key) | |
# # Use the service synchronously |
# users/admin.py | |
from django.contrib import admin | |
from django.contrib.auth import get_user_model | |
from django.contrib.auth.admin import UserAdmin | |
from .forms import CustomUserCreationForm, CustomUserChangeForm | |
from .models import CustomUser | |
class CustomUserAdmin(UserAdmin): | |
add_form = CustomUserCreationForm |