applysci / aim Goto Github PK
View Code? Open in Web Editor NEWAll-Ireland Mahjong mobile app
All-Ireland Mahjong mobile app
We need a way to have a unique player ID that remains unperturbed by seating ID. We can use the registration ID for this, we just need to work out how.
I rarely want to go to the all tournaments page, but it might still be good to have a dedicated button for it, rather than the back button sometimes going there, and not always when expected.
Also, not sure about losing the bottom tabs when going into player profile or hanchan results page.
it's taken quite some special handling to be able to deal with substitutes. I don't like it, and we should definitely look at this again.
It messes up the whole existing paradigm.
there's now a dummy table created, server-side, called "missing", to handle players that don't appear at any table.
two parts:
change it before the tournament starts - fairly easy - just use one of the standard templates. May need to check assigned seating numbers are contiguous 1-N.
change it after at least one round has been played - much more difficult. For this, we need to track substitutes, and need to reassign seating to minimise collisions. There's a crude starting point in https://github.com/ApplySci/aim/blob/main/server/run/reassign.py
so this is what i'm thinking, its written in typescript but i can convert it to something else if you're not familiar with it.
type PlayerId = number
// same as current
interface Player {
id: PlayerId
name: string
}
// players store
// same as current
type PlayersCollection = Player[]
type TournamentId = string
// same as current
interface Tournament {
id: TournamentId
name: string
address: string
country: string
startDate: string
endDate: string
status: string
rules: string
}
// tournaments store
// same as current
type TournamentsCollection = Tournament[]
type RoundId = string
type TableId = string
// schedule store
// combined Schedule + seating
interface ScheduleCollection {
timezone: string
rounds: {
id: RoundId
name: string
start: string
tables: {
id: TableId
name: string
players: [
PlayerId,
PlayerId,
PlayerId,
PlayerId,
]
}[]
}[]
}
class PlayerRoundScore {
score: number
penalties: number
uma: number
position: number
rank: number
tied: boolean
get finalScore(): number {
return this.score - this.penalties + this.uma
}
}
class PlayerScore {
id: PlayerId
// is it too much info to get this per round?
rounds: PlayerRoundScore[]
get score(): number {
return this.rounds.reduce((value, round) => value + round.score, 0)
}
get penalties(): number {
return this.rounds.reduce((value, round) => value + round.penalties, 0)
}
get finalScore(): number {
return this.rounds.reduce((value, round) => value + round.finalScore, 0)
}
rank(roundIndex: number): number | undefined {
return this.rounds[roundIndex]?.rank
}
tied(roundIndex: number): boolean {
return this.rounds[roundIndex]?.tied ?? false
}
}
// scores store
type ScoresCollection = PlayerScore[]
// calculate roundsDone like this:
let scoresCollection: PlayerScore[] = []
const roundsDone = () => scoresCollection.reduce<number | null>(
(value, playerScore) => value != null
? Math.min(value, playerScore.rounds.length)
: playerScore.rounds.length,
null,
) ?? 0
As json doesn't support non-string keys, my preference is to return lists with the id
instead. This means the client doesn't need to do any unnecessary conversion and ids are always consistently typed.
Looking at the docs for firestore, it looks like they support nested json. Is there any reason you're converting to a json string? I've not used firestore so maybe there is some limitation i'm unaware of.
We can put in-game and out-of-game penalties onto the player profile page, which will help mitigate this.
It's not really anticipated that people will follow more than 1 tournament at once, so this is low priority for now.
reproduced on ipad and android
This is the problem with the alarm package (from https://pub.dev/packages/alarm ):
The alarms sound & vibrate even if the user has silenced them on their phone. This is very much unwanted behaviour.
IIRC, this is much better behaved: https://pub.dev/documentation/flutter_local_notifications/
Obviously we don't do that. Should we catch it anyway and tell them it auto refreshed?
it's always (info tab, seating tab) displaying it in the event timezone, even if that preference is switched off.
It might be nice to show the timezone difference or something next to the times, when we are using local non-event timezones
Put two (or more) pre-composed seating arrangements back to back, shuffling the numbers, and then optimise to ensure that there are no cases where the same three people meet more than once.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.